mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 07:46:48 +00:00
a8cc06c537
This pick most of brcmfmac changes backported into the master in commits5932eb690f
("mac80211: brcmfmac: backport firmware loading cleanup")3eab6b8275
("mac80211: brcmfmac: backport NVRAM loading improvements")529c95cc15
("mac80211: brcmfmac: fix use-after-free & possible NULL pointer dereference") It's more than would be normally backported into a stable branch but it seems required. Firmware loading cleanups are needed to allow fix memory bugs in a reliable way. Memory fixes are really important to avoid corrupting memory and risking a NULL pointer dereference. Hopefully this stuff has received enough testing in the master. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
61 lines
1.7 KiB
Diff
61 lines
1.7 KiB
Diff
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
|
Subject: [PATCH] brcmfmac: add in-driver tables with country codes
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This adds early support for changing region. Ideally this data should
|
|
be stored in DT as all these mappings are devices specific.
|
|
|
|
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
|
|
@@ -23,6 +23,36 @@
|
|
#include "common.h"
|
|
#include "of.h"
|
|
|
|
+/* TODO: FIXME: Use DT */
|
|
+static void brcmf_of_probe_cc(struct device *dev,
|
|
+ struct brcmf_mp_device *settings)
|
|
+{
|
|
+ static struct brcmfmac_pd_cc_entry netgear_r8000_cc_ent[] = {
|
|
+ { "JP", "JP", 78 },
|
|
+ { "US", "Q2", 86 },
|
|
+ };
|
|
+ struct brcmfmac_pd_cc_entry *cc_ent = NULL;
|
|
+ int table_size = 0;
|
|
+
|
|
+ if (of_machine_is_compatible("netgear,r8000")) {
|
|
+ cc_ent = netgear_r8000_cc_ent;
|
|
+ table_size = ARRAY_SIZE(netgear_r8000_cc_ent);
|
|
+ }
|
|
+
|
|
+ if (cc_ent && table_size) {
|
|
+ struct brcmfmac_pd_cc *cc;
|
|
+ size_t memsize;
|
|
+
|
|
+ memsize = table_size * sizeof(struct brcmfmac_pd_cc_entry);
|
|
+ cc = devm_kzalloc(dev, sizeof(*cc) + memsize, GFP_KERNEL);
|
|
+ if (!cc)
|
|
+ return;
|
|
+ cc->table_size = table_size;
|
|
+ memcpy(cc->table, cc_ent, memsize);
|
|
+ settings->country_codes = cc;
|
|
+ }
|
|
+}
|
|
+
|
|
void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
|
|
struct brcmf_mp_device *settings)
|
|
{
|
|
@@ -41,6 +71,8 @@ void brcmf_of_probe(struct device *dev,
|
|
of_node_put(root);
|
|
}
|
|
|
|
+ brcmf_of_probe_cc(dev, settings);
|
|
+
|
|
if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
|
|
!of_device_is_compatible(np, "brcm,bcm4329-fmac"))
|
|
return;
|