From patchwork Mon Jun 13 09:19:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581950 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE5AC433EF for ; Mon, 13 Jun 2022 09:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240720AbiFMJTe (ORCPT ); Mon, 13 Jun 2022 05:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240658AbiFMJT1 (ORCPT ); Mon, 13 Jun 2022 05:19:27 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA2C14D14 for ; Mon, 13 Jun 2022 02:19:25 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 25so6221627edw.8 for ; Mon, 13 Jun 2022 02:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=v8H/f33+kWC02Y0QsHt0YH0sd8usWnmRB4IjtTkb5jk=; b=b5DYy3byv7K08kJ4yxHvw3ZMLmabIMHj2xtaiV/uTKCNUeLKya7NjO/SW8Fc7fjMf1 ODEWP9JsmbKB3GX6ayjxt9LjPIcPMl8bnZwqMl8b0j7r5piQbICZc1lxGxIfqUolhXJA Lu7ujOBaUDM47upZXG6n0qHaF35nQbpo8WaDdlwbwO6F3sSaQKuxBRg0gDX4mfNPe5HX BpznOi1+1vDr1YlDJm6qPtPfCwxooJzSZLTzZwSYVgMm8ZWWv3OIbiCA6SEP4zsMwxhe 9vvAYs3C0HdqR8m7rEcwbCIdmJZSmk/m4PweG2HYw5ZTSofOAJBCWGwMOhdaDZJ9A2Za gtkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=v8H/f33+kWC02Y0QsHt0YH0sd8usWnmRB4IjtTkb5jk=; b=rwwLQcZ3Bqf5xnHSMZd4XPkHPVMVCmGakSMxSHpDxEFJVNbOeEZ7WDDEJGhdheJ3TS iPdxyTePI3EdGivvQaD9eJmOyaV9mWLvTxbqjIbIhMxGdIb6REmb5UVF78LSBLAsY2nR SrPd4wCe4ZU0F+UE2veViPXViZ573xE+nAY5VZwJ5IiH+SDQOnUZI4L7tiqS1p77+QUr k0VOttJgQmMYLJv+ahHacW/TVmWyKZovwOgyeM7SNhnYuKzNPG5V25H7oyq59BWoDajy N/pEwxdUBZkWUr4ZecyvDZ/3arHq8Ql+dRMWWmGmlR+5yC69jz42fQxRVXZy5+Txt0SY REjw== X-Gm-Message-State: AOAM533165/Nl3kpHqXzdL3PNc+Ja5ubVQkvuRUdq5ZexY59SVPUxPv4 RqdQHSKps0SO5C4fuk3r4iPpKtSqcayYfOCWEUfXohvhg6A= X-Google-Smtp-Source: ABdhPJyTx90naxxksXVKkiym3FSWpwqZ3yUOPutWvbsrOYjfwlNcHjobZ3k53wPpOUNMF4UXM3DHG8xBwXVzIZmJlwE= MIME-Version: 1.0 X-Received: by 2002:aa7:da50:0:b0:42d:cdc8:8751 with SMTP id w16-20020aa7da50000000b0042dcdc88751mr64722450eds.19.1655111964486; Mon, 13 Jun 2022 02:19:24 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:23 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:23 -0400 Message-ID: Subject: [PATCH 1/7] brcmfmac: add function to unbind device to bus layer api To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce a new bus callback .remove() which will unbind the device from the driver. This allows the common driver layer to stop handling a device. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 13 +++++++++++++ .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index 3f5da3bb6aa5..a9363de809ea 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -6,6 +6,7 @@ #ifndef BRCMFMAC_BUS_H #define BRCMFMAC_BUS_H +#include #include "debug.h" /* IDs of the 6 default common rings of msgbuf protocol */ @@ -61,6 +62,7 @@ struct brcmf_bus_dcmd { * @get_ramsize: obtain size of device memory. * @get_memdump: obtain device memory dump in provided buffer. * @get_fwname: obtain firmware name. + * @remove: initiate unbind of the device. * * This structure provides an abstract interface towards the * bus specific driver. For control messages to common driver @@ -81,6 +83,7 @@ struct brcmf_bus_ops { unsigned char *fw_name); void (*debugfs_create)(struct device *dev); int (*reset)(struct device *dev); + void (*remove)(struct device *dev); }; @@ -244,6 +247,16 @@ int brcmf_bus_reset(struct brcmf_bus *bus) return bus->ops->reset(bus->dev); } +static inline void brcmf_bus_remove(struct brcmf_bus *bus) +{ + if (!bus->ops->remove) { + device_release_driver(bus->dev); + return; + } + + bus->ops->remove(bus->dev); +} + /* * interface functions from common layer */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index 212fbbe1cd7e..be2e50ed6e1c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -4179,6 +4179,15 @@ static int brcmf_sdio_bus_reset(struct device *dev) return ret; } +static void brcmf_sdio_bus_remove(struct device *dev) +{ + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; + + device_release_driver(&sdiod->func2->dev); + device_release_driver(&sdiod->func1->dev); +} + static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { .stop = brcmf_sdio_bus_stop, .preinit = brcmf_sdio_bus_preinit, @@ -4191,7 +4200,8 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { .get_memdump = brcmf_sdio_bus_get_memdump, .get_fwname = brcmf_sdio_get_fwname, .debugfs_create = brcmf_sdio_debugfs_create, - .reset = brcmf_sdio_bus_reset + .reset = brcmf_sdio_bus_reset, + .remove = brcmf_sdio_bus_remove, }; #define BRCMF_SDIO_FW_CODE 0 From patchwork Mon Jun 13 09:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B481FCCA47B for ; Mon, 13 Jun 2022 09:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240707AbiFMJTc (ORCPT ); Mon, 13 Jun 2022 05:19:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240666AbiFMJT1 (ORCPT ); Mon, 13 Jun 2022 05:19:27 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE96D17044 for ; Mon, 13 Jun 2022 02:19:26 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id d14so6208215eda.12 for ; Mon, 13 Jun 2022 02:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=YCsndrMJLVIw2GObEy/S2kpkzKFFbVzehHSlvDh46Z4=; b=T4XPK3jNvBBEEi5dlOOEAfz4gsearjQoeIF3BOw9L/Dbk2F7kj379P+kspdK11uRG3 iVu2SR9qy/G9eHpwmJcP6Q6Q1T+hB+e20+78RYDQ26dKt0IfwM1cGhKSmukW0G0yBJpR nXXRWFSA4Ha5R2YCxPRyhjV2ET8AHOzwQyBMg7JL6xXG8HJZYPuKzbbefMmg4Afkl+PN E3a3YxFjaP76PMDSRlwxnuKcLhGvWV8ObBVdaVqgi0rHy6CB82b/FwAaG3KzqinI6icb ayf2R0J8fqB18qv842AxA7gX9kOJwKxliwvdprRRYojb46BKXFOOZEVTVfSqEcdkpP1p RvYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=YCsndrMJLVIw2GObEy/S2kpkzKFFbVzehHSlvDh46Z4=; b=mZCOIZR9Dx6c4BgFokGt+JZcvZ1UlunBbuII72uDICfNbIhtu18DLyeyhlKNF8A8bw 6h07buYYiGj+BFYlXv1ETwTHUAQLLngw4zqHhXorJexNsAlcjYVi+jqWX5zB0N2eiN5O JA7p+8UntkFlTlYX7YqT4NyB+3ZojhrZqbLz2UNYIPdvTB8aoLRlG9edjTcNCeJh05oA fwwf86l3/cCSmpGaOwM/XenGP/tsBFauV27JWwE6nz2jk7ZJgihjhyamcLn9fTW6NyEM 0yxD+9pjCc0onpH3WUoONMCycBsGixZzDV7u4UsyI1Jd6KWxafuUNxEMsc8vh6TIteVE IZzw== X-Gm-Message-State: AOAM530SImHdqrZXai4Uoxgym9tSDiPYFb6nbp8deBQ7KnU1tLrTmW5G JO8Pfie5AO2tOce5lc3Syx4AMvAK+PkDpoL8bZM= X-Google-Smtp-Source: ABdhPJwEDhjBUtHDBwZ2758maEy7tFzgt22I9umJK7S4o2XHRHBnwquzNelYXXifDivt0Ev6Qd5/1UA/Yj27sSI1qlk= MIME-Version: 1.0 X-Received: by 2002:a05:6402:ea7:b0:433:6141:840e with SMTP id h39-20020a0564020ea700b004336141840emr13193013eda.266.1655111965459; Mon, 13 Jun 2022 02:19:25 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:24 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:24 -0400 Message-ID: Subject: [PATCH 2/7] brcmfmac: add firmware vendor info in driver data To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to determine the vendor that released a firmware image for a specific device, the device table now sets the vendor identifier and it is stored in struct brcmf_bus::fwvid during probe. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 6 ++++- .../broadcom/brcm80211/brcmfmac/bus.h | 11 +++++++- .../broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++---- .../broadcom/brcm80211/brcmfmac/usb.c | 27 +++++++++++++------ 4 files changed, 49 insertions(+), 15 deletions(-) struct brcmf_usbdev *bus_pub = NULL; @@ -1278,6 +1279,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) dev_set_drvdata(dev, bus); bus->ops = &brcmf_usb_bus_ops; bus->proto_type = BRCMF_PROTO_BCDC; + bus->fwvid = fwvid; bus->always_use_fws_queue = true; #ifdef CONFIG_PM bus->wowl_supported = true; @@ -1436,7 +1438,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) else brcmf_dbg(USB, "Broadcom full speed USB WLAN interface detected\n"); - ret = brcmf_usb_probe_cb(devinfo); + ret = brcmf_usb_probe_cb(devinfo, id->driver_info); if (ret) goto fail; @@ -1524,14 +1526,23 @@ static int brcmf_usb_reset_resume(struct usb_interface *intf) return ret; } -#define BRCMF_USB_DEVICE(dev_id) \ - { USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id) } +#define BRCMF_USB_DEVICE(dev_id) \ + { \ + USB_DEVICE(BRCM_USB_VENDOR_ID_BROADCOM, dev_id), \ + .driver_info = BRCMF_FWVENDOR_WCC \ + } -#define LINKSYS_USB_DEVICE(dev_id) \ - { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) } +#define LINKSYS_USB_DEVICE(dev_id) \ + { \ + USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id), \ + .driver_info = BRCMF_FWVENDOR_WCC \ + } -#define CYPRESS_USB_DEVICE(dev_id) \ - { USB_DEVICE(CY_USB_VENDOR_ID_CYPRESS, dev_id) } +#define CYPRESS_USB_DEVICE(dev_id) \ + { \ + USB_DEVICE(CY_USB_VENDOR_ID_CYPRESS, dev_id), \ + .driver_info = BRCMF_FWVENDOR_WCC \ + } static const struct usb_device_id brcmf_usb_devid_table[] = { BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID), diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 9c598ea97499..5ec56567dab6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -968,7 +968,10 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) } #define BRCMF_SDIO_DEVICE(dev_id) \ - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, dev_id)} + { \ + SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, dev_id), \ + .driver_data = BRCMF_FWVENDOR_WCC \ + } /* devices we support, null terminated */ static const struct sdio_device_id brcmf_sdmmc_ids[] = { @@ -1058,6 +1061,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, sdiodev->bus_if = bus_if; bus_if->bus_priv.sdio = sdiodev; bus_if->proto_type = BRCMF_PROTO_BCDC; + bus_if->fwvid = id->driver_data; dev_set_drvdata(&func->dev, bus_if); dev_set_drvdata(&sdiodev->func1->dev, bus_if); sdiodev->dev = &sdiodev->func1->dev; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index a9363de809ea..2008fde3ff4e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -23,6 +23,13 @@ #define BRCMF_NROF_COMMON_MSGRINGS (BRCMF_NROF_H2D_COMMON_MSGRINGS + \ BRCMF_NROF_D2H_COMMON_MSGRINGS) +enum brcmf_fwvendor { + BRCMF_FWVENDOR_WCC, + /* keep last */ + BRCMF_FWVENDOR_NUM, + BRCMF_FWVENDOR_INVALID +}; + /* The level of bus communication with the dongle */ enum brcmf_bus_state { BRCMF_BUS_DOWN, /* Not ready for frame transfers */ @@ -131,9 +138,10 @@ struct brcmf_bus_stats { * @stats: statistics shared between common and bus layer. * @maxctl: maximum size for rxctl request message. * @chip: device identifier of the dongle chip. + * @chiprev: revision of the dongle chip. + * @fwvid: firmware vendor-support identifier of the device. * @always_use_fws_queue: bus wants use queue also when fwsignal is inactive. * @wowl_supported: is wowl supported by bus driver. - * @chiprev: revision of the dongle chip. * @msgbuf: msgbuf protocol parameters provided by bus layer. */ struct brcmf_bus { @@ -150,6 +158,7 @@ struct brcmf_bus { uint maxctl; u32 chip; u32 chiprev; + enum brcmf_fwvendor fwvid; bool always_use_fws_queue; bool wowl_supported; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 97f0f13dfe50..0599dad96018 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1910,6 +1910,7 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) bus->bus_priv.pcie = pcie_bus_dev; bus->ops = &brcmf_pcie_bus_ops; bus->proto_type = BRCMF_PROTO_MSGBUF; + bus->fwvid = id->driver_data; bus->chip = devinfo->coreid; bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); dev_set_drvdata(&pdev->dev, bus); @@ -2076,11 +2077,20 @@ static const struct dev_pm_ops brcmf_pciedrvr_pm = { #endif /* CONFIG_PM */ -#define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 } -#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \ - BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\ - subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 } +#define BRCMF_PCIE_DEVICE(dev_id) \ + { \ + BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ + PCI_ANY_ID, PCI_ANY_ID, \ + PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ + BRCMF_FWVENDOR_WCC \ + } +#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) \ + { \ + BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ + (subvend), (subdev), \ + PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ + BRCMF_FWVENDOR_WCC \ + } static const struct pci_device_id brcmf_pcie_devid_table[] = { BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 9fb68c2dc7e3..e34523c8a275 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -1253,7 +1253,8 @@ brcmf_usb_prepare_fw_request(struct brcmf_usbdev_info *devinfo) return fwreq; } -static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) +static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo, + enum brcmf_fwvendor fwvid) { struct brcmf_bus *bus = NULL; From patchwork Mon Jun 13 09:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2493CC43334 for ; Mon, 13 Jun 2022 09:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240717AbiFMJTf (ORCPT ); Mon, 13 Jun 2022 05:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240676AbiFMJT3 (ORCPT ); Mon, 13 Jun 2022 05:19:29 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B24186F0 for ; Mon, 13 Jun 2022 02:19:28 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id v1so9864539ejg.13 for ; Mon, 13 Jun 2022 02:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=ENY/KOqqUnEnWDjjSY3OF68da/0petsodgVm2JNTiCg=; b=K7I3wwjdHvNsAxf4nc84zeMom9Crc7URxysiLj+qaMnAkbVoOFSPeumnbNhBWaYVTK mS6jB8hMIr3SVTeZ2yIdIehK9Wog9B+gM7ZQbPAAN4loDmKuX74EjF0foEAc4Kbv7iJv I/D5LjYsntHO8ogXHIvAwOHWYpPwXaRKXoa4jH4iKTgPb/rN3kRx2Xo4UqRjtCiZ9ry+ x3va9JhbX/f7j5cXvTpXhcmVewFI8RwIMDUSkezmCFnwk50c1Ru5N4ESYI47iCIZHwvq /vtXb2zdds0RaphEmDIILNSzrgf+suSrnlWh0mA7YcnAsqWaMaRNfk9JJledP2Y8Oz8R 2E8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=ENY/KOqqUnEnWDjjSY3OF68da/0petsodgVm2JNTiCg=; b=2NDtm7Ttc/ljUstrG3yeM/LMQ8eUFVE/aBPoyjkEgwwtxjFgY6kOvK2nR7X9mRILHa NVq93n8n/0yevSi/Bhj4K7EYOgPuP5JDeu4CKI4ay+eSMBY1yTBNl2B8VNvL7h8PjrZQ G/TuCtI735dgR3bmQMPrPUlHOLdT1xybwKWxa+iNzAMSLTWWb29cXFsog8kdUa9tRkAJ gPyFPy5sST2RHR+Bzra107QEsPz6IUZkz9SReBHtFA7E+R4vbdbCi7GoKu4Lrc52jy0e 44PKggWIzrreYn8f3+gDzbZi/g0Tt2gWIkT68lty1/cFVktM1h09uYlPiOUeejC0u5Gp /3Lw== X-Gm-Message-State: AOAM531eA+dLOuF47WDvuUiLHPQj2tNZubzHuL6wNf33ViIZwRyCYaLz G87u1AiuvdmSq7WbaQlJKQ2fRy5kh7yuUjwsEg4= X-Google-Smtp-Source: ABdhPJz/CA4GWMHuuLjSYOcJyuBQZKuzQebDxMqVa0YMd+5XwVylnt802ePHxaOmhHYMidHjZirIId67TRqjav/OJuw= MIME-Version: 1.0 X-Received: by 2002:a17:907:2095:b0:711:fbbe:e307 with SMTP id pv21-20020a170907209500b00711fbbee307mr19791774ejb.274.1655111966534; Mon, 13 Jun 2022 02:19:26 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:26 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:26 -0400 Message-ID: Subject: [PATCH 3/7] brcmfmac: add support for vendor-specific firmware api To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The driver is being used by multiple vendors who develop the firmware api independently. So far the firmware api as used by the driver has not diverged (yet). This change adds framework for supporting multiple firmware apis. The vendor-specific support code has to provide a number of callback operations. Right now it is only attach and detach callbacks so no real functionality as the api is still common. This code only adds WCC variant anyway, which is selected for all devices right now. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/Kconfig | 16 ++ .../broadcom/brcm80211/brcmfmac/Makefile | 7 + .../broadcom/brcm80211/brcmfmac/bus.h | 4 + .../broadcom/brcm80211/brcmfmac/core.c | 9 + .../broadcom/brcm80211/brcmfmac/core.h | 2 + .../broadcom/brcm80211/brcmfmac/fwvid.c | 196 ++++++++++++++++++ .../broadcom/brcm80211/brcmfmac/fwvid.h | 46 ++++ .../broadcom/brcm80211/brcmfmac/wcc/Makefile | 12 ++ .../broadcom/brcm80211/brcmfmac/wcc/core.c | 27 +++ .../broadcom/brcm80211/brcmfmac/wcc/module.c | 26 +++ .../broadcom/brcm80211/brcmfmac/wcc/vops.h | 15 ++ 11 files changed, 360 insertions(+) create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/Makefile create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/vops.h diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig index 32794c1eca23..32c2f6e42a3e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig @@ -8,6 +8,22 @@ config BRCMFMAC interface support. If you choose to build a module, it'll be called brcmfmac.ko. +config BRCMFMAC_VENDOR_MODULES + bool "Use vendor-specific modules" + depends on BRCMFMAC = m + help + This option will build separate modules for the vendor-specific + firmware support. If not selected the vendor-specific support + will be build in brcmfmac.ko. + +config BRCMFMAC_VENDOR_WCC + bool "Broadcom WCC" + default y + depends on BRCMFMAC + help + This option will allow the driver to communicate with devices + shipped by Broadcom WCC division. + config BRCMFMAC_PROTO_BCDC bool diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile index 13c13504a6e8..08dbafdb6527 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile @@ -20,6 +20,7 @@ brcmfmac-objs += \ common.o \ core.o \ firmware.o \ + fwvid.o \ feature.o \ btcoex.o \ vendor.o \ @@ -47,3 +48,9 @@ brcmfmac-$(CONFIG_OF) += \ of.o brcmfmac-$(CONFIG_DMI) += \ dmi.o + +ifeq ($(CONFIG_BRCMFMAC_VENDOR_MODULES),) +brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/core.o +else +obj-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/ +endif diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index 2008fde3ff4e..a2759171fcc9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -142,7 +142,9 @@ struct brcmf_bus_stats { * @fwvid: firmware vendor-support identifier of the device. * @always_use_fws_queue: bus wants use queue also when fwsignal is inactive. * @wowl_supported: is wowl supported by bus driver. + * @ops: callbacks for this bus instance. * @msgbuf: msgbuf protocol parameters provided by bus layer. + * @list: member used to add this bus instance to linked list. */ struct brcmf_bus { union { @@ -164,6 +166,8 @@ struct brcmf_bus { const struct brcmf_bus_ops *ops; struct brcmf_bus_msgbuf *msgbuf; + + struct list_head list; }; /* diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 87aef211b35f..9a77b100abbb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -18,6 +18,7 @@ #include "core.h" #include "bus.h" +#include "fwvid.h" #include "debug.h" #include "fwil_types.h" #include "p2p.h" @@ -1335,6 +1336,12 @@ int brcmf_attach(struct device *dev) /* Link to bus module */ drvr->hdrlen = 0; + ret = brcmf_fwvid_attach(drvr); + if (ret != 0) { + bphy_err(drvr, "brcmf_fwvid_attach failed\n"); + goto fail; + } + /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); if (ret != 0) { @@ -1445,6 +1452,8 @@ void brcmf_detach(struct device *dev) brcmf_cfg80211_detach(drvr->config); drvr->config = NULL; } + + brcmf_fwvid_detach(drvr); } void brcmf_free(struct device *dev) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 340346c122d3..5d627b8dbb50 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -136,6 +136,8 @@ struct brcmf_pub { struct work_struct bus_reset; u8 clmver[BRCMF_DCMD_SMLEN]; + const struct brcmf_fwvid_ops *vops; + void *vdata; }; /* forward declarations */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c new file mode 100644 index 000000000000..654a31caa643 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "core.h" +#include "bus.h" +#include "debug.h" +#include "fwvid.h" + +#include "wcc/vops.h" + +struct brcmf_fwvid_entry { + bool enabled; + const char *name; + const struct brcmf_fwvid_ops *vops; + struct list_head drvr_list; +#ifdef CONFIG_BRCMFMAC_VENDOR_MODULES + struct module *vmod; + struct completion reg_done; +#endif +}; + +static DEFINE_MUTEX(fwvid_list_lock); + +#ifdef CONFIG_BRCMFMAC_VENDOR_MODULES +#define FWVID_ENTRY_INIT(_vid, _name) \ + [BRCMF_FWVENDOR_ ## _vid] = { \ + .enabled = IS_ENABLED(CONFIG_BRCMFMAC_VENDOR_ ## _vid), \ + .name = #_name, \ + .reg_done = COMPLETION_INITIALIZER(fwvid_list[BRCMF_FWVENDOR_ ## _vid].reg_done), \ + .drvr_list = LIST_HEAD_INIT(fwvid_list[BRCMF_FWVENDOR_ ## _vid].drvr_list), \ + } +#else +#define FWVID_ENTRY_INIT(_vid, _name) \ + [BRCMF_FWVENDOR_ ## _vid] = { \ + .enabled = IS_ENABLED(CONFIG_BRCMFMAC_VENDOR_ ## _vid), \ + .name = #_name, \ + .drvr_list = LIST_HEAD_INIT(fwvid_list[BRCMF_FWVENDOR_ ## _vid].drvr_list), \ + .vops = _vid ## _VOPS \ + } +#endif /* CONFIG_BRCMFMAC_VENDOR_MODULES */ + +static struct brcmf_fwvid_entry fwvid_list[BRCMF_FWVENDOR_NUM] = { + FWVID_ENTRY_INIT(WCC, wcc), +}; + +#ifdef CONFIG_BRCMFMAC_VENDOR_MODULES +static int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid) +{ + int ret; + + if (!fwvid_list[fwvid].vmod) { + struct completion *reg_done = &fwvid_list[fwvid].reg_done; + + mutex_unlock(&fwvid_list_lock); + + ret = request_module("brcmfmac-%s", fwvid_list[fwvid].name); + if (ret) + goto fail; + + ret = wait_for_completion_interruptible(reg_done); + if (ret) + goto fail; + + mutex_lock(&fwvid_list_lock); + } + return 0; + +fail: + brcmf_err("mod=%s: failed %d\n", fwvid_list[fwvid].name, ret); + return ret; +} + +int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod, + const struct brcmf_fwvid_ops *vops) +{ + if (fwvid >= BRCMF_FWVENDOR_NUM) + return -ERANGE; + + if (WARN_ON(!vmod) || WARN_ON(!vops) || + WARN_ON(!vops->attach) || WARN_ON(!vops->detach)) + return -EINVAL; + + if (WARN_ON(fwvid_list[fwvid].vmod)) + return -EEXIST; + + brcmf_dbg(TRACE, "mod=%s: enter\n", fwvid_list[fwvid].name); + + mutex_lock(&fwvid_list_lock); + + fwvid_list[fwvid].vmod = vmod; + fwvid_list[fwvid].vops = vops; + + mutex_unlock(&fwvid_list_lock); + + complete_all(&fwvid_list[fwvid].reg_done); + + return 0; +} +EXPORT_SYMBOL(brcmf_fwvid_register_vendor); + +int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod) +{ + struct brcmf_bus *bus, *tmp; + + if (fwvid >= BRCMF_FWVENDOR_NUM) + return -ERANGE; + + if (WARN_ON(fwvid_list[fwvid].vmod != mod)) + return -ENOENT; + + mutex_lock(&fwvid_list_lock); + + list_for_each_entry_safe(bus, tmp, &fwvid_list[fwvid].drvr_list, list) { + mutex_unlock(&fwvid_list_lock); + + brcmf_dbg(INFO, "mod=%s: removing %s\n", fwvid_list[fwvid].name, + dev_name(bus->dev)); + brcmf_bus_remove(bus); + + mutex_lock(&fwvid_list_lock); + } + + fwvid_list[fwvid].vmod = NULL; + fwvid_list[fwvid].vops = NULL; + reinit_completion(&fwvid_list[fwvid].reg_done); + + brcmf_dbg(TRACE, "mod=%s: exit\n", fwvid_list[fwvid].name); + mutex_unlock(&fwvid_list_lock); + + return 0; +} +EXPORT_SYMBOL(brcmf_fwvid_unregister_vendor); +#else +static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid) +{ + return 0; +} +#endif + +int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr) +{ + enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid; + int ret; + + if (fwvid >= ARRAY_SIZE(fwvid_list)) + return -ERANGE; + + if (!fwvid_list[fwvid].enabled) + return -EPROTONOSUPPORT; + + brcmf_dbg(TRACE, "mod=%s: enter: dev %s\n", fwvid_list[fwvid].name, + dev_name(drvr->bus_if->dev)); + + mutex_lock(&fwvid_list_lock); + + ret = brcmf_fwvid_request_module(fwvid); + if (ret) + return ret; + + drvr->vops = fwvid_list[fwvid].vops; + list_add(&drvr->bus_if->list, &fwvid_list[fwvid].drvr_list); + + mutex_unlock(&fwvid_list_lock); + + return ret; +} + +void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr) +{ + enum brcmf_fwvendor fwvid = drvr->bus_if->fwvid; + + if (fwvid >= ARRAY_SIZE(fwvid_list)) + return; + + brcmf_dbg(TRACE, "mod=%s: enter: dev %s\n", fwvid_list[fwvid].name, + dev_name(drvr->bus_if->dev)); + + mutex_lock(&fwvid_list_lock); + + drvr->vops = NULL; + list_del(&drvr->bus_if->list); + + mutex_unlock(&fwvid_list_lock); +} diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h new file mode 100644 index 000000000000..cc79df8cc428 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#ifndef FWVID_H_ +#define FWVID_H_ + +#include "firmware.h" + +struct brcmf_pub; + +struct brcmf_fwvid_ops { + int (*attach)(struct brcmf_pub *drvr); + void (*detach)(struct brcmf_pub *drvr); +}; + +/* exported functions */ +int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod, + const struct brcmf_fwvid_ops *ops); +int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod); + +/* core driver functions */ +int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr); +void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr); + +static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr) +{ + int ret; + + ret = brcmf_fwvid_attach_ops(drvr); + if (ret) + return ret; + + return drvr->vops->attach(drvr); +} + +static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr) +{ + if (!drvr->vops) + return; + + drvr->vops->detach(drvr); + brcmf_fwvid_detach_ops(drvr); +} + +#endif /* FWVID_H_ */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/Makefile new file mode 100644 index 000000000000..7f455a19a2b1 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/Makefile @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2022 Broadcom Corporation + +ccflags-y += \ + -I $(srctree)/$(src) \ + -I $(srctree)/$(src)/.. \ + -I $(srctree)/$(src)/../../include + +obj-m += brcmfmac-wcc.o +brcmfmac-wcc-objs += \ + core.o module.o diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c new file mode 100644 index 000000000000..02de99818efa --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/core.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include +#include + +#include "vops.h" + +static int brcmf_wcc_attach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); + return 0; +} + +static void brcmf_wcc_detach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); +} + +const struct brcmf_fwvid_ops brcmf_wcc_ops = { + .attach = brcmf_wcc_attach, + .detach = brcmf_wcc_detach, +}; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c new file mode 100644 index 000000000000..23e3a4557880 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include + +#include "vops.h" + +static int __init brcmf_wcc_init(void) +{ + return brcmf_fwvid_register_vendor(BRCMF_FWVENDOR_WCC, THIS_MODULE, + &brcmf_wcc_ops); +} + +static void __exit brcmf_wcc_exit(void) +{ + brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_WCC, THIS_MODULE); +} + +MODULE_LICENSE("Dual BSD/GPL"); + +module_init(brcmf_wcc_init); +module_exit(brcmf_wcc_exit); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/vops.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/vops.h new file mode 100644 index 000000000000..a836954334e5 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/vops.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#ifndef _BRCMFMAC_WCC_VOPS_H +#define _BRCMFMAC_WCC_VOPS_H + +#ifdef CONFIG_BRCMFMAC_VENDOR_WCC +extern const struct brcmf_fwvid_ops brcmf_wcc_ops; +#define WCC_VOPS (&brcmf_wcc_ops) +#else +#define WCC_VOPS (NULL) +#endif /* CONFIG_BRCMFMAC_VENDOR_WCC */ + +#endif /* _BRCMFMAC_WCC_VOPS_H */ From patchwork Mon Jun 13 09:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A3A8CCA47B for ; Mon, 13 Jun 2022 09:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240729AbiFMJTh (ORCPT ); Mon, 13 Jun 2022 05:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240687AbiFMJTa (ORCPT ); Mon, 13 Jun 2022 05:19:30 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10654167D0 for ; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id b8so6209269edj.11 for ; Mon, 13 Jun 2022 02:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=AoyhwOdBuFeoX2d5q11RC9zfYPFePR0tB/zW7SrbQXE=; b=BgzL+qeXUyX+K/8rT0nEdeK4dcEfs4b0lZM0CFimwMjkXPzGfJniqFidh29EeNjv9P HuTG3uH1KTrzTvO6S0BU/77jC0ZlucnfcRPr2jlBrKL4X3qIvPPqUdKeipEUbkmiR+0p pm+x8c/XSO0mH7vz0ld8di6oxQnkdvqJnvOhLgSGEbGXp95HgH9GCo7PfVVMy4D8hX9j LySROsEXHcb7uZsm83clqui+RmPot2y5Po7meQ/ANm/CCr24IfYfpEa+aHYTa7XAUOz6 2lpMYkOuRuMzsABUM9Abnc/y3yE6tkBIY9WJgXPgv/ueF8KYvx259Jt0/be6kQeME8Cj LXrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=AoyhwOdBuFeoX2d5q11RC9zfYPFePR0tB/zW7SrbQXE=; b=pEdEsEUk2Bwb79VhVKt70J+j1SE2Ii1cMvrL4uqwPF+zg7DtxT5XxOOgD15f3nsAOy RU4EcPiqiMXxhEvLFN9y+8NqFs+MAJNKte/nlXHKLsn82v31dC9VQqIX7qYyWlgaQFwP 4+98c8LVt9kAMUX9Gwqs5VNHJ14LWE603Gk7+Q/FoNKaAtEKCGCmByYtL9Qe5ISPO2Bm PfC+oDx9R2YgGPsSu3d0g2ClEtzvegytR8a5G+Vpi8/YJJhadFJlgeJLCVsanljSxEs7 PvLSXIXR2JG2y0YaWoXZ6L5g92lB+vd3P0Z5BTgf4gb1m6ezIAp+kc2qw1JtvcImNehX sbsA== X-Gm-Message-State: AOAM532xLq6EZCVDSP/U0WGnd4d5z4OBiyo5fAVlbB+GPj2g9SgGqEeG j3zWpRN1gm11bU7924yONNdKOanV5vQPkg2dB1PnbDWpolA= X-Google-Smtp-Source: ABdhPJwDWvGlI9p8IRmDTXgKJQ2TOgVG3UnfuP0fdfmvQGmGkcYVwtERuoKNSi7EDuX/P8DwQToyNOomahS9mK/Yvt0= MIME-Version: 1.0 X-Received: by 2002:aa7:d989:0:b0:431:75d5:f204 with SMTP id u9-20020aa7d989000000b0043175d5f204mr37709138eds.230.1655111967490; Mon, 13 Jun 2022 02:19:27 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:26 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:26 -0400 Message-ID: Subject: [PATCH 4/7] brcmfmac: add support for Cypress firmware api To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Cypress uses the brcmfmac driver and releases firmware which will likely diverge over time. So adding support for handling that. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/Kconfig | 7 +++ .../broadcom/brcm80211/brcmfmac/Makefile | 2 + .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 46 +++++++++---------- .../broadcom/brcm80211/brcmfmac/bus.h | 1 + .../broadcom/brcm80211/brcmfmac/cyw/Makefile | 12 +++++ .../broadcom/brcm80211/brcmfmac/cyw/core.c | 27 +++++++++++ .../broadcom/brcm80211/brcmfmac/cyw/module.c | 26 +++++++++++ .../broadcom/brcm80211/brcmfmac/cyw/vops.h | 15 ++++++ .../broadcom/brcm80211/brcmfmac/fwvid.c | 2 + 9 files changed, 115 insertions(+), 23 deletions(-) create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/Makefile create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/vops.h diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig index 32c2f6e42a3e..60b6e218306b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig @@ -24,6 +24,13 @@ config BRCMFMAC_VENDOR_WCC This option will allow the driver to communicate with devices shipped by Broadcom WCC division. +config BRCMFMAC_VENDOR_CYW + bool "Cypress Wireless" + depends on BRCMFMAC + help + This option will allow the driver to communicate with devices + shipped by Cypress. + config BRCMFMAC_PROTO_BCDC bool diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile index 08dbafdb6527..1c481477c28a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile @@ -51,6 +51,8 @@ brcmfmac-$(CONFIG_DMI) += \ ifeq ($(CONFIG_BRCMFMAC_VENDOR_MODULES),) brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/core.o +brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_CYW) += cyw/core.o else obj-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/ +obj-$(CONFIG_BRCMFMAC_VENDOR_CYW) += cyw/ endif diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 5ec56567dab6..16e49291ffcc 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -967,35 +967,35 @@ int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev) return ret; } -#define BRCMF_SDIO_DEVICE(dev_id) \ +#define BRCMF_SDIO_DEVICE(dev_id, fw_vend) \ { \ SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, dev_id), \ - .driver_data = BRCMF_FWVENDOR_WCC \ + .driver_data = BRCMF_FWVENDOR_ ## fw_vend \ } /* devices we support, null terminated */ static const struct sdio_device_id brcmf_sdmmc_ids[] = { - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43143), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43241), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4329), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4330), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4334), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43455), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4359), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43143, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43241, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4329, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4330, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4334, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43455, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4359, WCC), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373, CYW), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012, CYW), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752, CYW), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359, CYW), { /* end: all zeroes */ } }; MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index a2759171fcc9..e114c65a75d7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -25,6 +25,7 @@ enum brcmf_fwvendor { BRCMF_FWVENDOR_WCC, + BRCMF_FWVENDOR_CYW, /* keep last */ BRCMF_FWVENDOR_NUM, BRCMF_FWVENDOR_INVALID diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/Makefile new file mode 100644 index 000000000000..5e1fddaff79e --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/Makefile @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2022 Broadcom Corporation + +ccflags-y += \ + -I $(srctree)/$(src) \ + -I $(srctree)/$(src)/.. \ + -I $(srctree)/$(src)/../../include + +obj-m += brcmfmac-cyw.o +brcmfmac-cyw-objs += \ + core.o module.o diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c new file mode 100644 index 000000000000..b75652ba9359 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include +#include + +#include "vops.h" + +static int brcmf_cyw_attach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); + return 0; +} + +static void brcmf_cyw_detach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); +} + +const struct brcmf_fwvid_ops brcmf_cyw_ops = { + .attach = brcmf_cyw_attach, + .detach = brcmf_cyw_detach, +}; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c new file mode 100644 index 000000000000..34294724a1f8 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include + +#include "vops.h" + +static int __init brcmf_cyw_init(void) +{ + return brcmf_fwvid_register_vendor(BRCMF_FWVENDOR_CYW, THIS_MODULE, + &brcmf_cyw_ops); +} + +static void __exit brcmf_cyw_exit(void) +{ + brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_CYW, THIS_MODULE); +} + +MODULE_LICENSE("Dual BSD/GPL"); + +module_init(brcmf_cyw_init); +module_exit(brcmf_cyw_exit); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/vops.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/vops.h new file mode 100644 index 000000000000..cc158b24f782 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/vops.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#ifndef _BRCMFMAC_CYW_VOPS_H +#define _BRCMFMAC_CYW_VOPS_H + +#ifdef CONFIG_BRCMFMAC_VENDOR_CYW +extern const struct brcmf_fwvid_ops brcmf_cyw_ops; +#define CYW_VOPS (&brcmf_cyw_ops) +#else +#define CYW_VOPS (NULL) +#endif /* CONFIG_BRCMFMAC_VENDOR_CYW */ + +#endif /* _BRCMFMAC_CYW_VOPS_H */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c index 654a31caa643..e6b8bbb99c88 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c @@ -19,6 +19,7 @@ #include "fwvid.h" #include "wcc/vops.h" +#include "cyw/vops.h" struct brcmf_fwvid_entry { bool enabled; @@ -53,6 +54,7 @@ static DEFINE_MUTEX(fwvid_list_lock); static struct brcmf_fwvid_entry fwvid_list[BRCMF_FWVENDOR_NUM] = { FWVID_ENTRY_INIT(WCC, wcc), + FWVID_ENTRY_INIT(CYW, cyw), }; #ifdef CONFIG_BRCMFMAC_VENDOR_MODULES From patchwork Mon Jun 13 09:19:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581948 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5D79C43334 for ; Mon, 13 Jun 2022 09:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240716AbiFMJTi (ORCPT ); Mon, 13 Jun 2022 05:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240698AbiFMJTb (ORCPT ); Mon, 13 Jun 2022 05:19:31 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD92418E09 for ; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id g25so9906651ejh.9 for ; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=DMDAVT8+jSFRKW4nLUODpSb57j4Ye9kohAIn+1/vORY=; b=Rdeca3GpJHuL9E6SeY1SsscXBPbmfdFEE0zHgjWvolWdH8jvQyXZ6bibiaIEu9ET3L 8dixfWXrkndQLvYOXkq3o4J2BqvMK58UjaX1PrZxHMFVaqGlyhmlI6mE9kTFmEkvr6ER oZzvwTBO1uzzm10A9UmHJD23pYi031Ex0lh8XmbBMFezp9goB989EjmHdDZtxLPXCi9f EumNq1HqE+p5+TYLSw4pkvOh2kI6isUIevROMQvPl0NCfY4j4EY0swWxlx4PUZQpvG3p BolklddVoieWHt0aXhK9JOHhkz+gX3eWQtnG+nrjCwuSmKNJhGVcuN8wOedVufcFEOIQ V86A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=DMDAVT8+jSFRKW4nLUODpSb57j4Ye9kohAIn+1/vORY=; b=SgUUmfBN2DXcD9k4qEE54aztr+C2SJDiexLKfsClsZUnN1EfNlZrdo5GQeidfazVxh uN2+hwYd7gzU+6HejRrq0aJCU02di7IraYc+waX4RT2sO3uLGK1JLKYAnL/fMjEFiBd9 d/Fw+5QfIsHN4jlOp/ILtfnj7/0hNRHThf/brmpvxaHH12E9/aZcjIW0VgqMSVrQ9Hnk WXSUKlQ4rsr+zAN3fwfKdRYDQ0pW3i1nybMqUQOmvmk/I5M928teKcvoMi7tnIgTfLZu 4t0USAURjX+JHxE515K+6v4AtTu2VkHJB9l35KqLecLaONgpCegD4Z8sWlrhk59xfLfb IRAQ== X-Gm-Message-State: AOAM533ZIHKmgEUNfKGOkWpMtTUMOcvzjdBInWJl0a2j7gIheh2G+7VT jWYvrbIXyM3zgrRVWtuwlo6rclF/mwoo36iSEYo= X-Google-Smtp-Source: ABdhPJxQx8fYGgnH78GRRoTaLEVs5OXnY3od6EJgAiLp2ElzXiR4PWfqr4qAuYsimHH8nJC9J//WsKg05LGBpVtwIGE= MIME-Version: 1.0 X-Received: by 2002:a17:907:9704:b0:711:f441:dbe6 with SMTP id jg4-20020a170907970400b00711f441dbe6mr23579370ejc.26.1655111968495; Mon, 13 Jun 2022 02:19:28 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:28 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:28 -0400 Message-ID: Subject: [PATCH 5/7] brcmfmac: add support Broadcom BCA firmware api To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Broadcom BCA division develops its own firmware api and as such will likely diverge over time. Add support for handling this. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../broadcom/brcm80211/brcmfmac/Kconfig | 7 +++ .../broadcom/brcm80211/brcmfmac/Makefile | 2 + .../broadcom/brcm80211/brcmfmac/bca/Makefile | 12 +++++ .../broadcom/brcm80211/brcmfmac/bca/core.c | 27 ++++++++++ .../broadcom/brcm80211/brcmfmac/bca/module.c | 26 ++++++++++ .../broadcom/brcm80211/brcmfmac/bca/vops.h | 15 ++++++ .../broadcom/brcm80211/brcmfmac/bus.h | 1 + .../broadcom/brcm80211/brcmfmac/fwvid.c | 2 + .../broadcom/brcm80211/brcmfmac/pcie.c | 52 +++++++++---------- 9 files changed, 118 insertions(+), 26 deletions(-) create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/Makefile create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/vops.h diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig index 60b6e218306b..19c7d88766bb 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig @@ -31,6 +31,13 @@ config BRCMFMAC_VENDOR_CYW This option will allow the driver to communicate with devices shipped by Cypress. +config BRCMFMAC_VENDOR_BCA + bool "Broadcom BCA" + depends on BRCMFMAC + help + This option will allow the driver to communicate with devices + shipped by Broadcom BCA division. + config BRCMFMAC_PROTO_BCDC bool diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile index 1c481477c28a..a403c5cde618 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile @@ -52,7 +52,9 @@ brcmfmac-$(CONFIG_DMI) += \ ifeq ($(CONFIG_BRCMFMAC_VENDOR_MODULES),) brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/core.o brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_CYW) += cyw/core.o +brcmfmac-$(CONFIG_BRCMFMAC_VENDOR_BCA) += bca/core.o else obj-$(CONFIG_BRCMFMAC_VENDOR_WCC) += wcc/ obj-$(CONFIG_BRCMFMAC_VENDOR_CYW) += cyw/ +obj-$(CONFIG_BRCMFMAC_VENDOR_BCA) += bca/ endif diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/Makefile new file mode 100644 index 000000000000..46098705e236 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/Makefile @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: ISC +# +# Copyright (c) 2022 Broadcom Corporation + +ccflags-y += \ + -I $(srctree)/$(src) \ + -I $(srctree)/$(src)/.. \ + -I $(srctree)/$(src)/../../include + +obj-m += brcmfmac-bca.o +brcmfmac-bca-objs += \ + core.o module.o diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c new file mode 100644 index 000000000000..ac3a36fa3640 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/core.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include +#include + +#include "vops.h" + +static int brcmf_bca_attach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); + return 0; +} + +static void brcmf_bca_detach(struct brcmf_pub *drvr) +{ + pr_err("%s: executing\n", __func__); +} + +const struct brcmf_fwvid_ops brcmf_bca_ops = { + .attach = brcmf_bca_attach, + .detach = brcmf_bca_detach, +}; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c new file mode 100644 index 000000000000..790116a735c7 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#include +#include +#include +#include + +#include "vops.h" + +static int __init brcmf_bca_init(void) +{ + return brcmf_fwvid_register_vendor(BRCMF_FWVENDOR_BCA, THIS_MODULE, + &brcmf_bca_ops); +} + +static void __exit brcmf_bca_exit(void) +{ + brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_BCA, THIS_MODULE); +} + +MODULE_LICENSE("Dual BSD/GPL"); + +module_init(brcmf_bca_init); +module_exit(brcmf_bca_exit); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/vops.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/vops.h new file mode 100644 index 000000000000..1df4c5f9b4f6 --- /dev/null +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/vops.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: ISC +/* + * Copyright (c) 2022 Broadcom Corporation + */ +#ifndef _BRCMFMAC_BCA_VOPS_H +#define _BRCMFMAC_BCA_VOPS_H + +#ifdef CONFIG_BRCMFMAC_VENDOR_BCA +extern const struct brcmf_fwvid_ops brcmf_bca_ops; +#define BCA_VOPS (&brcmf_bca_ops) +#else +#define BCA_VOPS (NULL) +#endif /* CONFIG_BRCMFMAC_VENDOR_BCA */ + +#endif /* _BRCMFMAC_BCA_VOPS_H */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h index e114c65a75d7..c4a6dd2ec617 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h @@ -26,6 +26,7 @@ enum brcmf_fwvendor { BRCMF_FWVENDOR_WCC, BRCMF_FWVENDOR_CYW, + BRCMF_FWVENDOR_BCA, /* keep last */ BRCMF_FWVENDOR_NUM, BRCMF_FWVENDOR_INVALID diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c index e6b8bbb99c88..919c60172e08 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c @@ -20,6 +20,7 @@ #include "wcc/vops.h" #include "cyw/vops.h" +#include "bca/vops.h" struct brcmf_fwvid_entry { bool enabled; @@ -55,6 +56,7 @@ static DEFINE_MUTEX(fwvid_list_lock); static struct brcmf_fwvid_entry fwvid_list[BRCMF_FWVENDOR_NUM] = { FWVID_ENTRY_INIT(WCC, wcc), FWVID_ENTRY_INIT(CYW, cyw), + FWVID_ENTRY_INIT(BCA, bca), }; #ifdef CONFIG_BRCMFMAC_VENDOR_MODULES diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 0599dad96018..68fd191aaae1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -2077,44 +2077,44 @@ static const struct dev_pm_ops brcmf_pciedrvr_pm = { #endif /* CONFIG_PM */ -#define BRCMF_PCIE_DEVICE(dev_id) \ +#define BRCMF_PCIE_DEVICE(dev_id, fw_vend) \ { \ BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ PCI_ANY_ID, PCI_ANY_ID, \ PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ - BRCMF_FWVENDOR_WCC \ + BRCMF_FWVENDOR_ ## fw_vend \ } -#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) \ +#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev, fw_vend) \ { \ BRCM_PCIE_VENDOR_ID_BROADCOM, (dev_id), \ (subvend), (subdev), \ PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, \ - BRCMF_FWVENDOR_WCC \ + BRCMF_FWVENDOR_ ## fw_vend \ } static const struct pci_device_id brcmf_pcie_devid_table[] = { - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), - BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_RAW_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_RAW_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4359_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID), - BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID), - BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_RAW_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_RAW_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4359_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID, WCC), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID, BCA), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID, WCC), { /* end: all zeroes */ } }; From patchwork Mon Jun 13 09:19:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00806CCA47E for ; Mon, 13 Jun 2022 09:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240724AbiFMJTh (ORCPT ); Mon, 13 Jun 2022 05:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240691AbiFMJTa (ORCPT ); Mon, 13 Jun 2022 05:19:30 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5CA018B3B for ; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id m20so9890192ejj.10 for ; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=PeoD4vyIixsMwk5bCIFYVtHST011T3bAxZA3o7iE4JM=; b=YOzUjEkjkIPfAY0MZs1VE0tYXcPXIhimJfw9LIxPIs58H+TSuBKX4hwEbjSeqafUCZ kAsNypAuYv9rPG0rNTH7u16kURPHAWsy85bgi31K6/SyM+zwzkYgJyWOg6kmBonQsjmP 1GnVGhcLPTmBdV7xVENXiUmltdVJcF9NYIhDge0LOW7S0dRVUNQYb4j0ypJNqP/5JnLn edHoRWSNoqSKBeKKMJFYgG7eXxiRmO/8Oem8YLesjTVmY6QxpaYApQvd3buI0bL7WtxO bE4b4w/DzfbI4++WVISfpCGZ5BWRnTQ7KFCdof24ad340EHXdibQOInhnpeF+jrn3sUu efqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=PeoD4vyIixsMwk5bCIFYVtHST011T3bAxZA3o7iE4JM=; b=bFssKNqWd5Oi3uc8TINhILeFueckxHSFPJ4PveVn6na+Zz12MFEy/R2lxBc82XXlA6 YOZQ/WUTeZa06q4AQZyTQmgrR6z7/1eszj+q8/is145Z5+iEESsIKDB29IrNtuilm6SS Qb4MUAlZNXPMWRTRrd40yzSSBDx4nwQPiMKg7TGH3m42qprW8o12N/1o6hHS0gV4FJ0j r+gyS6wmlco3zz4imSCy/yyqZ8w+MWPccZm0/jtmppw8jnKDSrCIcAxVX6HnDQlc3Yn4 YCaTbxZlpbl1p5PterTIStAQnosP45po5upN4yj+qUVYQoPehX+63+DJCm0Q5NNbNQBt dWBQ== X-Gm-Message-State: AOAM532j5GVoBjP8EldfmhIXAApPRehG2mLERDYt3J0OQ3/hvWbrt6g5 Gi/vEy84j4OFIxH+TPbMv1hA1XofyovCNAq48Bg= X-Google-Smtp-Source: ABdhPJzj3eonjaTeC9L/nS5m6qwjuC5DsinSrvKcWOnf3g6JFMWPEpj4RV1qXwzRroJmHS9JiyxUIInYkReVJznNpKY= MIME-Version: 1.0 X-Received: by 2002:a17:907:8a1f:b0:711:da32:8410 with SMTP id sc31-20020a1709078a1f00b00711da328410mr33562574ejc.298.1655111969400; Mon, 13 Jun 2022 02:19:29 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:28 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:28 -0400 Message-ID: Subject: [PATCH 6/7] brcmfmac: add vendor name in revinfo debugfs file To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Upon probe the driver determines the vendor supporting the device. Expose this information in the revinfo debugfs file. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c | 5 +++++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 9a77b100abbb..c2b3525f7103 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -1139,7 +1139,8 @@ static int brcmf_revinfo_read(struct seq_file *s, void *data) seq_printf(s, "vendorid: 0x%04x\n", ri->vendorid); seq_printf(s, "deviceid: 0x%04x\n", ri->deviceid); seq_printf(s, "radiorev: %s\n", brcmu_dotrev_str(ri->radiorev, drev)); - seq_printf(s, "chip: %s\n", ri->chipname); + seq_printf(s, "chip: %s (%s)\n", ri->chipname, + brcmf_fwvid_vendor_name(bus_if->drvr)); seq_printf(s, "chippkg: %u\n", ri->chippkg); seq_printf(s, "corerev: %u\n", ri->corerev); seq_printf(s, "boardid: 0x%04x\n", ri->boardid); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c index 919c60172e08..d0ba2aba093b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c @@ -198,3 +198,8 @@ void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr) mutex_unlock(&fwvid_list_lock); } + +const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr) +{ + return fwvid_list[drvr->bus_if->fwvid].name; +} diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h index cc79df8cc428..8344d473a549 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.h @@ -22,6 +22,7 @@ int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod) /* core driver functions */ int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr); void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr); +const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr); static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr) From patchwork Mon Jun 13 09:19:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend Van Spriel X-Patchwork-Id: 581629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5409BCCA47B for ; Mon, 13 Jun 2022 09:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239158AbiFMJTj (ORCPT ); Mon, 13 Jun 2022 05:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240680AbiFMJTb (ORCPT ); Mon, 13 Jun 2022 05:19:31 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD21F14D14 for ; Mon, 13 Jun 2022 02:19:30 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id d14so6208215eda.12 for ; Mon, 13 Jun 2022 02:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:in-reply-to:references:date:message-id:subject:to :cc; bh=OHBXs0DbY77ATKoHUGkTyqnhfdtuttsxGgPkMN1OQUc=; b=SOpniUvrIwzr3EsUmruKb70w1NZ0wsgcN7oliL4cEsnv3MbBrSzVH724MpxdpLdFw3 9GZbrLFxEnFQ6pXRkdS4VNo06PN3MKwfAyZ0QOEMb4GkY8wvc+W91+wD4pUAZqEfW5IB zsXZeJ5A34ALvS4ehJPUR8PEYMScXG7hjUOzEIdWGQR3VxzL7TVh1NksxM2ZLGD4Henn 9hegXMo1GOlDVvJ0+2is7eUzurudkA3+ZpYW5+TuB0PV+84+iXVj4Ri5mb4u+nHmILPu BqADSvwtIObfDkE+T6RLeqPd34m3KfZCSw282bw3i2W47XW9w6h34iOI9TPs0tWaiLR0 1KNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:in-reply-to:references:date :message-id:subject:to:cc; bh=OHBXs0DbY77ATKoHUGkTyqnhfdtuttsxGgPkMN1OQUc=; b=msGFhqP+NpsEuazGCfJxZlxIJ2mVlnVmpLoK2Le/pK78K7TTTuzmuqDJba4a60JXLc ZOftU8eIGAdAsf8LUTaZzWU5251Vq6bRbskHklbiWr4m1MjzqkF3HSEcPYz+idlNuY0l OBiSBqZ7Fxx6PyDMjWfiWkejmLVxaVSVMwySC8g6S6c+pSERJJyIeUErosjBl1hoJVYr LTCPTUkC89oyZoFUnYYt6EVMQD4XCLlKTUhj/aOBuPtukfqw6s2qi3EOj6vJkUgoeS/N hfDWGcbrrdO4zcoYy7tPuRxShqD9T8bf+fyU7VzCOOWoWHhiJxw+YNAzZqYNUXXqZnXw 0BWQ== X-Gm-Message-State: AOAM532+0n+rtxqpBsspgKw1LBrYu1HUFgmOjojb8b7tb8ILqKf622Aq EAvv+ltZfCzBdelE6TppEmDdUk+yIfO6Oj34F0w= X-Google-Smtp-Source: ABdhPJx4xn566r0x4dkv4J/CjL0s+WbrGpg3vsHyoCzJ0+w/7ZHtuTqzWa+CaT3jqynibVoAP0DJ85FEWir3IWEOEC0= MIME-Version: 1.0 X-Received: by 2002:a05:6402:1d51:b0:41f:cf6c:35a5 with SMTP id dz17-20020a0564021d5100b0041fcf6c35a5mr64939661edb.25.1655111970315; Mon, 13 Jun 2022 02:19:30 -0700 (PDT) Received: from 35650733073 named unknown by gmailapi.google.com with HTTPREST; Mon, 13 Jun 2022 05:19:29 -0400 From: aspriel@gmail.com X-Mailer: git-send-email 2.12.2 In-Reply-To: <20220613091915.18884-1-arend.vanspriel@broadcom.com> References: <20220613091915.18884-1-arend.vanspriel@broadcom.com> Date: Mon, 13 Jun 2022 05:19:29 -0400 Message-ID: Subject: [PATCH 7/7] brcmfmac: introduce BRCMFMAC exported symbols namespace To: Kalle Valo , arend.vanspriel@broadcom.com Cc: linux-wireless@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Instead of using EXPORT_SYMBOL() use namespace variant and only if build vendor-specific code as separate module. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c | 1 + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 6 ++++++ .../net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c | 1 + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c | 4 ++-- .../net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c index 790116a735c7..d55f3271d619 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c @@ -21,6 +21,7 @@ static void __exit brcmf_bca_exit(void) } MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(BRCMFMAC); module_init(brcmf_bca_init); module_exit(brcmf_bca_exit); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h index 5d627b8dbb50..8cafe59c089d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h @@ -13,6 +13,12 @@ #include #include "fweh.h" +#if IS_ENABLED(CONFIG_BRCMFMAC_VENDOR_MODULES) +#define BRCMF_EXPORT_SYMBOL_GPL(__sym) EXPORT_SYMBOL_NS_GPL(__sym, BRCMFMAC) +#else +#define BRCMF_EXPORT_SYMBOL(__sym) +#endif + #define TOE_TX_CSUM_OL 0x00000001 #define TOE_RX_CSUM_OL 0x00000002 diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c index 34294724a1f8..f82fbbe3ecef 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c @@ -21,6 +21,7 @@ static void __exit brcmf_cyw_exit(void) } MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(BRCMFMAC); module_init(brcmf_cyw_init); module_exit(brcmf_cyw_exit); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c index d0ba2aba093b..be72203f4e0b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c @@ -112,7 +112,7 @@ int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod, return 0; } -EXPORT_SYMBOL(brcmf_fwvid_register_vendor); +BRCMF_EXPORT_SYMBOL_GPL(brcmf_fwvid_register_vendor); int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod) { @@ -145,7 +145,7 @@ int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod) return 0; } -EXPORT_SYMBOL(brcmf_fwvid_unregister_vendor); +BRCMF_EXPORT_SYMBOL_GPL(brcmf_fwvid_unregister_vendor); #else static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid) { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c index 23e3a4557880..02918d434556 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c @@ -21,6 +21,7 @@ static void __exit brcmf_wcc_exit(void) } MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(BRCMFMAC); module_init(brcmf_wcc_init); module_exit(brcmf_wcc_exit);