From 7393ce8d87d2a06deb231dc1e0ddb46330f9897b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 9 Sep 2019 09:37:53 +0200 Subject: mac80211: brcmfmac: backport more kernel 5.4 changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch getting RAM info got upstreamed. A debugging fs entry for testing reset feature was added. Signed-off-by: Rafał Miłecki (cherry picked from commit 681acdcc54d2e59135bb706c38bed942f74ccf74) --- ...t-chip-s-default-RAM-info-during-PCIe-set.patch | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 package/kernel/mac80211/patches/474-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch (limited to 'package/kernel/mac80211/patches/474-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch') diff --git a/package/kernel/mac80211/patches/474-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch b/package/kernel/mac80211/patches/474-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch new file mode 100644 index 0000000000..4dc7d9fe12 --- /dev/null +++ b/package/kernel/mac80211/patches/474-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch @@ -0,0 +1,80 @@ +From 82f93cf46d6007ffa003b2d4a2834563b6b84d21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 29 Aug 2019 10:27:01 +0200 +Subject: [PATCH] brcmfmac: get chip's default RAM info during PCIe setup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Getting RAM info just once per driver's lifetime (during chip +recognition) is not enough as it may get adjusted later (depending on +the used firmware). Subsequent inits may load different firmwares so a +full RAM recognition is required on every PCIe setup. This is especially +important since implementing hardware reset on a firmware crash. + +Moreover calling brcmf_chip_get_raminfo() makes sure that RAM core is +up. It's important as having BCMA_CORE_SYS_MEM down on BCM4366 was +resulting in firmware failing to initialize and following error: +[ 65.657546] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: Invalid shared RAM address 0x04000001 + +This change makes brcmf_chip_get_raminfo() call during chip recognition +redundant for PCIe devices but SDIO and USB still need it and it's a +very small overhead anyway. + +Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash") +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 ++++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++++ + 3 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -700,8 +700,10 @@ static u32 brcmf_chip_tcm_rambase(struct + return 0; + } + +-static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) ++int brcmf_chip_get_raminfo(struct brcmf_chip *pub) + { ++ struct brcmf_chip_priv *ci = container_of(pub, struct brcmf_chip_priv, ++ pub); + struct brcmf_core_priv *mem_core; + struct brcmf_core *mem; + +@@ -981,7 +983,7 @@ static int brcmf_chip_recognition(struct + brcmf_chip_set_passive(&ci->pub); + } + +- return brcmf_chip_get_raminfo(ci); ++ return brcmf_chip_get_raminfo(&ci->pub); + } + + static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +@@ -80,6 +80,7 @@ struct brcmf_buscore_ops { + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec); + }; + ++int brcmf_chip_get_raminfo(struct brcmf_chip *pub); + struct brcmf_chip *brcmf_chip_attach(void *ctx, + const struct brcmf_buscore_ops *ops); + void brcmf_chip_detach(struct brcmf_chip *chip); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1780,6 +1780,12 @@ static void brcmf_pcie_setup(struct devi + nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len; + kfree(fwreq); + ++ ret = brcmf_chip_get_raminfo(devinfo->ci); ++ if (ret) { ++ brcmf_err(bus, "Failed to get RAM info\n"); ++ goto fail; ++ } ++ + /* Some of the firmwares have the size of the memory of the device + * defined inside the firmware. This is because part of the memory in + * the device is shared and the devision is determined by FW. Parse -- cgit v1.2.3