1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Thu, 28 May 2015 14:19:21 +0200
3 Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Recently Broadcom added support for NVRAMs with entries for multiple
10 PCIe devices. One of the supported formats is based on prefixes defined
11 like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
13 Unfortunately there are also a bit older devices using different way of
14 defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
17 Broadcom stated this old format will never be used/supported by brcmfmac
18 but given the simplicity of this patch I'll insist on supporting it.
20 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
21 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
24 --- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
25 +++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
26 @@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
29 /* Device path with a leading '=' key-value separator */
30 + char pci_path[] = "=pci/?/?";
32 char pcie_path[] = "=pcie/?/?";
35 @@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
36 /* First search for the devpathX and see if it is the configuration
37 * for domain_nr/bus_nr. Search complete nvp
39 + snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
41 + pci_len = strlen(pci_path);
42 snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
44 pcie_len = strlen(pcie_path);
45 @@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
46 /* Format: devpathX=pcie/Y/Z/
47 * Y = domain_nr, Z = bus_nr, X = virtual ID
49 - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
50 - (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
51 + if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
52 + (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
53 + !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
54 id = nvp->nvram[i + 7] - '0';