Re: problem with sis900

From: Daniele Venzano
Date: Sat May 15 2004 - 02:16:59 EST


On Thu, May 13, 2004 at 08:02:56PM +0200, Dominik Karall wrote:
> Sorry, but the patch does not help, same error messages in log, and can't
> change to full-duplex mode.
My fault, the linked list gets filled in reverse, address 1 is at the
end.

With the attached patch I should got it right...

--
-----------------------------
Daniele Venzano
Web: http://teg.homeunix.org

--- linux-2.6.5/drivers/net/sis900.c 2004-04-04 22:31:55.000000000 +0200
+++ linux-irda-2.6.5/drivers/net/sis900.c 2004-05-15 09:10:42.000000000 +0200
@@ -640,13 +640,16 @@
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_one = NULL;
u16 status;

for( phy=sis_priv->first_mii; phy; phy=phy->next ){
status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);
status = mdio_read(net_dev, phy->phy_addr, MII_STATUS);

+ if(phy->phy_addr == 1)
+ phy_one = phy;
+
/* Link ON & Not select deafalut PHY */
if ( (status & MII_STAT_LINK) && !(default_phy) )
default_phy = phy;
@@ -665,6 +668,10 @@
default_phy = sis_priv->first_mii;

if( sis_priv->mii != default_phy ){
+ if(phy_one)
+ default_phy = phy_one;
+ else
+ printk(KERN_WARNING "Detected PHY not present in linked list!!\n");
sis_priv->mii = default_phy;
sis_priv->cur_phy = default_phy->phy_addr;
printk(KERN_INFO "%s: Using transceiver found at address %d as default\n", net_dev->name,sis_priv->cur_phy);