mxc_fec: fix some erroneous PHY accesses.
authorjavier Martin <javier.martin@vista-silicon.com>
Thu, 29 Oct 2009 07:18:34 +0000 (08:18 +0100)
committerBen Warren <biggerbadderben@gmail.com>
Wed, 11 Nov 2009 21:27:09 +0000 (13:27 -0800)
This patch fixes erroneous access to the ethernet PHY which broke the driver.
1. Selector field in the auto-negotiation register must be 0x00001 for
using 802.3, not 0x00000 which is reseved.
2. Access to the PHY address specified by CONFIG_FEC_MXC_PHYADDR, not
0x0 fixed address.

This has been tested in i.MX27 Litekit board and eldk-4.2 toolchains.

Now using proper defines for auto-negotiation register.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
drivers/net/fec_mxc.c

index bd83a24..9764e12 100644 (file)
@@ -157,7 +157,9 @@ static int miiphy_restart_aneg(struct eth_device *dev)
        /*
         * Set the auto-negotiation advertisement register bits
         */
-       miiphy_write(dev->name, CONFIG_FEC_MXC_PHYADDR, PHY_ANAR, 0x1e0);
+       miiphy_write(dev->name, CONFIG_FEC_MXC_PHYADDR, PHY_ANAR,
+                       PHY_ANLPAR_TXFD | PHY_ANLPAR_TX | PHY_ANLPAR_10FD |
+                       PHY_ANLPAR_10 | PHY_ANLPAR_PSB_802_3);
        miiphy_write(dev->name, CONFIG_FEC_MXC_PHYADDR, PHY_BMCR,
                        PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
 
@@ -341,8 +343,8 @@ static int fec_open(struct eth_device *edev)
        writel(FEC_ECNTRL_ETHER_EN, &fec->eth->ecntrl);
 
        miiphy_wait_aneg(edev);
-       miiphy_speed(edev->name, 0);
-       miiphy_duplex(edev->name, 0);
+       miiphy_speed(edev->name, CONFIG_FEC_MXC_PHYADDR);
+       miiphy_duplex(edev->name, CONFIG_FEC_MXC_PHYADDR);
 
        /*
         * Enable SmartDMA receive task