Modify

Opened 8 years ago

Closed 4 years ago

Last modified 4 years ago

#7056 closed defect (fixed)

[PATCH] wl-hdd report wrong link state on brcm47xx

Reported by: b.sander Owned by: acoul
Priority: normal Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: Cc:

Description

Hi,

b44: eth1: Link is up at 10 Mbps, half duplex.
b44: eth1: Flow control is off for TX and off for RX.
b44: eth1: powering down PHY
b44: eth1: powering down PHY
b44: eth1: powering down PHY
mini_fo: using base directory: /
mini_fo: using storage directory: /tmp/root
b44: eth1: powering down PHY
b44: eth1: powering down PHY
device eth1 entered promiscuous mode
b44: eth1: Link is up at 10 Mbps, half duplex.
b44: eth1: Flow control is off for TX and off for RX.

210-b44_phy_fix.patch doesn't works for me.

This patch will fix this:

--- linux-2.6.27.8/drivers/net/b44.c.bak	2008-12-11 10:43:04.000000000 +0100
+++ linux-2.6.27.8/drivers/net/b44.c	2008-12-11 11:05:21.000000000 +0100
@@ -384,7 +384,7 @@
 	__b44_set_flow_ctrl(bp, pause_enab);
 }
 
-#ifdef SSB_DRIVER_MIPS
+#ifdef CONFIG_SSB_DRIVER_MIPS
 extern char *nvram_get(char *name);
 static void b44_wap54g10_workaround(struct b44 *bp)
 {
@@ -2073,6 +2073,37 @@
 	return err;
 }
 
+#ifdef CONFIG_SSB_DRIVER_MIPS
+
+static inline int startswith (const char *source, const char *cmp) { return !strncmp(source,cmp,strlen(cmp)); }
+#define getvar(str) (nvram_get(str) ? : "")
+
+static inline void b44_bcm47xx_workarounds(struct b44 *bp)
+{
+	/*
+	 * workaround for physical wiring in Linksys WRSL54GS
+	 * see https://dev.openwrt.org/ticket/2662 and 3903
+	 * eth1 PHY is probably on BCM5325 switch accessed via eth0
+	 */
+
+	if (simple_strtoul(getvar("boardnum"), NULL, 0) == 42) {
+		bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+	} else {
+		/* WL-HDD */
+		struct ssb_device *sdev = bp->sdev;
+		if (startswith(getvar("hardware_version"), "WL300-")) {
+			if (sdev->bus->sprom.et0phyaddr == 0 &&
+			    sdev->bus->sprom.et1phyaddr == 1)
+				bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+		}
+	}
+	return;
+}
+
+#else
+static inline void b44_bcm47xx_workarounds(struct b44 *bp) { }
+#endif
+
 static int __devinit b44_get_invariants(struct b44 *bp)
 {
 	struct ssb_device *sdev = bp->sdev;
@@ -2094,6 +2127,8 @@
 	 * valid PHY address. */
 	bp->phy_addr &= 0x1F;
 
+	b44_bcm47xx_workarounds(bp);
+
 	memcpy(bp->dev->dev_addr, addr, 6);
 
 	if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){

Regards

Attachments (0)

Change History (10)

comment:1 Changed 8 years ago by thepeople

  • Owner changed from developers to hauke
  • Status changed from new to assigned

comment:2 Changed 8 years ago by acoul

  • Owner changed from hauke to acoul

comment:3 follow-up: Changed 8 years ago by acoul

Hi b.sander, the patch you committed is for a 2.6.27 kernel. Looking at the relative openwrt history of commits to the current kernels (2.6.32, 2.6.33 & 2.6.34) the above code seems to be included in a more generic form with the exeption of this part:

-#ifdef SSB_DRIVER_MIPS
+#ifdef CONFIG_SSB_DRIVER_MIPS

Can you test this on a latest trunk and see if the problem is fixed?

comment:4 in reply to: ↑ 3 Changed 8 years ago by acoul

Replying to acoul:

Looking at the relative openwrt history of commits to the current kernels (2.6.32, 2.6.33 & 2.6.34) the above code seems to be included in a more generic form

the mentioned code was transformed into a more generic on r13098 and r15351

comment:5 Changed 8 years ago by acoul

I made some further tests on 2.6.34-rc4 using a Siemens SE505 v1, Askey RT210W, RT220W device and the following patch resolves the problems (no ping, just arping) on eth1 (wan) port.

--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -384,7 +384,7 @@
 	__b44_set_flow_ctrl(bp, pause_enab);
 }
 
-#ifdef SSB_DRIVER_MIPS
+#ifdef CONFIG_SSB_DRIVER_MIPS
 extern char *nvram_get(char *name);
 static void b44_wap54g10_workaround(struct b44 *bp)
 {
@@ -397,6 +397,7 @@
 	 * see https://dev.openwrt.org/ticket/146
 	 * check and reset bit "isolate"
 	 */
+
 	str = nvram_get("boardnum");
 	if (!str)
 		return;
@@ -421,12 +422,49 @@
 }
 #endif
 
+#ifdef CONFIG_SSB_DRIVER_MIPS
+static inline int startswith (const char *source, const char *cmp) 
+{ 
+	return !strncmp(source,cmp,strlen(cmp)); 
+}
+
+#define getvar(str) (nvram_get(str) ? : "")
+
+static inline void b44_bcm47xx_workarounds(struct b44 *bp)
+{
+	/*
+	 * workaround for physical wiring in Linksys WRSL54GS
+	 * see https://dev.openwrt.org/ticket/2662 and 3903
+	 * eth1 PHY is probably on BCM5325 switch accessed via eth0
+	 */
+
+	if (simple_strtoul(getvar("boardnum"), NULL, 0) == 42) {
+		bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+	} else {
+		/* WL-HDD */
+		struct ssb_device *sdev = bp->sdev;
+		if (startswith(getvar("hardware_version"), "WL300-")) {
+			if (sdev->bus->sprom.et0phyaddr == 0 &&
+			    sdev->bus->sprom.et1phyaddr == 1)
+				bp->phy_addr = B44_PHY_ADDR_NO_PHY;
+		}
+	}
+	return;
+}
+
+#else
+static inline void b44_bcm47xx_workarounds(struct b44 *bp) 
+{ 
+}
+#endif
+
 static int b44_setup_phy(struct b44 *bp)
 {
 	u32 val;
 	int err;
 
 	b44_wap54g10_workaround(bp);
+	b44_bcm47xx_workarounds(bp);
 
 	if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
 		return 0;
@@ -2089,6 +2127,8 @@
 	 * valid PHY address. */
 	bp->phy_addr &= 0x1F;
 
+	b44_bcm47xx_workarounds(bp);
+
 	memcpy(bp->dev->dev_addr, addr, 6);
 
 	if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){

upon boot I get:

b44: b44.c:v2.0
b44 ssb0:2: eth0: Broadcom 44xx/47xx 10/100BaseT Ethernet 00:01:e3:04:5d:aa
b44 ssb0:5: eth1: Broadcom 44xx/47xx 10/100BaseT Ethernet 00:01:e3:04:5d:ab
b44 ssb0:2: eth0: Link is up at 100 Mbps, full duplex
b44 ssb0:2: eth0: Flow control is off for TX and off for RX
b44 ssb0:2: eth0: powering down PHY
b44 ssb0:2: eth0: powering down PHY
b44 ssb0:2: eth0: powering down PHY
b44 ssb0:2: eth0: powering down PHY
b44 ssb0:2: eth0: powering down PHY
b44 ssb0:2: eth0: Link is up at 100 Mbps, full duplex
b44 ssb0:2: eth0: Flow control is off for TX and off for RX

bringing eth1 up works fine when eth1 is plugged on the network:

b44 ssb0:5: eth1: Link is up at 10 Mbps, half duplex
b44 ssb0:5: eth1: Flow control is off for TX and off for RX

When eth1 is not plugged on the network, upon bringing it up I get this:

b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear
b44 ssb0:5: eth1: BUG!  Timeout waiting for bit 80000000 of register 428 to clear

comment:6 Changed 8 years ago by acoul

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in r21042.

comment:7 follow-up: Changed 8 years ago by realopty

  • Resolution fixed deleted
  • Status changed from closed to reopened

im using the latest svn of backfire 10.03. i dont believe this is fixed cause i get this

b44: eth0: powering down PHY

b44: eth0: Link is up at 10 Mbps, half duplex.
b44: eth0: Flow control is off for TX and off fo
r RX.

I cant seem to get the eth0 to be at 100 Mbps.

comment:8 in reply to: ↑ 7 Changed 5 years ago by tmn505

Replying to realopty:

im using the latest svn of backfire 10.03. i dont believe this is fixed cause i get this

b44: eth0: powering down PHY

b44: eth0: Link is up at 10 Mbps, half duplex.
b44: eth0: Flow control is off for TX and off fo
r RX.

I cant seem to get the eth0 to be at 100 Mbps.

The patch mentioned in change set r21042 DOES fix this bug. Just add it to source tree as <openwrt_source_dir>/target/linux/brcm47xx/patches-2.6.32/212-b44_phy_fix.patch and change first two lines as shown below:

--- a/drivers/net/b44.c.orig	2010-04-18 08:40:30.000000000 +0300
+++ b/drivers/net/b44.c	2010-04-18 10:53:47.000000000 +0300

Then compile your own image.

comment:9 Changed 4 years ago by florian

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:10 Changed 4 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.