For 100mbps operation, the ethernet controller requires a 25 MHz clock in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower, disable 100mbps mode.
Signed-off-by: Gunnar Rangoy <[EMAIL PROTECTED]> Signed-off-by: Paul Driveklepp <[EMAIL PROTECTED]> Signed-off-by: Olav Morken <[EMAIL PROTECTED]> --- drivers/net/macb.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 08bebf7..4fef374 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -296,8 +296,29 @@ static void macb_phy_reset(struct macb_device *macb) struct eth_device *netdev = &macb->netdev; int i; u16 status, adv; + int rmii_mode; + unsigned min_hz; + +#ifdef CONFIG_RMII + rmii_mode = 1; + min_hz = 50000000; +#else + rmii_mode = 0; + min_hz = 25000000; +#endif + + adv = ADVERTISE_CSMA | ADVERTISE_ALL ; + + if (get_hsb_clk_rate() < min_hz) { + printf("%s: HSB clock < %u MHz in %s mode - " + "disabling 100mbit.\n", netdev->name, min_hz / 1000000, + (rmii_mode ? "RMII" : "MII")); + + adv &= ~ADVERTISE_100FULL; + adv &= ~ADVERTISE_100HALF; + adv &= ~ADVERTISE_100BASE4; + } - adv = ADVERTISE_CSMA | ADVERTISE_ALL; macb_mdio_write(macb, MII_ADVERTISE, adv); printf("%s: Starting autonegotiation...\n", netdev->name); macb_mdio_write(macb, MII_BMCR, (BMCR_ANENABLE -- 1.6.0.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot