Skip to contentSkip to conversation

mxc_fec: fix some erroneous PHY accesses.

PATCH New javier Martin 3 participants 5 messages Oct 19, 2009 – Oct 25, 2009 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mxc_fec: fix some erroneous PHY accesses.

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-2.0 toolchains.

--

drivers/net/fec_mxc.c +3 -3
index bd83a24..18f0bba 100644
@@ -157,7 +157,7 @@ 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, 0x1e1);
 	miiphy_write(dev->name, CONFIG_FEC_MXC_PHYADDR, PHY_BMCR,
 			PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
 
@@ -341,8 +341,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
Signature · 7 lines
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#1 lore raw

PATCH 1/2 mxc_fec: fix some erroneous PHY accesses.

Who can ack this patch? Is Fred Fan or Tom Rix?

Thank you.

Signature · 7 lines
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
#2 lore raw

PATCH 1/2 mxc_fec: fix some erroneous PHY accesses.

Quoted 3 lines · javier Martin

Who can ack this patch?
Is Fred Fan or Tom Rix?

This looked like a network patch, so it would go to Ben. Tom

Quoted 1 line

Thank you.

#3 lore raw

PATCH 1/2 mxc_fec: fix some erroneous PHY accesses.

Quoted 9 lines · Tom
Quoted 4 lines · javier Martin

Who can ack this patch?
Is Fred Fan or Tom Rix?

This looked like a network patch, so it would go to Ben.

Tom

Yeah, this is in my jurisdiction. I'll take care of it this weekend.

regards,
Ben

#4 lore raw

PATCH 1/2 mxc_fec: fix some erroneous PHY accesses.

In reply to javier Martin

Javier,

Quoted 17 lines · javier Martin

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-2.0 toolchains.

--

drivers/net/fec_mxc.c +0 -0
index bd83a24..18f0bba 100644

drivers/net/fec_mxc.c static int miiphy_restart_aneg(struct eth_device *dev) · line 161

Quoted 6 lines
drivers/net/fec_mxc.c +1 -1
@@ -157,7 +157,7 @@ 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, 0x1e1);
 

There are perfectly good #defines for each of these bits (miiphy.h or, even better, linux/mii.h). Please use them to avoid this confusion.

Quoted 15 lines
drivers/net/fec_mxc.c +2 -2
       miiphy_write(dev->name, CONFIG_FEC_MXC_PHYADDR, PHY_BMCR,
                       PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
@@ -341,8 +341,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
Quoted 1 line

regards,

Ben