From: Rafał Miłecki Date: Thu, 28 May 2015 12:19:21 +0000 (+0200) Subject: brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) X-Git-Tag: v4.2-rc1~130^2~34^2~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f33d591539bd07ec9cdb8c44b0075fb0423d0329;p=platform%2Fkernel%2Flinux-exynos.git brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) Recently Broadcom added support for NVRAMs with entries for multiple PCIe devices. One of the supported formats is based on prefixes defined like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc. Unfortunately there are also a bit older devices using different way of defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries: devpath0=pci/1/1/ devpath1=pci/2/1 Broadcom stated this old format will never be used/supported by brcmfmac but given the simplicity of this patch I'll insist on supporting it. Signed-off-by: Rafał Miłecki Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c index 7ae6461..fdafa79 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c @@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr, u16 bus_nr) { /* Device path with a leading '=' key-value separator */ + char pci_path[] = "=pci/?/?"; + size_t pci_len; char pcie_path[] = "=pcie/?/?"; size_t pcie_len; @@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr, /* First search for the devpathX and see if it is the configuration * for domain_nr/bus_nr. Search complete nvp */ + snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr, + bus_nr); + pci_len = strlen(pci_path); snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr, bus_nr); pcie_len = strlen(pcie_path); @@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr, /* Format: devpathX=pcie/Y/Z/ * Y = domain_nr, Z = bus_nr, X = virtual ID */ - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) && - (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) { + if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 && + (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) || + !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) { id = nvp->nvram[i + 7] - '0'; found = true; break;