Index: drivers/net/gianfar_phy.c =================================================================== RCS file: /cvsroot/linuxppc/linuxppc-2.4/drivers/net/gianfar_phy.c,v retrieving revision 1.3.4.3 diff -u -r1.3.4.3 gianfar_phy.c --- drivers/net/gianfar_phy.c 2004/05/24 17:42:02 1.3.4.3 +++ drivers/net/gianfar_phy.c 2004/06/29 21:32:09 @@ -42,6 +42,8 @@ #include "gianfar.h" #include "gianfar_phy.h" +static void get_phy_bus(struct gfar *phyregs); + /* Write value to the PHY for this device to the register at regnum, */ /* waiting until the write is done before it returns. All PHY */ /* configuration has to be done through the TSEC1 MIIM regs */ @@ -430,6 +432,10 @@ u32 phy_ID; int i; struct phy_info *theInfo = NULL; + struct gfar_private *priv = (struct gfar_private *)dev->priv; + struct gfar *phyregs = priv->phyregs; + + get_phy_bus(phyregs); /* Grab the bits from PHYIR1, and put them in the upper half */ phy_reg = read_phy_reg(dev, MIIM_PHYIR1); @@ -456,6 +462,19 @@ return theInfo; } +static void get_phy_bus(struct gfar *phyregs) +{ + /* Reset the management interface */ + gfar_write(&phyregs->miimcfg, MIIMCFG_RESET); + + /* Setup the MII Mgmt clock speed */ + gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE); + + /* Wait until the bus is free */ + while (gfar_read(&phyregs->miimind) & MIIMIND_BUSY) + cpu_relax(); +} + /* Take a list of struct phy_cmd, and, depending on the values, either */ /* read or write, using a helper function if provided */ /* It is assumed that all lists of struct phy_cmd will be terminated by */ @@ -466,16 +485,8 @@ u16 result; struct gfar_private *priv = (struct gfar_private *) dev->priv; struct gfar *phyregs = priv->phyregs; - - /* Reset the management interface */ - gfar_write(&phyregs->miimcfg, MIIMCFG_RESET); - /* Setup the MII Mgmt clock speed */ - gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE); - - /* Wait until the bus is free */ - while (gfar_read(&phyregs->miimind) & MIIMIND_BUSY) - cpu_relax(); + get_phy_bus(phyregs); for (i = 0; cmd->mii_reg != miim_end; i++) { /* The command is a read if mii_data is miim_read */