EMAC driver updates
Subsystems (2)
cover EMAC driver updates
Several bug fixing for this driver.
PATCH 1/8 EMAC driver: shorten the mdelay value to solve netperf performance issue
--- drivers/net/bfin_mac.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bfin_mac.c +2 -2
@@ -296,7 +296,7 @@ static void mdio_poll(void)/* poll the STABUSY bit */ while ((bfin_read_EMAC_STAADD ()) &STABUSY ) { -mdelay (10 ); +udelay (1 );if (timeout_cnt-- <0 ) { printk(KERN_ERR DRV_NAME ": wait MDC/MDIO transaction to complete timeout\n");
@@ -551,7 +551,7 @@ static void adjust_tx_list(void)*/ if (current_tx_ptr->next->next == tx_list_head) {while (tx_list_head->status.status_word ==0 ) { -mdelay (10 ); +mdelay (1 );if (tx_list_head->status.status_word !=0 || !(bfin_read_DMA2_IRQ_STATUS () &0x08 )) { goto adjust_head;
Signature · 1 line
1.5.3.4
Re: [PATCH 1/8] [Blackfin] EMAC driver: shorten the mdelay value to solve netperf performance issue
Quoted 4 lines · Bryan Wu
Signed-off-by Bryan Wu <[email protected]>--- drivers/net/bfin_mac.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
applied 1-8
PATCH 2/8 EMAC driver: define MDC_CLK=2.5MHz and caculate mdc_div according to SCLK.
In reply to Bryan Wu--- drivers/net/bfin_mac.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/bfin_mac.c +12 -4
@@ -412,20 +412,26 @@ static void bf537_adjust_link(struct net_device *dev)spin_unlock_irqrestore (&lp->lock, flags); } +/* MDC = 2.5 MHz */ +#define MDC_CLK 2500000 +static int mii_probe (struct net_device *dev) {struct bf537mac_local *lp =netdev_priv (dev);struct phy_device *phydev =NULL ;unsigned short sysctl;int i; +u32 sclk, mdc_div;/* Enable PHY output early */ if (!(bfin_read_VR_CTL () &PHYCLKOE ))bfin_write_VR_CTL (bfin_read_VR_CTL () |PHYCLKOE ); -/* MDC = 2.5 MHz */ + sclk =get_sclk (); + mdc_div = ((sclk /MDC_CLK ) /2 ) -1 ; + sysctl =bfin_read_EMAC_SYSCTL (); - sysctl |=SET_MDCDIV (24 ); + sysctl |=SET_MDCDIV (mdc_div);bfin_write_EMAC_SYSCTL (sysctl);/* search for connect PHY device */
@@ -477,8 +483,10 @@ static int mii_probe(struct net_device *dev) lp->phydev = phydev;printk (KERN_INFO "%s: attached PHY driver [%s] " -"(mii_bus:phy_addr=%s, irq=%d)\n" , -DRV_NAME , phydev->drv->name, phydev->dev.bus_id, phydev->irq); +"(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)" +"@sclk=%dMHz)\n" , +DRV_NAME , phydev->drv->name, phydev->dev.bus_id, phydev->irq, +MDC_CLK , mdc_div, sclk/1000000 );return 0 ; }
Signature · 1 line
1.5.3.4
PATCH 3/8 EMAC driver: bf537 MAC multicast hash filtering patch
In reply to Bryan WuFrom: Aidan Williams <[email protected]>
The bf537 Ethernet MAC driver in the 2007R1.1-RC3 kernel (and the current kernel) do not implement multicast hash filtering. This is a performance problem if you have lots of multicast on your network.
This patch plugs the right bits into the multicast hash registers.
--- drivers/net/bfin_mac.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-)
drivers/net/bfin_mac.c +41 -1
@@ -11,6 +11,7 @@* Description: * * Modified: +* 2006-12-19 Aidan Williams, multicast hash support * Copyright 2004-2006 Analog Devices Inc. * * Bugs: Enter bugs at http://blackfin.uclinux.org/
@@ -800,6 +801,39 @@ static void bf537mac_timeout(struct net_device *dev)netif_wake_queue (dev); } +static void bf537mac_multicast_hash (struct net_device *dev) +{ +u32 emac_hashhi, emac_hashlo; +struct dev_mc_list *dmi = dev->mc_list; +char *addrs; +int i; +u32 crc; + + emac_hashhi = emac_hashlo =0 ; + +for (i =0 ; i < dev->mc_count; i++) { + addrs = dmi->dmi_addr; + dmi = dmi->next; + +/* skip non-multicast addresses */ +if (!(*addrs &1 )) +continue ; + + crc =ether_crc (ETH_ALEN , addrs); + crc >>=26 ; + +if (crc &0x20 ) + emac_hashhi |=1 << (crc &0x1f ); +else + emac_hashlo |=1 << (crc &0x1f ); + } + +bfin_write_EMAC_HASHHI (emac_hashhi); +bfin_write_EMAC_HASHLO (emac_hashlo); + +return ; +} +/* * This routine will, depending on the values passed to it, * either make it accept multicast packets, go into
@@ -815,11 +849,17 @@ static void bf537mac_set_multicast_list(struct net_device *dev) sysctl =bfin_read_EMAC_OPMODE (); sysctl |=RAF ;bfin_write_EMAC_OPMODE (sysctl); - }else if (dev->flags &IFF_ALLMULTI || dev->mc_count) { + }else if (dev->flags &IFF_ALLMULTI ) {/* accept all multicast */ sysctl =bfin_read_EMAC_OPMODE (); sysctl |=PAM ;bfin_write_EMAC_OPMODE (sysctl); + }else if (dev->mc_count) { +/* set up multicast hash table */ + sysctl =bfin_read_EMAC_OPMODE (); + sysctl |=HM ; +bfin_write_EMAC_OPMODE (sysctl); +bf537mac_multicast_hash (dev); }else {/* clear promisc or multicast mode */ sysctl =bfin_read_EMAC_OPMODE ();
Signature · 1 line
1.5.3.4
PATCH 4/8 EMAC driver: use simpler comment headers and strip out information that is maintained in the scm's log
In reply to Bryan WuFrom: Mike Frysinger <[email protected]>
--- drivers/net/bfin_mac.c | 32 ++++---------------------------- drivers/net/bfin_mac.h | 31 ++++--------------------------- 2 files changed, 8 insertions(+), 55 deletions(-)
drivers/net/bfin_mac.c +4 -28
@@ -1,35 +1,11 @@/* -* File: drivers/net/bfin_mac.c -* Based on: -* Maintainer: -* Bryan Wu <[email protected]> +* Blackfin On-Chip MAC Driver * -* Original author: -* Luke Yang <[email protected]> +* Copyright 2004-2007 Analog Devices Inc. * -* Created: -* Description: +* Enter bugs at http://blackfin.uclinux.org/ * -* Modified: -* 2006-12-19 Aidan Williams, multicast hash support -* Copyright 2004-2006 Analog Devices Inc. -* -* Bugs: Enter bugs at http://blackfin.uclinux.org/ -* -* This program is free software ; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation ; either version 2, or (at your option) -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY ; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program ; see the file COPYING. -* If not, write to the Free Software Foundation, -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* Licensed under the GPL-2 or later. */ #include <linux/init.h>
drivers/net/bfin_mac.h +4 -27
@@ -1,34 +1,11 @@/* -* File: drivers/net/bfin_mac.c -* Based on: -* Maintainer: -* Bryan Wu <[email protected]> +* Blackfin On-Chip MAC Driver * -* Original author: -* Luke Yang <[email protected]> +* Copyright 2004-2007 Analog Devices Inc. * -* Created: -* Description: +* Enter bugs at http://blackfin.uclinux.org/ * -* Modified: -* Copyright 2004-2006 Analog Devices Inc. -* -* Bugs: Enter bugs at http://blackfin.uclinux.org/ -* -* This program is free software ; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation ; either version 2, or (at your option) -* any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY ; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program ; see the file COPYING. -* If not, write to the Free Software Foundation, -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* Licensed under the GPL-2 or later. */ #define BFIN_MAC_CSUM_OFFLOAD
Signature · 1 line
1.5.3.4
PATCH 5/8 EMAC driver: ADSP-BF52x arch/mach support
In reply to Bryan WuFrom: Michael Hennerich <[email protected]>
--- drivers/net/Kconfig | 9 +++++---- drivers/net/bfin_mac.c | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/Kconfig +5 -4
@@ -814,8 +814,8 @@ config ULTRA32 will be called smc-ultra32. config BFIN_MAC - tristate "Blackfin 536/537 on-chip mac support" - depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H) + tristate "Blackfin 527/536/537 on-chip mac support" + depends on NET_ETHERNET && (BF527 || BF537 || BF536) && (!BF537_PORT_H) select CRC32 select MII select PHYLIB
@@ -828,7 +828,7 @@ config BFIN_MAC config BFIN_MAC_USE_L1 bool "Use L1 memory for rx/tx packets" - depends on BFIN_MAC && BF537 + depends on BFIN_MAC && (BF527 || BF537) default y help To get maximum network performance, you should use L1 memory as rx/tx buffers.
@@ -855,7 +855,8 @@ config BFIN_RX_DESC_NUM config BFIN_MAC_RMII bool "RMII PHY Interface (EXPERIMENTAL)" depends on BFIN_MAC && EXPERIMENTAL - default n + default y if BFIN527_EZKIT + default n if BFIN537_STAMP help Use Reduced PHY MII Interface
drivers/net/bfin_mac.c +3 -3
@@ -42,7 +42,7 @@#define DRV_NAME "bfin_mac"#define DRV_VERSION "1.1"#define DRV_AUTHOR "Bryan Wu, Luke Yang" -#define DRV_DESC "Blackfin BF53[67] on-chip Ethernet MAC driver" +#define DRV_DESC "Blackfin BF53[67] BF527 on-chip Ethernet MAC driver"MODULE_AUTHOR (DRV_AUTHOR );MODULE_LICENSE ("GPL" );
@@ -752,7 +752,7 @@ static void bf537mac_enable(void)#if defined(CONFIG_BFIN_MAC_RMII ) opmode |=RMII ;/* For Now only 100MBit are supported */ -#ifdef CONFIG_BF_REV_0_2 +#if (defined(CONFIG_BF537 ) || defined(CONFIG_BF536 )) &&CONFIG_BF_REV_0_2 opmode |=TE ;#endif #endif
@@ -994,7 +994,7 @@ static int __init bf537mac_probe(struct net_device *dev)/* register irq handler */ if (request_irq (IRQ_MAC_RX , bf537mac_interrupt,IRQF_DISABLED |IRQF_SHARED , -"BFIN537_MAC_RX" , dev)) { +"EMAC_RX" , dev)) { printk(KERN_WARNING DRV_NAME ": Unable to attach BlackFin MAC RX interrupt\n");return -EBUSY ;
Signature · 1 line
1.5.3.4
PATCH 6/8 EMAC driver: add power down mode
In reply to Bryan WuFrom: Vitja Makarov <[email protected]>
This patch puts phy in power-down mode when interface is down. Also we should think about energy detect power-down mode, that will decrease power consumption when no link.
--- drivers/net/bfin_mac.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/bfin_mac.c +2 -1
@@ -884,10 +884,10 @@ static int bf537mac_open(struct net_device *dev)return retval;phy_start (lp->phydev); +phy_write (lp->phydev,MII_BMCR ,BMCR_RESET );setup_system_regs (dev);bf537mac_disable ();bf537mac_enable (); -pr_debug ("hardware init finished\n" );netif_start_queue (dev);netif_carrier_on (dev);
@@ -910,6 +910,7 @@ static int bf537mac_close(struct net_device *dev)netif_carrier_off (dev);phy_stop (lp->phydev); +phy_write (lp->phydev,MII_BMCR ,BMCR_PDOWN );/* clear everything */ bf537mac_shutdown (dev);
Signature · 1 line
1.5.3.4
PATCH 7/8 EMAC driver: fix bug - invalidate data cache of new_skb->data range when cache is WB
In reply to Bryan WuFrom: Alexey Demin <[email protected]>
It prevents overwritting new data from DMA.
--- drivers/net/bfin_mac.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/bfin_mac.c +6 -0
@@ -651,6 +651,12 @@ static void bf537mac_rx(struct net_device *dev) current_rx_ptr->skb = new_skb; current_rx_ptr->desc_a.start_addr = (unsigned long )new_skb->data -2 ; +/* Invidate the data cache of skb->data range when it is write back +* cache. It will prevent overwritting the new data from DMA +*/ +blackfin_dcache_invalidate_range ((unsigned long )new_skb->head, + (unsigned long )new_skb->end); + len = (unsigned short )((current_rx_ptr->status.status_word) &RX_FRLEN );skb_put (skb, len); blackfin_dcache_invalidate_range((unsigned long)skb->head,
Signature · 1 line
1.5.3.4
PATCH 8/8 EMAC driver: Fix bug: The clock divisor is set to all ones at reset.
In reply to Bryan Wu--- drivers/net/bfin_mac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/bfin_mac.c +1 -1
@@ -408,7 +408,7 @@ static int mii_probe(struct net_device *dev) mdc_div = ((sclk /MDC_CLK ) /2 ) -1 ; sysctl =bfin_read_EMAC_SYSCTL (); - sysctl |=SET_MDCDIV (mdc_div); + sysctl = (sysctl & ~MDCDIV ) |SET_MDCDIV (mdc_div);bfin_write_EMAC_SYSCTL (sysctl);/* search for connect PHY device */
Signature · 1 line
1.5.3.4