kernel: bump 4.14 to 4.14.72
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / 341-v4.19-brcmfmac-specify-some-features-per-firmware-version.patch
1 From 1e591c56a65fbbcd5754a4210a0ef0402d5e5f33 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 9 Jul 2018 06:55:43 +0200
4 Subject: [PATCH] brcmfmac: specify some features per firmware version
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Some features supported by firmware aren't advertised and there is no
10 way for a driver to query them. This includes e.g. monitor mode details.
11
12 Most firmwares support monitor interface but only the latest ones
13 /announce/ it with a "monitor" flag in the "cap" iovar. There isn't any
14 reliable detection method for older firmwares (BRCMF_C_MONITOR was tried
15 but "it only indicates the core part of the stack supports").
16
17 Similarly support for tagging monitor frames and building radiotap
18 headers can't be reliably detected for all firmwares.
19
20 This commit adds table that allows mapping features to firmware version.
21 It adds mappings for 43602a1 and 4366b1 firmwares from
22 linux-firmware.git. Both were confirmed to be passing monitor frames.
23
24 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
25 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
26 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
27 ---
28 .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 38 ++++++++++++++++++++++
29 1 file changed, 38 insertions(+)
30
31 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
32 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
33 @@ -93,6 +93,42 @@ static int brcmf_feat_debugfs_read(struc
34 }
35 #endif /* DEBUG */
36
37 +struct brcmf_feat_fwfeat {
38 + const char * const fwid;
39 + u32 feat_flags;
40 +};
41 +
42 +static const struct brcmf_feat_fwfeat brcmf_feat_fwfeat_map[] = {
43 + /* brcmfmac43602-pcie.ap.bin from linux-firmware.git commit ea1178515b88 */
44 + { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) },
45 + /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */
46 + { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) },
47 +};
48 +
49 +static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv)
50 +{
51 + const struct brcmf_feat_fwfeat *e;
52 + u32 feat_flags = 0;
53 + int i;
54 +
55 + for (i = 0; i < ARRAY_SIZE(brcmf_feat_fwfeat_map); i++) {
56 + e = &brcmf_feat_fwfeat_map[i];
57 + if (!strcmp(e->fwid, drv->fwver)) {
58 + feat_flags = e->feat_flags;
59 + break;
60 + }
61 + }
62 +
63 + if (!feat_flags)
64 + return;
65 +
66 + for (i = 0; i < BRCMF_FEAT_LAST; i++)
67 + if (feat_flags & BIT(i))
68 + brcmf_dbg(INFO, "enabling firmware feature: %s\n",
69 + brcmf_feat_names[i]);
70 + drv->feat_flags |= feat_flags;
71 +}
72 +
73 /**
74 * brcmf_feat_iovar_int_get() - determine feature through iovar query.
75 *
76 @@ -253,6 +289,8 @@ void brcmf_feat_attach(struct brcmf_pub
77 }
78 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_FWSUP, "sup_wpa");
79
80 + brcmf_feat_firmware_overrides(drvr);
81 +
82 /* set chip related quirks */
83 switch (drvr->bus_if->chip) {
84 case BRCM_CC_43236_CHIP_ID: