From 5951d03bc4e55cc541795c60c10ee6be6eec4f23 Mon Sep 17 00:00:00 2001 From: nbd Date: Mon, 29 Sep 2008 01:08:17 +0000 Subject: port generic and ixp4xx kernel patches to 2.6.27 (compiles except for iptables, but otherwise completely untested) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12790 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../203-npe_driver_phy_reset_autoneg.patch | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 target/linux/ixp4xx/patches-2.6.27/203-npe_driver_phy_reset_autoneg.patch (limited to 'target/linux/ixp4xx/patches-2.6.27/203-npe_driver_phy_reset_autoneg.patch') diff --git a/target/linux/ixp4xx/patches-2.6.27/203-npe_driver_phy_reset_autoneg.patch b/target/linux/ixp4xx/patches-2.6.27/203-npe_driver_phy_reset_autoneg.patch new file mode 100644 index 000000000..699763f51 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.27/203-npe_driver_phy_reset_autoneg.patch @@ -0,0 +1,42 @@ +--- a/drivers/net/arm/ixp4xx_eth.c ++++ b/drivers/net/arm/ixp4xx_eth.c +@@ -322,8 +322,12 @@ + 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 @@ + 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) -- cgit v1.2.3