* [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 (v2)
@ 2008-07-27 14:45 Bryan Wu
2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Bryan Wu @ 2008-07-27 14:45 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel
Hi Jeff,
Please ignore the v1 patchset. I messed up something which Mike pointed out.
Thanks a lot
-Bryan
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings 2008-07-27 14:45 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 (v2) Bryan Wu @ 2008-07-27 14:45 ` Bryan Wu 2008-07-28 15:21 ` Paulius Zaleckas 2008-07-29 21:49 ` Jeff Garzik 2008-07-27 14:45 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu 2008-07-27 14:45 ` [PATCH 3/3] Blackfin EMAC Driver: Functional power management support Bryan Wu 2 siblings, 2 replies; 9+ messages in thread From: Bryan Wu @ 2008-07-27 14:45 UTC (permalink / raw) To: jeff; +Cc: netdev, linux-kernel, Mike Frysinger, Bryan Wu 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 | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 4144343..17951cb 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings 2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu @ 2008-07-28 15:21 ` Paulius Zaleckas 2008-07-29 3:34 ` Bryan Wu 2008-07-29 21:49 ` Jeff Garzik 1 sibling, 1 reply; 9+ messages in thread From: Paulius Zaleckas @ 2008-07-28 15:21 UTC (permalink / raw) To: linux-kernel; +Cc: netdev, linux-kernel Bryan Wu wrote: > 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 | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c > index 4144343..17951cb 100644 > --- a/drivers/net/bfin_mac.c > +++ b/drivers/net/bfin_mac.c > @@ -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) __init was OK here. __devinit is for hotplug devices > { > 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) __devexit is for hotplug, use __exit > { > 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, .probe shouldn't be declared here. And you should use platform_device_probe() instead of platform_device_add() > - .remove = bfin_mac_remove, > + .remove = __devexit_p(bfin_mac_remove), should be __exit_p() > .resume = bfin_mac_resume, > .suspend = bfin_mac_suspend, > .driver = { ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings 2008-07-28 15:21 ` Paulius Zaleckas @ 2008-07-29 3:34 ` Bryan Wu 0 siblings, 0 replies; 9+ messages in thread From: Bryan Wu @ 2008-07-29 3:34 UTC (permalink / raw) To: Paulius Zaleckas; +Cc: netdev, linux-kernel On Mon, Jul 28, 2008 at 11:21 PM, Paulius Zaleckas <paulius.zaleckas@teltonika.lt> wrote: > Bryan Wu wrote: >> >> 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 | 6 +++--- >> 1 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c >> index 4144343..17951cb 100644 >> --- a/drivers/net/bfin_mac.c >> +++ b/drivers/net/bfin_mac.c >> @@ -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) > > __init was OK here. > __devinit is for hotplug devices > >> { >> 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) > > __devexit is for hotplug, use __exit > >> { >> 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, > > .probe shouldn't be declared here. And you should use > platform_device_probe() instead of platform_device_add() > I failed to find platform_device_probe. Could you please provide some info? .probe and .remove is very common in platform driver interface, isn't? I don't know any difference between platform_device_probe() and platform_device_add(). Thanks -Bryan >> - .remove = bfin_mac_remove, >> + .remove = __devexit_p(bfin_mac_remove), > > should be __exit_p() > >> .resume = bfin_mac_resume, >> .suspend = bfin_mac_suspend, >> .driver = { > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings 2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu 2008-07-28 15:21 ` Paulius Zaleckas @ 2008-07-29 21:49 ` Jeff Garzik 1 sibling, 0 replies; 9+ messages in thread From: Jeff Garzik @ 2008-07-29 21:49 UTC (permalink / raw) To: Bryan Wu; +Cc: netdev, linux-kernel, Mike Frysinger Bryan Wu wrote: > 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 | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > applied 1-3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) 2008-07-27 14:45 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 (v2) Bryan Wu 2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu @ 2008-07-27 14:45 ` Bryan Wu 2008-07-27 14:45 ` [PATCH 3/3] Blackfin EMAC Driver: Functional power management support Bryan Wu 2 siblings, 0 replies; 9+ messages in thread From: Bryan Wu @ 2008-07-27 14:45 UTC (permalink / raw) To: jeff; +Cc: netdev, linux-kernel, Bryan Wu 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 17951cb..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)) & 0x02) == 2) { - /* 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 + 2)); + } } else { - *((unsigned short *)(current_tx_ptr->packet)) = - (unsigned short)(skb->len); - memcpy((char *)(current_tx_ptr->packet + 2), skb->data, - (skb->len)); - current_tx_ptr->desc_a.start_addr = - (unsigned long)current_tx_ptr->packet; - if (current_tx_ptr->status.status_word != 0) - current_tx_ptr->status.status_word = 0; - blackfin_dcache_flush_range((unsigned int)current_tx_ptr-> - packet, - (unsigned int)(current_tx_ptr-> - packet + skb->len) + - 2); + /* + * TXDWA feature is avaible to revision < 0.3 silicon of + * BF537 and always avaible to BF52x + */ + u32 data_align = (u32)(skb->data) & 0x3; + if (data_align == 0x0) { + u16 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl |= TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + /* move skb->data to current_tx_ptr payload */ + data = (u16 *)(skb->data) - 2; + *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 if (data_align == 0x2) { + u16 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl &= ~TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + /* 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 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl &= ~TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + *((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 + 2)); + } } /* enable this packet's dma */ -- 1.5.6 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] Blackfin EMAC Driver: Functional power management support 2008-07-27 14:45 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 (v2) Bryan Wu 2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu 2008-07-27 14:45 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu @ 2008-07-27 14:45 ` Bryan Wu 2 siblings, 0 replies; 9+ messages in thread From: Bryan Wu @ 2008-07-27 14:45 UTC (permalink / raw) To: jeff; +Cc: netdev, linux-kernel, Michael Hennerich, Bryan Wu 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 @ 2008-07-27 6:13 Bryan Wu 2008-07-27 6:13 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu 0 siblings, 1 reply; 9+ messages in thread From: Bryan Wu @ 2008-07-27 6:13 UTC (permalink / raw) To: jeff; +Cc: netdev, linux-kernel, akpm Hi Jeff, Please take a look at these Blackfin EMAC driver updates for 2.6.27 Thanks -Bryan ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) 2008-07-27 6:13 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 Bryan Wu @ 2008-07-27 6:13 ` Bryan Wu 2008-07-28 10:05 ` Ingo Oeser 0 siblings, 1 reply; 9+ messages in thread From: Bryan Wu @ 2008-07-27 6:13 UTC (permalink / raw) To: jeff; +Cc: netdev, linux-kernel, akpm, Bryan Wu 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 + 2)); + } } else { - *((unsigned short *)(current_tx_ptr->packet)) = - (unsigned short)(skb->len); - memcpy((char *)(current_tx_ptr->packet + 2), skb->data, - (skb->len)); - current_tx_ptr->desc_a.start_addr = - (unsigned long)current_tx_ptr->packet; - if (current_tx_ptr->status.status_word != 0) - current_tx_ptr->status.status_word = 0; - blackfin_dcache_flush_range((unsigned int)current_tx_ptr-> - packet, - (unsigned int)(current_tx_ptr-> - packet + skb->len) + - 2); + /* + * TXDWA feature is avaible to revision < 0.3 silicon of + * BF537 and always avaible to BF52x + */ + u32 data_align = (u32)(skb->data) & 0x3; + if (data_align == 0x0) { + u16 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl |= TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + /* move skb->data to current_tx_ptr payload */ + data = (u16 *)(skb->data) - 2; + *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 if (data_align == 0x2) { + u16 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl &= ~TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + /* 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 sysctl = bfin_read_EMAC_SYSCTL(); + sysctl &= ~TXDWA; + bfin_write_EMAC_SYSCTL(sysctl); + + *((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 + 2)); + } } /* enable this packet's dma */ -- 1.5.6 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) 2008-07-27 6:13 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu @ 2008-07-28 10:05 ` Ingo Oeser 0 siblings, 0 replies; 9+ messages in thread From: Ingo Oeser @ 2008-07-28 10:05 UTC (permalink / raw) To: Bryan Wu; +Cc: jeff, netdev, linux-kernel, akpm Hi Bryan, you duplicate a lot of clever code here. Would you mind refactoring this part in a follow-up patch? Bryan Wu schrieb: > 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 + 2)); > + } > } else { > - *((unsigned short *)(current_tx_ptr->packet)) = > - (unsigned short)(skb->len); > - memcpy((char *)(current_tx_ptr->packet + 2), skb->data, > - (skb->len)); > - current_tx_ptr->desc_a.start_addr = > - (unsigned long)current_tx_ptr->packet; > - if (current_tx_ptr->status.status_word != 0) > - current_tx_ptr->status.status_word = 0; > - blackfin_dcache_flush_range((unsigned int)current_tx_ptr-> > - packet, > - (unsigned int)(current_tx_ptr-> > - packet + skb->len) + > - 2); > + /* > + * TXDWA feature is avaible to revision < 0.3 silicon of > + * BF537 and always avaible to BF52x > + */ > + u32 data_align = (u32)(skb->data) & 0x3; > + if (data_align == 0x0) { This condition seems to be the only part dependend on "ANOMALY_05000285". > + u16 sysctl = bfin_read_EMAC_SYSCTL(); > + sysctl |= TXDWA; > + bfin_write_EMAC_SYSCTL(sysctl); > + > + /* move skb->data to current_tx_ptr payload */ > + data = (u16 *)(skb->data) - 2; > + *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 if (data_align == 0x2) { > + u16 sysctl = bfin_read_EMAC_SYSCTL(); > + sysctl &= ~TXDWA; > + bfin_write_EMAC_SYSCTL(sysctl); > + > + /* 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 sysctl = bfin_read_EMAC_SYSCTL(); > + sysctl &= ~TXDWA; > + bfin_write_EMAC_SYSCTL(sysctl); > + > + *((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 + 2)); > + } > } > > /* enable this packet's dma */ Best Regards Ingo Oeser ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-07-29 21:49 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-07-27 14:45 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 (v2) Bryan Wu 2008-07-27 14:45 ` [PATCH 1/3] Blackfin EMAC Driver: add proper __devinit/__devexit markings Bryan Wu 2008-07-28 15:21 ` Paulius Zaleckas 2008-07-29 3:34 ` Bryan Wu 2008-07-29 21:49 ` Jeff Garzik 2008-07-27 14:45 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu 2008-07-27 14:45 ` [PATCH 3/3] Blackfin EMAC Driver: Functional power management support Bryan Wu -- strict thread matches above, loose matches on Subject: below -- 2008-07-27 6:13 [PATCH 0/3] Blackfin EMAC Driver updates for 2.6.27 Bryan Wu 2008-07-27 6:13 ` [PATCH 2/3] Blackfin EMAC Driver: enable TXDWA new feature for new silicon (rev > 0.2) Bryan Wu 2008-07-28 10:05 ` Ingo Oeser
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome