aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/brcm
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-12-10 12:36:44 +0100
committerFelix Fietkau <nbd@nbd.name>2022-12-10 15:15:19 +0100
commit8d90b9fef1ef6b01228c6af73cf06ecbe5d0adaf (patch)
tree180701fce60ea47f7f5270dc03a90546126572b1 /package/kernel/mac80211/patches/brcm
parentb1b29ba98769386f7f88ef66fabc88c79be56b33 (diff)
downloadupstream-8d90b9fef1ef6b01228c6af73cf06ecbe5d0adaf.tar.gz
upstream-8d90b9fef1ef6b01228c6af73cf06ecbe5d0adaf.tar.bz2
upstream-8d90b9fef1ef6b01228c6af73cf06ecbe5d0adaf.zip
mac80211: update to linux 6.1-rc8
This should help stay in sync with upstream development Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/kernel/mac80211/patches/brcm')
-rw-r--r--package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch103
-rw-r--r--package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch14
-rw-r--r--package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch2
-rw-r--r--package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch14
-rw-r--r--package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch2
-rw-r--r--package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch2
-rw-r--r--package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch4
-rw-r--r--package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch23
-rw-r--r--package/kernel/mac80211/patches/brcm/998-survey.patch148
9 files changed, 26 insertions, 286 deletions
diff --git a/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch b/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch
deleted file mode 100644
index e06e350b62..0000000000
--- a/package/kernel/mac80211/patches/brcm/001-v5.19-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 716c220b4d990a4fe7800d0685ca69dee99e4e8f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Pavel=20L=C3=B6bl?= <pavel@loebl.cz>
-Date: Fri, 6 May 2022 06:42:46 +0200
-Subject: [PATCH] brcmfmac: allow setting wlan MAC address using device tree
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This allows firmware to provide MAC address using device tree. Like in
-case there is no MAC burned in wlan NVRAM.
-
-Signed-off-by: Pavel Löbl <pavel@loebl.cz>
-Signed-off-by: Kalle Valo <kvalo@kernel.org>
-Link: https://lore.kernel.org/r/20220506044246.67146-1-pavel@loebl.cz
----
- .../broadcom/brcm80211/brcmfmac/common.c | 23 ++++++++++++++-----
- .../broadcom/brcm80211/brcmfmac/common.h | 1 +
- .../broadcom/brcm80211/brcmfmac/core.c | 4 +++-
- .../wireless/broadcom/brcm80211/brcmfmac/of.c | 3 +++
- 4 files changed, 24 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
-@@ -202,13 +202,24 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
- char *ptr;
- s32 err;
-
-- /* retreive mac address */
-- err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
-- sizeof(ifp->mac_addr));
-- if (err < 0) {
-- bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
-- goto done;
-+ if (is_valid_ether_addr(ifp->mac_addr)) {
-+ /* set mac address */
-+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
-+ ETH_ALEN);
-+ if (err < 0) {
-+ bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err);
-+ goto done;
-+ }
-+ } else {
-+ /* retrieve mac address */
-+ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
-+ sizeof(ifp->mac_addr));
-+ if (err < 0) {
-+ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
-+ goto done;
-+ }
- }
-+
- memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac));
- memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
-@@ -50,6 +50,7 @@ struct brcmf_mp_device {
- bool ignore_probe_fail;
- struct brcmfmac_pd_cc *country_codes;
- const char *board_type;
-+ unsigned char mac[ETH_ALEN];
- union {
- struct brcmfmac_sdio_pd sdio;
- } bus;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -7,6 +7,7 @@
- #include <linux/etherdevice.h>
- #include <linux/module.h>
- #include <linux/inetdevice.h>
-+#include <linux/property.h>
- #include <net/cfg80211.h>
- #include <net/rtnetlink.h>
- #include <net/addrconf.h>
-@@ -1227,7 +1228,8 @@ static int brcmf_bus_started(struct brcm
- brcmf_dbg(TRACE, "\n");
-
- /* add primary networking interface */
-- ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
-+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d",
-+ is_valid_ether_addr(drvr->settings->mac) ? drvr->settings->mac : NULL);
- if (IS_ERR(ifp))
- return PTR_ERR(ifp);
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-@@ -5,6 +5,7 @@
- #include <linux/init.h>
- #include <linux/of.h>
- #include <linux/of_irq.h>
-+#include <linux/of_net.h>
-
- #include <defs.h>
- #include "debug.h"
-@@ -97,6 +98,8 @@ void brcmf_of_probe(struct device *dev,
- if (err)
- brcmf_err("failed to get OF country code map (err=%d)\n", err);
-
-+ of_get_mac_address(np, settings->mac);
-+
- if (bus_type != BRCMF_BUSTYPE_SDIO)
- return;
-
diff --git a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch
index 5dc04ecc88..22b67c49d8 100644
--- a/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch
+++ b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch
@@ -20,7 +20,7 @@
if (phy->type == B43_PHYTYPE_B) {
value16 = b43_read16(dev, 0x005E);
-@@ -3985,7 +3985,6 @@ static int b43_op_config(struct ieee8021
+@@ -3986,7 +3986,6 @@ static int b43_op_config(struct ieee8021
struct b43_wldev *dev = wl->current_dev;
struct b43_phy *phy = &dev->phy;
struct ieee80211_conf *conf = &hw->conf;
@@ -28,7 +28,7 @@
int err = 0;
mutex_lock(&wl->mutex);
-@@ -4028,11 +4027,9 @@ static int b43_op_config(struct ieee8021
+@@ -4029,11 +4028,9 @@ static int b43_op_config(struct ieee8021
}
/* Antennas for RX and management frame TX. */
@@ -42,7 +42,7 @@
if (wl->radio_enabled != phy->radio_on) {
if (wl->radio_enabled) {
-@@ -5175,6 +5172,47 @@ static int b43_op_get_survey(struct ieee
+@@ -5176,6 +5173,47 @@ static int b43_op_get_survey(struct ieee
return 0;
}
@@ -89,8 +89,8 @@
+
static const struct ieee80211_ops b43_hw_ops = {
.tx = b43_op_tx,
- .conf_tx = b43_op_conf_tx,
-@@ -5196,6 +5234,8 @@ static const struct ieee80211_ops b43_hw
+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
+@@ -5198,6 +5236,8 @@ static const struct ieee80211_ops b43_hw
.sw_scan_complete = b43_op_sw_scan_complete_notifier,
.get_survey = b43_op_get_survey,
.rfkill_poll = b43_rfkill_poll,
@@ -99,7 +99,7 @@
};
/* Hard-reset the chip. Do not call this directly.
-@@ -5497,6 +5537,8 @@ static int b43_one_core_attach(struct b4
+@@ -5499,6 +5539,8 @@ static int b43_one_core_attach(struct b4
if (!wldev)
goto out;
@@ -108,7 +108,7 @@
wldev->use_pio = b43_modparam_pio;
wldev->dev = dev;
wldev->wl = wl;
-@@ -5588,6 +5630,9 @@ static struct b43_wl *b43_wireless_init(
+@@ -5590,6 +5632,9 @@ static struct b43_wl *b43_wireless_init(
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
diff --git a/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch b/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch
index a8eae19413..3700eaa1a0 100644
--- a/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch
+++ b/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -114,7 +114,7 @@ static int b43_modparam_pio = 0;
+@@ -114,7 +114,7 @@ static int b43_modparam_pio;
module_param_named(pio, b43_modparam_pio, int, 0644);
MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch
index 7b9512f741..9d0f3e20b1 100644
--- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch
+++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch
@@ -13,15 +13,15 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
-@@ -431,6 +431,7 @@ struct brcmf_fw {
- struct brcmf_fw_request *req;
+@@ -459,6 +459,7 @@ struct brcmf_fw {
u32 curpos;
+ unsigned int board_index;
void (*done)(struct device *dev, int err, struct brcmf_fw_request *req);
+ struct completion *completion;
};
#ifdef CONFIG_EFI
-@@ -655,6 +656,8 @@ static void brcmf_fw_request_done(const
+@@ -686,6 +687,8 @@ static void brcmf_fw_request_done(const
fwctx->req = NULL;
}
fwctx->done(fwctx->dev, ret, fwctx->req);
@@ -30,7 +30,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
kfree(fwctx);
}
-@@ -695,6 +698,8 @@ int brcmf_fw_get_firmwares(struct device
+@@ -751,6 +754,8 @@ int brcmf_fw_get_firmwares(struct device
{
struct brcmf_fw_item *first = &req->items[0];
struct brcmf_fw *fwctx;
@@ -39,7 +39,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
char *alt_path = NULL;
int ret;
-@@ -712,6 +717,9 @@ int brcmf_fw_get_firmwares(struct device
+@@ -768,6 +773,9 @@ int brcmf_fw_get_firmwares(struct device
fwctx->dev = dev;
fwctx->req = req;
fwctx->done = fw_cb;
@@ -48,8 +48,8 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+ fwctx->completion = &completion;
/* First try alternative board-specific path if any */
- if (fwctx->req->board_type)
-@@ -730,6 +738,12 @@ int brcmf_fw_get_firmwares(struct device
+ if (fwctx->req->board_types[0])
+@@ -787,6 +795,12 @@ int brcmf_fw_get_firmwares(struct device
if (ret < 0)
brcmf_fw_request_done(NULL, fwctx);
diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
index 7b4cb250f9..4db63f92e6 100644
--- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
+++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
@@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -715,8 +715,36 @@ static struct wireless_dev *brcmf_cfg802
+@@ -710,8 +710,36 @@ static struct wireless_dev *brcmf_cfg802
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_pub *drvr = cfg->pub;
struct wireless_dev *wdev;
diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch
index 88465f256b..16eef0e105 100644
--- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch
+++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch
@@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -2974,6 +2974,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
+@@ -2973,6 +2973,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
* preference in cfg struct to apply this to
* FW later while initializing the dongle
*/
diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch
index 1ddc78f7ca..cd202f6576 100644
--- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch
+++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch
@@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-@@ -59,6 +59,36 @@ static int brcmf_of_get_country_codes(st
+@@ -65,6 +65,36 @@ static int brcmf_of_get_country_codes(st
return 0;
}
@@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
struct brcmf_mp_device *settings)
{
-@@ -91,6 +121,8 @@ void brcmf_of_probe(struct device *dev,
+@@ -105,6 +135,8 @@ void brcmf_of_probe(struct device *dev,
of_node_put(root);
}
diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch
index 8adb8c42a1..7d0e730b69 100644
--- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch
+++ b/package/kernel/mac80211/patches/brcm/865-brcmfmac-Read-alternative-firmware-names-from-DT.patch
@@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
#include "of.h"
static int brcmf_of_get_country_codes(struct device *dev,
-@@ -153,3 +154,38 @@ void brcmf_of_probe(struct device *dev,
+@@ -167,3 +168,38 @@ void brcmf_of_probe(struct device *dev,
sdio->oob_irq_nr = irq;
sdio->oob_irq_flags = irqf;
}
@@ -92,7 +92,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
-@@ -633,7 +634,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b
+@@ -634,7 +635,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b
/* per-board firmware binaries */
MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin");
@@ -101,7 +101,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
-@@ -659,6 +660,9 @@ static const struct brcmf_firmware_mappi
+@@ -662,6 +663,9 @@ static const struct brcmf_firmware_mappi
BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752)
};
@@ -111,18 +111,9 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
#define TXCTL_CREDITS 2
static void pkt_align(struct sk_buff *p, int len, int align)
-@@ -4140,7 +4144,7 @@ int brcmf_sdio_get_fwname(struct device
-
- fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev,
- brcmf_sdio_fwnames,
-- ARRAY_SIZE(brcmf_sdio_fwnames),
-+ brcmf_sdio_fwnames_count,
- fwnames, ARRAY_SIZE(fwnames));
- if (!fwreq)
- return -ENOMEM;
-@@ -4196,6 +4200,9 @@ static const struct brcmf_bus_ops brcmf_
- #define BRCMF_SDIO_FW_CODE 0
+@@ -4192,6 +4196,9 @@ static const struct brcmf_bus_ops brcmf_
#define BRCMF_SDIO_FW_NVRAM 1
+ #define BRCMF_SDIO_FW_CLM 2
+static struct brcmf_fw_request *
+brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus);
@@ -130,7 +121,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
static void brcmf_sdio_firmware_callback(struct device *dev, int err,
struct brcmf_fw_request *fwreq)
{
-@@ -4211,6 +4218,22 @@ static void brcmf_sdio_firmware_callback
+@@ -4207,6 +4214,22 @@ static void brcmf_sdio_firmware_callback
brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
@@ -153,7 +144,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
if (err)
goto fail;
-@@ -4419,7 +4442,7 @@ brcmf_sdio_prepare_fw_request(struct brc
+@@ -4417,7 +4440,7 @@ brcmf_sdio_prepare_fw_request(struct brc
fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev,
brcmf_sdio_fwnames,
diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch
deleted file mode 100644
index 234a97b7bf..0000000000
--- a/package/kernel/mac80211/patches/brcm/998-survey.patch
+++ /dev/null
@@ -1,148 +0,0 @@
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -2921,6 +2921,63 @@ done:
- }
-
- static int
-+brcmf_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev,
-+ int idx, struct survey_info *survey)
-+{
-+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
-+ struct brcmf_if *ifp = netdev_priv(ndev);
-+ struct brcmu_chan ch;
-+ enum nl80211_band band = 0;
-+ s32 err = 0;
-+ int noise;
-+ u32 freq;
-+ u32 chanspec;
-+
-+ memset(survey, 0, sizeof(struct survey_info));
-+ if (idx != 0) {
-+ if (idx >= cfg->pub->num_chan_stats || cfg->pub->chan_stats == NULL)
-+ return -ENOENT;
-+ if (cfg->pub->chan_stats[idx].freq == 0)
-+ return -ENOENT;
-+ survey->filled = SURVEY_INFO_NOISE_DBM;
-+ survey->channel = ieee80211_get_channel(wiphy, cfg->pub->chan_stats[idx].freq);
-+ survey->noise = cfg->pub->chan_stats[idx].noise;
-+ return 0;
-+ }
-+
-+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
-+ if (err) {
-+ brcmf_err("chanspec failed (%d)\n", err);
-+ return err;
-+ }
-+
-+ ch.chspec = chanspec;
-+ cfg->d11inf.decchspec(&ch);
-+
-+ switch (ch.band) {
-+ case BRCMU_CHAN_BAND_2G:
-+ band = NL80211_BAND_2GHZ;
-+ break;
-+ case BRCMU_CHAN_BAND_5G:
-+ band = NL80211_BAND_5GHZ;
-+ break;
-+ }
-+
-+ freq = ieee80211_channel_to_frequency(ch.control_ch_num, band);
-+ survey->channel = ieee80211_get_channel(wiphy, freq);
-+
-+ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_PHY_NOISE, &noise);
-+ if (err) {
-+ brcmf_err("Could not get noise (%d)\n", err);
-+ return err;
-+ }
-+
-+ survey->filled = SURVEY_INFO_NOISE_DBM | SURVEY_INFO_IN_USE;
-+ survey->noise = le32_to_cpu(noise);
-+ return 0;
-+}
-+
-+static int
- brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
- int idx, u8 *mac, struct station_info *sinfo)
- {
-@@ -3021,6 +3078,7 @@ static s32 brcmf_inform_single_bss(struc
- struct brcmu_chan ch;
- u16 channel;
- u32 freq;
-+ int i;
- u16 notify_capability;
- u16 notify_interval;
- u8 *notify_ie;
-@@ -3045,6 +3103,17 @@ static s32 brcmf_inform_single_bss(struc
- band = NL80211_BAND_5GHZ;
-
- freq = ieee80211_channel_to_frequency(channel, band);
-+ for (i = 0;i < cfg->pub->num_chan_stats;i++) {
-+ if (freq == cfg->pub->chan_stats[i].freq)
-+ break;
-+ if (cfg->pub->chan_stats[i].freq == 0)
-+ break;
-+ }
-+ if (i < cfg->pub->num_chan_stats) {
-+ cfg->pub->chan_stats[i].freq = freq;
-+ cfg->pub->chan_stats[i].noise = bi->phy_noise;
-+ }
-+
- bss_data.chan = ieee80211_get_channel(wiphy, freq);
- bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
- bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
-@@ -5573,6 +5642,7 @@ static struct cfg80211_ops brcmf_cfg8021
- .leave_ibss = brcmf_cfg80211_leave_ibss,
- .get_station = brcmf_cfg80211_get_station,
- .dump_station = brcmf_cfg80211_dump_station,
-+ .dump_survey = brcmf_cfg80211_dump_survey,
- .set_tx_power = brcmf_cfg80211_set_tx_power,
- .get_tx_power = brcmf_cfg80211_get_tx_power,
- .add_key = brcmf_cfg80211_add_key,
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1364,6 +1364,8 @@ int brcmf_attach(struct device *dev)
-
- /* Link to bus module */
- drvr->hdrlen = 0;
-+ drvr->chan_stats = vzalloc(256 * sizeof(struct brcmf_chan_stats));
-+ drvr->num_chan_stats = 256;
-
- /* Attach and link in the protocol */
- ret = brcmf_proto_attach(drvr);
-@@ -1446,6 +1448,12 @@ void brcmf_detach(struct device *dev)
- if (drvr == NULL)
- return;
-
-+ drvr->num_chan_stats = 0;
-+ if (drvr->chan_stats) {
-+ vfree(drvr->chan_stats);
-+ drvr->chan_stats = NULL;
-+ }
-+
- #ifdef CONFIG_INET
- unregister_inetaddr_notifier(&drvr->inetaddr_notifier);
- #endif
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
-@@ -91,6 +91,11 @@ struct brcmf_rev_info {
- u32 nvramrev;
- };
-
-+struct brcmf_chan_stats {
-+ u32 freq;
-+ int noise;
-+};
-+
- /* Common structure for module and instance linkage */
- struct brcmf_pub {
- /* Linkage ponters */
-@@ -100,6 +105,9 @@ struct brcmf_pub {
- struct cfg80211_ops *ops;
- struct brcmf_cfg80211_info *config;
-
-+ int num_chan_stats;
-+ struct brcmf_chan_stats *chan_stats;
-+
- /* Internal brcmf items */
- uint hdrlen; /* Total BRCMF header length (proto + bus) */
-