Skip to contentSkip to conversation

brcmfmac: Reset PCIE devices after recognition.

PATCH Applied Arend van Spriel 3 participants 3 messages Aug 27, 2015 – Sep 29, 2015 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: Reset PCIE devices after recognition.

From: Hante Meuleman <[email protected]>

When PCIE type devices are being FW reloaded without being properly reset then the device ends up in a locked state, requiring the device to be completely powered down. This patch adds a reset through watchdog at the moment the device (cores) has been recognized. This will solve warm reboot issues.

---
Hi Kalle,

One more patch (probably for 4.4) which has been tested by Rafal. The post is mainly to make the patch publicly available for him to use in OpenWrt.

Regards,
Arend

---
 drivers/net/wireless/brcm80211/brcmfmac/chip.c | 18 +++++++
 drivers/net/wireless/brcm80211/brcmfmac/chip.h |  1 +
 drivers/net/wireless/brcm80211/brcmfmac/pcie.c | 66 ++++++++++++++++++--------
 3 files changed, 64 insertions(+), 21 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/chip.c +18 -0
index 288f831..e3b8e23 100644
@@ -101,6 +101,9 @@
 /* ARM Cortex M3 core, ID 0x82a */
 #define BCM4329_CORE_ARM_BASE		0x18002000
 
+/* Max possibly supported memory size (limited by IO mapped memory) */
+#define BRCMF_CHIP_MAX_MEMSIZE		(4 * 1024 * 1024)
+
 #define CORE_SB(base, field) \
 		(base + SBCONFIGOFF + offsetof(struct sbconfig, field))
 #define	SBCOREREV(sbidh) \
@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
 		brcmf_err("RAM size is undetermined\n");
 		return -ENOMEM;
 	}
+
+	if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
+		brcmf_err("RAM size is incorrect\n");
+		return -ENOMEM;
+	}
+
 	return 0;
 }
 
@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)
 
 	/* assure chip is passive for core access */
 	brcmf_chip_set_passive(&ci->pub);
+
+	/* Call bus specific reset function now. Cores have been determined
+	 * but further access may require a chip specific reset at this point.
+	 */
+	if (ci->ops->reset) {
+		ci->ops->reset(ci->ctx, &ci->pub);
+		brcmf_chip_set_passive(&ci->pub);
+	}
+
 	return brcmf_chip_get_raminfo(ci);
 }
 
drivers/net/wireless/brcm80211/brcmfmac/chip.h +1 -0
index 60dcb38..f6b5fee 100644
@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
 	u32 (*read32)(void *ctx, u32 addr);
 	void (*write32)(void *ctx, u32 addr, u32 value);
 	int (*prepare)(void *ctx);
+	int (*reset)(void *ctx, struct brcmf_chip *chip);
 	int (*setup)(void *ctx, struct brcmf_chip *chip);
 	void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
 };
drivers/net/wireless/brcm80211/brcmfmac/pcie.c +45 -21

116 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 14 lines · Arend van Spriel

From: Hante Meuleman <[email protected]>

When PCIE type devices are being FW reloaded without being properly reset then the device ends up in a locked state, requiring the device to be completely powered down. This patch adds a reset through watchdog at the moment the device (cores) has been recognized. This will solve warm reboot issues.

Quoted 6 lines

---
Hi Kalle,

One more patch (probably for 4.4) which has been tested by Rafal. The post is mainly to make the patch publicly available for him to use in OpenWrt.

Thank you, I appreciate that!

Applied
#2 lore raw
In reply to Arend van Spriel
Quoted 9 lines

From: Hante Meuleman <[email protected]>

When PCIE type devices are being FW reloaded without being properly reset then the device ends up in a locked state, requiring the device to be completely powered down. This patch adds a reset through watchdog at the moment the device (cores) has been recognized. This will solve warm reboot issues.

Quoted 6 lines

Thanks, applied to wireless-drivers-next.git.

Kalle Valo