[PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27

Previous thread: [PATCH 0/8] Blackfin serial driver updates for 2.6.27 by Bryan Wu on Saturday, July 26, 2008 - 11:03 pm. (9 messages)

Next thread: [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 by Bryan Wu on Saturday, July 26, 2008 - 11:27 pm. (8 messages)
From: Bryan Wu
Date: Saturday, July 26, 2008 - 11:13 pm

Hi Jeff,

Please take a look at these Blackfin EMAC driver updates for 2.6.27

Thanks
-Bryan

--

From: Bryan Wu
Date: Saturday, July 26, 2008 - 11:13 pm

From: Mike Frysinger <vapier.adi@gmail.com>

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/net/bfin_mac.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 4144343..e18a7ee 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -614,7 +614,7 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
 	 * Is skb->data always 16-bit aligned?
 	 * Do we need to memcpy((char *)(tail->packet + 2), skb->data, len)?
 	 */
-	if ((((unsigned int)(skb->data)) & 0x02) == 2) {
+	if ((((unsigned int)(skb->data)) & 0x01) == 0) {
 		/* move skb->data to current_tx_ptr payload */
 		data = (unsigned int)(skb->data) - 2;
 		*((unsigned short *)data) = (unsigned short)(skb->len);
@@ -956,7 +956,7 @@ static int bfin_mac_close(struct net_device *dev)
 	return 0;
 }
 
-static int __init bfin_mac_probe(struct platform_device *pdev)
+static int __devinit bfin_mac_probe(struct platform_device *pdev)
 {
 	struct net_device *ndev;
 	struct bfin_mac_local *lp;
@@ -1082,7 +1082,7 @@ out_err_probe_mac:
 	return rc;
 }
 
-static int bfin_mac_remove(struct platform_device *pdev)
+static int __devexit bfin_mac_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct bfin_mac_local *lp = netdev_priv(ndev);
@@ -1129,7 +1129,7 @@ static int bfin_mac_resume(struct platform_device *pdev)
 
 static struct platform_driver bfin_mac_driver = {
 	.probe = bfin_mac_probe,
-	.remove = bfin_mac_remove,
+	.remove = __devexit_p(bfin_mac_remove),
 	.resume = bfin_mac_resume,
 	.suspend = bfin_mac_suspend,
 	.driver = {
-- 
1.5.6

--

From: Mike Frysinger
Date: Sunday, July 27, 2008 - 6:03 am

i think this unrelated hunk slipped in
-mike
--

From: Bryan Wu
Date: Sunday, July 27, 2008 - 7:46 am

Oops, I messed up something. Fixed now.

Thanks,
-Bryan
--

From: Bryan Wu
Date: Saturday, July 26, 2008 - 11:13 pm

Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/net/bfin_mac.c |  103 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 77 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index e18a7ee..57ebe6d 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -606,36 +606,87 @@ adjust_head:
 static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
 				struct net_device *dev)
 {
-	unsigned int data;
+	u16 *data;
 
 	current_tx_ptr->skb = skb;
 
-	/*
-	 * Is skb->data always 16-bit aligned?
-	 * Do we need to memcpy((char *)(tail->packet + 2), skb->data, len)?
-	 */
-	if ((((unsigned int)(skb->data)) & 0x01) == 0) {
-		/* move skb->data to current_tx_ptr payload */
-		data = (unsigned int)(skb->data) - 2;
-		*((unsigned short *)data) = (unsigned short)(skb->len);
-		current_tx_ptr->desc_a.start_addr = (unsigned long)data;
-		/* this is important! */
-		blackfin_dcache_flush_range(data, (data + (skb->len)) + 2);
-
+	if (ANOMALY_05000285) {
+		/*
+		 * TXDWA feature is not avaible to older revision < 0.3 silicon
+		 * of BF537
+		 *
+		 * Only if data buffer is ODD WORD alignment, we do not
+		 * need to memcpy
+		 */
+		u32 data_align = (u32)(skb->data) & 0x3;
+		if (data_align == 0x2) {
+			/* move skb->data to current_tx_ptr payload */
+			data = (u16 *)(skb->data) - 1;
+			*data = (u16)(skb->len);
+			current_tx_ptr->desc_a.start_addr = (u32)data;
+			/* this is important! */
+			blackfin_dcache_flush_range((u32)data,
+					(u32)((u8 *)data + skb->len + 4));
+		} else {
+			*((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
+			memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
+				skb->len);
+			current_tx_ptr->desc_a.start_addr =
+				(u32)current_tx_ptr->packet;
+			if (current_tx_ptr->status.status_word != 0)
+				current_tx_ptr->status.status_word = 0;
+			blackfin_dcache_flush_range(
+				(u32)current_tx_ptr->packet,
+				(u32)(current_tx_ptr->packet + skb->len + ...
From: Ingo Oeser
Date: Monday, July 28, 2008 - 3:05 am

Hi Bryan,

you duplicate a lot of clever code here. 
Would you mind refactoring this part in a follow-up patch?



Best Regards

Ingo Oeser
--

From: Bryan Wu
Date: Saturday, July 26, 2008 - 11:13 pm

From: Michael Hennerich <michael.hennerich@analog.com>

Reprogram MAC address after resume from Suspend Mem
(Blackfin Hibernate looses all CORE and SYSTEM register content)

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/net/bfin_mac.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 57ebe6d..69a6b9d 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -972,6 +972,7 @@ static int bfin_mac_open(struct net_device *dev)
 	phy_start(lp->phydev);
 	phy_write(lp->phydev, MII_BMCR, BMCR_RESET);
 	setup_system_regs(dev);
+	setup_mac_addr(dev->dev_addr);
 	bfin_mac_disable();
 	bfin_mac_enable();
 	pr_debug("hardware init finished\n");
-- 
1.5.6

--

Previous thread: [PATCH 0/8] Blackfin serial driver updates for 2.6.27 by Bryan Wu on Saturday, July 26, 2008 - 11:03 pm. (9 messages)

Next thread: [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 by Bryan Wu on Saturday, July 26, 2008 - 11:27 pm. (8 messages)