smc911x: Fix external phy detect routine
Subsystems (2)
PATCH 8/12 smc911x: Fix external phy detect routine
9115-an1212.pdf, page 23 -> http://www.smsc.com/main/anpdf/an1212.pdf
"The existence of external PHYs is determined by reading
the same two PHY registers at PHY addresses 0x02 through 0x30. If values of 0xFFFF and 0xFFFF are obtained, there is no PHY at the given PHY address".
And according to the datasheet, waiting is needed when disabling clocks.
drivers/net/smc911x.c +5 -8
@@ -725,7 +724,7 @@ {unsigned long ioaddr = dev->base_addr; -DBG (SMC_DEBUG_MISC ,"%s: phyaddr=0x%x, phyreg=0x%x, phydata=0x%x\n" , +DBG (SMC_DEBUG_MISC ,"%s: phyaddr=0x%x, phyreg=0x%02x, phydata=0x%04x\n" , __FUNCTION__, phyaddr, phyreg, phydata);SMC_SET_MII (phyreg, phyaddr, phydata);
@@ -748,7 +747,7 @@/* * Scan all 32 PHY addresses if necessary, starting at -* PHY#1 to PHY#31, and then PHY#0 last. +* PHY#2 to PHY#30, and then PHY#0 last. */ switch (lp->version) {case 0x115 :
@@ -762,7 +761,6 @@ cfg |=HW_CFG_EXT_PHY_EN_ ;SMC_SET_HW_CFG (cfg); -udelay (10 );/* Wait for clocks to stop */ cfg &= ~HW_CFG_PHY_CLK_SEL_ ; cfg |=HW_CFG_PHY_CLK_SEL_EXT_PHY_ ;
@@ -772,16 +770,14 @@ cfg |=HW_CFG_SMI_SEL_ ;SMC_SET_HW_CFG (cfg); -for (phyaddr =1 ; phyaddr <32 ; ++phyaddr) { +for (phyaddr =2 ; phyaddr <30 ; ++phyaddr) {/* Read the PHY identifiers */ SMC_GET_PHY_ID1 (phyaddr &31 , id1);SMC_GET_PHY_ID2 (phyaddr &31 , id2);/* Make sure it is a valid identifier */ -if (id1 !=0x0000 && id1 !=0xffff && - id1 !=0x8000 && id2 !=0x0000 && - id2 !=0xffff && id2 !=0x8000 ) { +if (id1 !=0xffff && id2 !=0xffff ) {/* Save the PHY's address */ lp->mii.phy_id = phyaddr &31 ; lp->phy_type = id1 <<16 | id2;
@@ -798,7 +794,7 @@ lp->phy_type = id1 <<16 | id2; } -DBG (SMC_DEBUG_MISC ,"%s: phy_id1=0x%x, phy_id2=0x%x phyaddr=0x%d\n" , +DBG (SMC_DEBUG_MISC ,"%s: phy_id1=0x%x, phy_id2=0x%x phyaddr=%d\n" , dev->name, id1, id2, lp->mii.phy_id); }
[email protected] <[email protected]> :
Quoted 6 lines
9115-an1212.pdf, page 23 -> http://www.smsc.com/main/anpdf/an1212.pdf
"The existence of external PHYs is determined by reading
the same two PHY registers at PHY addresses0x02through0x30. If values of
[...]
drivers/net/smc911x.c line 773
Quoted 2 lines
drivers/net/smc911x.c +1
-1-for (phyaddr =1 ; phyaddr <32 ; ++phyaddr) { +for (phyaddr =2 ; phyaddr <30 ; ++phyaddr) {
Is 30 inclusive or not ?
Signature · 1 line
Ueimor
Quoted 5 lines · Francois Romieu
[email protected] <[email protected]> :
Quoted 4 lines
9115-an1212.pdf, page 23 -> http://www.smsc.com/main/anpdf/an1212.pdf
Quoted 7 lines
Quoted 2 lines
"The existence of external PHYs is determined by reading
the same two PHY registers at PHY addresses0x02through0x30. If values of[...]
drivers/net/smc911x.c line 773
Quoted 2 lines
drivers/net/smc911x.c +1
-1-for (phyaddr =1 ; phyaddr <32 ; ++phyaddr) { +for (phyaddr =2 ; phyaddr <30 ; ++phyaddr) {Is 30 inclusive or not ?
You are right, inclusive...
--
Bora SAHIN