From: Rafał Miłecki Date: Mon, 9 Sep 2019 07:37:53 +0000 (+0200) Subject: mac80211: brcmfmac: backport more kernel 5.4 changes X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=7393ce8d87d2a06deb231dc1e0ddb46330f9897b;p=openwrt%2Fstaging%2F981213.git mac80211: brcmfmac: backport more kernel 5.4 changes 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) --- diff --git a/package/kernel/mac80211/patches/471-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch b/package/kernel/mac80211/patches/471-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch new file mode 100644 index 0000000000..ab5d820a87 --- /dev/null +++ b/package/kernel/mac80211/patches/471-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch @@ -0,0 +1,54 @@ +From cddecd92d1ec2fd05ed1123455e7c6cf6906b5a5 Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Wed, 24 Jul 2019 22:12:01 +0800 +Subject: [PATCH] brcmfmac: remove set but not used variable 'dtim_period' + +Fixes gcc '-Wunused-but-set-variable' warning: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2962:5: warning: variable dtim_period set but not used [-Wunused-but-set-variable] +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2961:6: warning: variable beacon_interval set but not used [-Wunused-but-set-variable] + +They are never used so can be removed. + +Reported-by: Hulk Robot +Signed-off-by: YueHaibing +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2985,8 +2985,6 @@ static s32 brcmf_update_bss_info(struct + struct brcmf_pub *drvr = cfg->pub; + struct brcmf_bss_info_le *bi; + const struct brcmf_tlv *tim; +- u16 beacon_interval; +- u8 dtim_period; + size_t ie_len; + u8 *ie; + s32 err = 0; +@@ -3010,12 +3008,9 @@ static s32 brcmf_update_bss_info(struct + + ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); + ie_len = le32_to_cpu(bi->ie_length); +- beacon_interval = le16_to_cpu(bi->beacon_period); + + tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM); +- if (tim) +- dtim_period = tim->data[1]; +- else { ++ if (!tim) { + /* + * active scan was done so we could not get dtim + * information out of probe response. +@@ -3027,7 +3022,6 @@ static s32 brcmf_update_bss_info(struct + bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err); + goto update_bss_info_out; + } +- dtim_period = (u8)var; + } + + update_bss_info_out: diff --git a/package/kernel/mac80211/patches/472-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch b/package/kernel/mac80211/patches/472-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch new file mode 100644 index 0000000000..1de2e748ca --- /dev/null +++ b/package/kernel/mac80211/patches/472-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch @@ -0,0 +1,26 @@ +From 73c742bb9c9ba30871fdd5c730d5ca8b6712833a Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 9 Aug 2019 18:22:17 +0100 +Subject: [PATCH] brcmfmac: remove redundant assignment to pointer hash + +The pointer hash is being initialized with a value that is never read +and is being re-assigned a little later on. The assignment is +redundant and hence can be removed. + +Addresses-Coverity: ("Unused value") +Signed-off-by: Colin Ian King +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -1478,7 +1478,6 @@ static int brcmf_msgbuf_stats_read(struc + seq_printf(seq, "\nh2d_flowrings: depth %u\n", + BRCMF_H2D_TXFLOWRING_MAX_ITEM); + seq_puts(seq, "Active flowrings:\n"); +- hash = msgbuf->flow->hash; + for (i = 0; i < msgbuf->flow->nrofrings; i++) { + if (!msgbuf->flow->rings[i]) + continue; diff --git a/package/kernel/mac80211/patches/473-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch b/package/kernel/mac80211/patches/473-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch new file mode 100644 index 0000000000..5c9f3f687b --- /dev/null +++ b/package/kernel/mac80211/patches/473-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch @@ -0,0 +1,36 @@ +From 5f42b382ead278c1f6c3854765c97eb20491aa2a Mon Sep 17 00:00:00 2001 +From: Xulin Sun +Date: Fri, 23 Aug 2019 15:47:08 +0800 +Subject: [PATCH] brcmfmac: replace strncpy() by strscpy() + +The strncpy() may truncate the copied string, +replace it by the safer strscpy(). + +To avoid below compile warning with gcc 8.2: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:In function 'brcmf_vndr_ie': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:4227:2: +warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] + strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Xulin Sun +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -4246,9 +4246,7 @@ next: + static u32 + brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) + { +- +- strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); +- iebuf[VNDR_IE_CMD_LEN - 1] = '\0'; ++ strscpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN); + + put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]); + 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 diff --git a/package/kernel/mac80211/patches/475-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch b/package/kernel/mac80211/patches/475-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch new file mode 100644 index 0000000000..1967743591 --- /dev/null +++ b/package/kernel/mac80211/patches/475-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch @@ -0,0 +1,31 @@ +From cb34212b1c25f7656a315f956d72696777e88340 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 1 Sep 2019 13:34:35 +0200 +Subject: [PATCH] brcmfmac: add stub version of brcmf_debugfs_get_devdir() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In case of compiling driver without DEBUG expose a stub function to make +writing debug code much simpler (no extra conditions). This will allow +e.g. using debugfs_create_file() without any magic if or #ifdef. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -132,6 +132,10 @@ int brcmf_debugfs_add_entry(struct brcmf + int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len); + #else ++static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) ++{ ++ return ERR_PTR(-ENOENT); ++} + static inline + int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, + int (*read_fn)(struct seq_file *seq, void *data)) diff --git a/package/kernel/mac80211/patches/475-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch b/package/kernel/mac80211/patches/475-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch new file mode 100644 index 0000000000..30df6766fa --- /dev/null +++ b/package/kernel/mac80211/patches/475-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch @@ -0,0 +1,59 @@ +From 2f8c8e62cd50d72ac68de884a09c6f5a969a269c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 1 Sep 2019 13:34:36 +0200 +Subject: [PATCH] brcmfmac: add "reset" debugfs entry for testing reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a trivial debugfs entry for triggering reset just like in case +of firmware crash. It works by writing 1 to it: +echo 1 > reset + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/core.c | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1117,6 +1117,29 @@ static void brcmf_core_bus_reset(struct + brcmf_bus_reset(drvr->bus_if); + } + ++static ssize_t bus_reset_write(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct brcmf_pub *drvr = file->private_data; ++ u8 value; ++ ++ if (kstrtou8_from_user(user_buf, count, 0, &value)) ++ return -EINVAL; ++ ++ if (value != 1) ++ return -EINVAL; ++ ++ schedule_work(&drvr->bus_reset); ++ ++ return count; ++} ++ ++static const struct file_operations bus_reset_fops = { ++ .open = simple_open, ++ .llseek = no_llseek, ++ .write = bus_reset_write, ++}; ++ + static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) + { + int ret = -1; +@@ -1192,6 +1215,8 @@ static int brcmf_bus_started(struct brcm + + /* populate debugfs */ + brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); ++ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr, ++ &bus_reset_fops); + brcmf_feat_debugfs_create(drvr); + brcmf_proto_debugfs_create(drvr); + diff --git a/package/kernel/mac80211/patches/476-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch b/package/kernel/mac80211/patches/476-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch new file mode 100644 index 0000000000..1ff781198c --- /dev/null +++ b/package/kernel/mac80211/patches/476-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch @@ -0,0 +1,58 @@ +From 0e48b86d9a8f5c695bb02c9c02f6dc7d2ec8f2e2 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Wed, 4 Sep 2019 20:50:52 +0300 +Subject: [PATCH] brcmfmac: use %*ph to print small buffer + +Use %*ph format to print small buffer as hex string. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -4224,10 +4224,8 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_b + + vndr_ies->count++; + +- brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n", +- parsed_info->vndrie.oui[0], +- parsed_info->vndrie.oui[1], +- parsed_info->vndrie.oui[2], ++ brcmf_dbg(TRACE, "** OUI %3ph, type 0x%02x\n", ++ parsed_info->vndrie.oui, + parsed_info->vndrie.oui_type); + + if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) +@@ -4351,12 +4349,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + for (i = 0; i < old_vndr_ies.count; i++) { + vndrie_info = &old_vndr_ies.ie_info[i]; + +- brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", ++ brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%3ph\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, +- vndrie_info->vndrie.oui[0], +- vndrie_info->vndrie.oui[1], +- vndrie_info->vndrie.oui[2]); ++ vndrie_info->vndrie.oui); + + del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, + vndrie_info->ie_ptr, +@@ -4388,12 +4384,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + remained_buf_len -= (vndrie_info->ie_len + + VNDR_IE_VSIE_OFFSET); + +- brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", ++ brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%3ph\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, +- vndrie_info->vndrie.oui[0], +- vndrie_info->vndrie.oui[1], +- vndrie_info->vndrie.oui[2]); ++ vndrie_info->vndrie.oui); + + del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, + vndrie_info->ie_ptr, diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch index e7385513db..c26468af0f 100644 --- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1434,6 +1434,7 @@ int __init brcmf_core_init(void) +@@ -1459,6 +1459,7 @@ int __init brcmf_core_init(void) { if (!schedule_work(&brcmf_driver_work)) return -EBUSY; diff --git a/package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch b/package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch deleted file mode 100644 index c7b25714fb..0000000000 --- a/package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Subject: [PATCH] brcmfmac: get RAM info right before downloading PCIe firmware -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It's important as brcmf_chip_get_raminfo() also makes sure that memory -is properly setup. Without it the firmware could report invalid RAM -address like 0x04000001. - -During a normal brcmfmac lifetime brcmf_chip_get_raminfo() is called on -probe by the brcmf_chip_recognition(). This change allows implementing -further improvements like handling errors by resetting a device with -the brcmf_pcie_reset_device() and redownloading a firmware afterwards. - -Signed-off-by: Rafał Miłecki ---- - 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