2017-01-15 23:32:27 +00:00
|
|
|
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
|
2021-10-10 19:24:14 +00:00
|
|
|
@@ -58,6 +58,36 @@ static int brcmf_of_get_country_codes(st
|
|
|
|
return 0;
|
|
|
|
}
|
2017-01-15 23:32:27 +00:00
|
|
|
|
|
|
|
+/* 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 },
|
|
|
|
+ };
|
2017-01-24 15:54:09 +00:00
|
|
|
+ struct brcmfmac_pd_cc_entry *cc_ent = NULL;
|
|
|
|
+ int table_size = 0;
|
2017-01-15 23:32:27 +00:00
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
{
|
2021-10-10 19:24:14 +00:00
|
|
|
@@ -90,6 +120,8 @@ void brcmf_of_probe(struct device *dev,
|
2018-11-07 10:06:16 +00:00
|
|
|
of_node_put(root);
|
|
|
|
}
|
2017-01-15 23:32:27 +00:00
|
|
|
|
|
|
|
+ brcmf_of_probe_cc(dev, settings);
|
|
|
|
+
|
2021-10-10 19:24:14 +00:00
|
|
|
if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
|
2017-01-15 23:32:27 +00:00
|
|
|
return;
|
2021-10-10 19:24:14 +00:00
|
|
|
|