mac80211: backport brcmfmac fixes & debugging helpers from 4.18
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch
1 From 299b6365a3b7cf7f5ea1c945a420e9ee4841d6f7 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Sun, 22 Jul 2018 23:46:25 +0200
4 Subject: [PATCH] brcmfmac: fix regression in parsing NVRAM for multiple
5 devices
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 NVRAM is designed to work with Broadcom's SDK Linux kernel which fakes
11 PCI domain 0 for all internal MMIO devices. Since official Linux kernel
12 uses platform devices for that purpose there is a mismatch in numbering
13 PCI domains.
14
15 There used to be a fix for that problem but it was accidentally dropped
16 during the last firmware loading rework. That resulted in brcmfmac not
17 being able to extract device specific NVRAM content and all kind of
18 calibration problems.
19
20 Reported-by: Aditya Xavier <adityaxavier@gmail.com>
21 Fixes: 2baa3aaee27f ("brcmfmac: introduce brcmf_fw_alloc_request() function")
22 Cc: stable@vger.kernel.org # v4.17+
23 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
24 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
25 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
26 ---
27 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++-
28 1 file changed, 2 insertions(+), 1 deletion(-)
29
30 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
31 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
32 @@ -1785,7 +1785,8 @@ brcmf_pcie_prepare_fw_request(struct brc
33 fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY;
34 fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM;
35 fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL;
36 - fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus);
37 + /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */
38 + fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1;
39 fwreq->bus_nr = devinfo->pdev->bus->number;
40
41 return fwreq;