* [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie)
@ 2015-05-28 12:19 Rafał Miłecki
2015-06-01 11:59 ` Arend van Spriel
2015-06-08 11:26 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2015-05-28 12:19 UTC (permalink / raw)
To: Kalle Valo, linux-wireless
Cc: Brett Rudley, Arend van Spriel, Franky (Zhenhui) Lin,
Hante Meuleman, brcm80211-dev-list, Rafał Miłecki
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 <zajec5@gmail.com>
---
drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index b72df87..743f16b 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;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie)
2015-05-28 12:19 [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) Rafał Miłecki
@ 2015-06-01 11:59 ` Arend van Spriel
2015-06-01 12:32 ` Rafał Miłecki
2015-06-08 11:26 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Arend van Spriel @ 2015-06-01 11:59 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Kalle Valo, linux-wireless, Brett Rudley, Franky (Zhenhui) Lin,
Hante Meuleman, brcm80211-dev-list
On 05/28/15 14:19, Rafał Miłecki wrote:
> 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.
Well, if you insist :-p
Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Rafał Miłecki<zajec5@gmail.com>
> ---
> drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
> index b72df87..743f16b 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie)
2015-06-01 11:59 ` Arend van Spriel
@ 2015-06-01 12:32 ` Rafał Miłecki
0 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2015-06-01 12:32 UTC (permalink / raw)
To: Arend van Spriel
Cc: Kalle Valo, linux-wireless@vger.kernel.org, Brett Rudley,
Franky (Zhenhui) Lin, Hante Meuleman, brcm80211 development
On 1 June 2015 at 13:59, Arend van Spriel <arend@broadcom.com> wrote:
> On 05/28/15 14:19, Rafał Miłecki wrote:
>>
>> 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.
>
>
> Well, if you insist :-p
>
> Acked-by: Arend van Spriel <arend@broadcom.com>
Haha, thanks :) This will make SR400ac my primary home router for
sure. A great piece of hardware :)
--
Rafał
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie)
2015-05-28 12:19 [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) Rafał Miłecki
2015-06-01 11:59 ` Arend van Spriel
@ 2015-06-08 11:26 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2015-06-08 11:26 UTC (permalink / raw)
To: Rafał Miłecki
Cc: linux-wireless, Brett Rudley, Arend van Spriel,
Franky (Zhenhui) Lin, Hante Meuleman, brcm80211-dev-list
Rafał Miłecki <zajec5@gmail.com> writes:
> 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 <zajec5@gmail.com>
Thanks, applied manually.
--
Kalle Valo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-08 11:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28 12:19 [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) Rafał Miłecki
2015-06-01 11:59 ` Arend van Spriel
2015-06-01 12:32 ` Rafał Miłecki
2015-06-08 11:26 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.