
From: Daniele Venzano <webvenza@libero.it>

Fix PHY transceiver detection code to fall back to known PHY and not to the
last detected.

The code checks every transceiver detected for link status and type, but fails
when ghost transceivers are detected, deciding to use the last one detected.

With this patch the driver should choose the correct transceiver even when
some ghosts are detected by checking for the type of the tranceiver it is
going to use.


---

 25-akpm/drivers/net/sis900.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff -puN drivers/net/sis900.c~sis900-fix-phy-transceiver-detection drivers/net/sis900.c
--- 25/drivers/net/sis900.c~sis900-fix-phy-transceiver-detection	Tue May 18 16:55:03 2004
+++ 25-akpm/drivers/net/sis900.c	Tue May 18 16:55:03 2004
@@ -644,7 +644,7 @@ static int __init sis900_mii_probe (stru
 static u16 sis900_default_phy(struct net_device * net_dev)
 {
 	struct sis900_private * sis_priv = net_dev->priv;
- 	struct mii_phy *phy = NULL, *phy_home = NULL, *default_phy = NULL;
+ 	struct mii_phy *phy = NULL, *phy_home = NULL, *default_phy = NULL, *phy_lan = NULL;
 	u16 status;
 
         for( phy=sis_priv->first_mii; phy; phy=phy->next ){
@@ -660,12 +660,16 @@ static u16 sis900_default_phy(struct net
 				status | MII_CNTL_AUTO | MII_CNTL_ISOLATE);
 			if( phy->phy_types == HOME )
 				phy_home = phy;
+			else if (phy->phy_types == LAN)
+				phy_lan = phy;
 		 }
 	}
 
-	if( (!default_phy) && phy_home )
+	if( !default_phy && phy_home )
 		default_phy = phy_home;
-	else if(!default_phy)
+	else if( !default_phy && phy_lan )
+		default_phy = phy_lan;
+	else if ( !default_phy )
 		default_phy = sis_priv->first_mii;
 
 	if( sis_priv->mii != default_phy ){

_
