aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2017-01-16 00:32:27 +0100
committerRafał Miłecki <rafal@milecki.pl>2017-01-16 00:32:27 +0100
commit25200ae7a5e0626ff28b32227a6ea84063271d73 (patch)
tree281998c787c17b5a4c4500a1390afcb00989b2ad /package/kernel/mac80211
parent5fba00a6862720ff1701667c774c6ac6f5a2c662 (diff)
downloadupstream-25200ae7a5e0626ff28b32227a6ea84063271d73.tar.gz
upstream-25200ae7a5e0626ff28b32227a6ea84063271d73.tar.bz2
upstream-25200ae7a5e0626ff28b32227a6ea84063271d73.zip
mac80211: brcmfmac: add early (& hacky) patch for storing country codes
This allows some basic region switching on Netgear R8000. More devices & codes may be added. Ideally it should be converted into DT info & patch. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'package/kernel/mac80211')
-rw-r--r--package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch
new file mode 100644
index 0000000000..b7d6aec29a
--- /dev/null
+++ b/package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch
@@ -0,0 +1,60 @@
+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;
++ int table_size;
++
++ 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)
+ {
+@@ -32,6 +62,8 @@ void brcmf_of_probe(struct device *dev,
+ u32 irqf;
+ u32 val;
+
++ brcmf_of_probe_cc(dev, settings);
++
+ if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
+ !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
+ return;