summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/macb.patch
blob: 5869628049b04c16ba8f08d4d71dd3712456dae3 (plain)
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
54
diff -raNu old/drivers/net/macb.c new/drivers/net/macb.c
--- old/drivers/net/macb.c	2017-05-11 16:08:48.747255895 -0500
+++ new/drivers/net/macb.c	2017-05-12 09:55:17.331129433 -0500
@@ -49,7 +49,7 @@
 #define MACB_RX_RING_SIZE		(MACB_RX_BUFFER_SIZE / 128)
 #define MACB_TX_RING_SIZE		16
 #define MACB_TX_TIMEOUT		1000
-#define MACB_AUTONEG_TIMEOUT	5000000
+#define MACB_AUTONEG_TIMEOUT	3000000
 
 struct macb_dma_desc {
 	u32	addr;
@@ -419,7 +419,8 @@
 static void macb_phy_reset(struct macb_device *macb, const char *name)
 {
 	int i;
-	u16 status, adv;
+	u16 status = 0;
+	u16 adv;
 
 	adv = ADVERTISE_CSMA | ADVERTISE_ALL;
 	macb_mdio_write(macb, MII_ADVERTISE, adv);
@@ -439,6 +440,7 @@
 	else
 		printf("%s: Autonegotiation timed out (status=0x%04x)\n",
 		       name, status);
+
 }
 
 #ifdef CONFIG_MACB_SEARCH_PHY
@@ -479,7 +481,6 @@
 	u32 ncfgr;
 	u16 phy_id, status, adv, lpa;
 	int media, speed, duplex;
-	int i;
 
 	arch_get_mdio_control(name);
 #ifdef CONFIG_MACB_SEARCH_PHY
@@ -515,14 +516,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, name);
-
-		for (i = 0; i < MACB_AUTONEG_TIMEOUT / 100; i++) {
-			status = macb_mdio_read(macb, MII_BMSR);
-			if (status & BMSR_LSTATUS)
-				break;
-			udelay(100);
-		}
+		macb_phy_reset(macb,name);
 	}
 
 	if (!(status & BMSR_LSTATUS)) {