diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2008-04-28 18:44:50 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2008-04-28 18:44:50 +0000 |
commit | 2c6b667a805df5199fe075776c932f00b274050d (patch) | |
tree | 11dcdead3dc6615a36c3c21e21148d2f1cd449d3 /target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch | |
parent | e84649e57812596929ff0402a7caf2deb8ad2050 (diff) | |
download | mtk-20170518-2c6b667a805df5199fe075776c932f00b274050d.zip mtk-20170518-2c6b667a805df5199fe075776c932f00b274050d.tar.gz mtk-20170518-2c6b667a805df5199fe075776c932f00b274050d.tar.bz2 |
add switch support to the npe driver
SVN-Revision: 10966
Diffstat (limited to 'target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch')
-rw-r--r-- | target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch b/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch new file mode 100644 index 0000000..6e1056e --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.24/203-npe_driver_phy_reset_autoneg.patch @@ -0,0 +1,44 @@ +Index: linux-2.6.24.2/drivers/net/arm/ixp4xx_eth.c +=================================================================== +--- linux-2.6.24.2.orig/drivers/net/arm/ixp4xx_eth.c ++++ linux-2.6.24.2/drivers/net/arm/ixp4xx_eth.c +@@ -322,8 +322,12 @@ static void phy_reset(struct net_device + struct port *port = netdev_priv(dev); + int phy_id = port->mii[idx].phy_id; + int cycles = 0; ++ u16 bmcr; + +- mdio_write(dev, phy_id, MII_BMCR, port->mii_bmcr[idx] | BMCR_RESET); ++ /* reset the PHY */ ++ bmcr = mdio_read(dev, phy_id, MII_BMCR); ++ bmcr |= BMCR_ANENABLE; ++ mdio_write(dev, phy_id, MII_BMCR, bmcr | BMCR_RESET); + + while (cycles < MAX_MII_RESET_RETRIES) { + if (!(mdio_read(dev, phy_id, MII_BMCR) & BMCR_RESET)) { +@@ -331,13 +335,23 @@ static void phy_reset(struct net_device + printk(KERN_DEBUG "%s: phy_reset() took %i cycles\n", + dev->name, cycles); + #endif +- return; ++ break; + } + udelay(1); + cycles++; + } + +- printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, phy_id); ++ if (cycles == MAX_MII_RESET_RETRIES) { ++ printk(KERN_ERR "%s: MII reset failed on PHY%2d\n", dev->name, ++ phy_id); ++ return; ++ } ++ ++ /* restart auto negotiation */ ++ bmcr = mdio_read(dev, phy_id, MII_BMCR); ++ bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); ++ mdio_write(dev, phy_id, MII_BMCR, bmcr); ++ + } + + static void eth_set_duplex(struct port *port, int full_duplex) |