1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Index: u-boot-2010.06/drivers/net/macb.c
===================================================================
--- u-boot-2010.06.orig/drivers/net/macb.c 2013-01-04 16:57:21.460051123 -0600
+++ u-boot-2010.06/drivers/net/macb.c 2013-01-04 17:03:28.880052058 -0600
@@ -57,7 +57,7 @@
#define CONFIG_SYS_MACB_RX_RING_SIZE (CONFIG_SYS_MACB_RX_BUFFER_SIZE / 128)
#define CONFIG_SYS_MACB_TX_RING_SIZE 16
#define CONFIG_SYS_MACB_TX_TIMEOUT 1000
-#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 5000000
+#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 3000000
struct macb_dma_desc {
u32 addr;
@@ -322,11 +322,12 @@
return 0;
}
-static void macb_phy_reset(struct macb_device *macb)
+static u16 macb_phy_reset(struct macb_device *macb)
{
struct eth_device *netdev = &macb->netdev;
int i;
- u16 status, adv;
+ u16 status = 0;
+ u16 adv;
adv = ADVERTISE_CSMA | ADVERTISE_ALL;
macb_mdio_write(macb, MII_ADVERTISE, adv);
@@ -346,6 +347,8 @@
else
printf("%s: Autonegotiation timed out (status=0x%04x)\n",
netdev->name, status);
+
+ return status;
}
#ifdef CONFIG_MACB_SEARCH_PHY
@@ -397,14 +400,7 @@
status = macb_mdio_read(macb, MII_BMSR);
if (!(status & BMSR_LSTATUS)) {
/* Try to re-negotiate if we don't have link already. */
- macb_phy_reset(macb);
-
- for (i = 0; i < CONFIG_SYS_MACB_AUTONEG_TIMEOUT / 100; i++) {
- status = macb_mdio_read(macb, MII_BMSR);
- if (status & BMSR_LSTATUS)
- break;
- udelay(100);
- }
+ status = macb_phy_reset(macb);
}
if (!(status & BMSR_LSTATUS)) {
|