From patchwork Thu May 28 12:19:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 6497871 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4AF00C0020 for ; Thu, 28 May 2015 12:19:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 723A12061B for ; Thu, 28 May 2015 12:19:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72C4520625 for ; Thu, 28 May 2015 12:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754081AbbE1MTw (ORCPT ); Thu, 28 May 2015 08:19:52 -0400 Received: from mail-la0-f46.google.com ([209.85.215.46]:35836 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754028AbbE1MTn (ORCPT ); Thu, 28 May 2015 08:19:43 -0400 Received: by labko7 with SMTP id ko7so26522576lab.2 for ; Thu, 28 May 2015 05:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=982D2rMQw/ywuqsdajapUS2yod7CNoG2SKHJpYBxzCw=; b=o0C4p7yJn1eAEXTVc9vMbpluHAwvyjZ23GLIM9qCeW9QNCYE0VdjNB7ExeoPwIacaW eo+CX+qQOEP+Ze+NuTZNXDK3WaZBPxXcsEJaDk+WIyjFElLlaX/oIfVtLw6Dy4RgHHnc NVcNVif10ubcmOkY9nF69OVRdJxcvdLHfh0pkkD7TICjj8FL47TXUX0v3ixsNzG21JJz VKHcWQGAL7UtP9bnWSPCP448nlcCQ+mqne8Bs2kz76kbxuHcQqxjjq+wTyLqgdsbxI26 Y7+yiZV5RU7ZtD7w4GVOZy7hxNIgfB4X19Ybnb5curhd2xc6OWEmA6UjdH96OKRjMpq/ QW7g== X-Received: by 10.152.21.97 with SMTP id u1mr2439272lae.71.1432815581308; Thu, 28 May 2015 05:19:41 -0700 (PDT) Received: from linux-tdhb.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by mx.google.com with ESMTPSA id j1sm494281lbc.15.2015.05.28.05.19.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2015 05:19:40 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo , linux-wireless@vger.kernel.org Cc: Brett Rudley , Arend van Spriel , "Franky (Zhenhui) Lin" , Hante Meuleman , brcm80211-dev-list@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of pcie) Date: Thu, 28 May 2015 14:19:21 +0200 Message-Id: <1432815561-6639-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Arend van Spriel --- 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;