diff options
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 15c422387028..013525f3c3bd 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -584,6 +584,18 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
584 | struct gfar_mii __iomem *regs = | 584 | struct gfar_mii __iomem *regs = |
585 | (void __iomem *)&priv->regs->gfar_mii_regs; | 585 | (void __iomem *)&priv->regs->gfar_mii_regs; |
586 | int tbipa = gfar_read(&priv->regs->tbipa); | 586 | int tbipa = gfar_read(&priv->regs->tbipa); |
587 | struct mii_bus *bus = gfar_get_miibus(priv); | ||
588 | |||
589 | if (bus) | ||
590 | mutex_lock(&bus->mdio_lock); | ||
591 | |||
592 | /* If the link is already up, we must already be ok, and don't need to | ||
593 | * configure and reset the TBI<->SerDes link. Maybe U-Boot configured | ||
594 | * everything for us? Resetting it takes the link down and requires | ||
595 | * several seconds for it to come back. | ||
596 | */ | ||
597 | if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS) | ||
598 | goto done; | ||
587 | 599 | ||
588 | /* Single clk mode, mii mode off(for serdes communication) */ | 600 | /* Single clk mode, mii mode off(for serdes communication) */ |
589 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); | 601 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); |
@@ -594,6 +606,10 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
594 | 606 | ||
595 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | | 607 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | |
596 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); | 608 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); |
609 | |||
610 | done: | ||
611 | if (bus) | ||
612 | mutex_unlock(&bus->mdio_lock); | ||
597 | } | 613 | } |
598 | 614 | ||
599 | static void init_registers(struct net_device *dev) | 615 | static void init_registers(struct net_device *dev) |