[U-Boot] [PATCH 05/10] AVR32: macb - Disable 100mbps if clock is slow
Olav Morken
olavmrk at gmail.com
Fri Oct 10 15:15:47 CEST 2008
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 <gunnar at rangoy.com>
Signed-off-by: Paul Driveklepp <pauldriveklepp at gmail.com>
Signed-off-by: Olav Morken <olavmrk at gmail.com>
---
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
More information about the U-Boot
mailing list