Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp279280iog; Mon, 13 Jun 2022 02:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxIRWpCmaq72ym5gO4rERQjB2gW914Ra2PekJ/8sH4CjQZOi4UlHMtgRXTmlAAXjuO/TIq X-Received: by 2002:a05:6402:5212:b0:42e:2fa:41a7 with SMTP id s18-20020a056402521200b0042e02fa41a7mr63510626edd.22.1655112570971; Mon, 13 Jun 2022 02:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655112570; cv=none; d=google.com; s=arc-20160816; b=Wfds3hS/ttzwsZffWJqhhLooJpIjBWDV04Sus0+zmnCGGdTLzhzXrtjZQtg4gTFRdz Klrx6O6c1apwDedL1A8tB1yZ3tkhxgAQwqFAf1URI7o7NzcYaVMIE3UKOdC2Ydhh7rea 91WexJ5Fa16Kv4yWbIPPUuxpcwGqyGxE2t17LeCM9kf8Rz+YzEnpoc0fsQyX12oxaql8 oeFXW7AtdOce5CuUPHi6/cb4tje2M0MwIu9ko2TRHkDUbcUsCA1rufESu0EAFLwVTI0F W8gUitiDgg2735aV2A2H1jn49lOeon+01onFppdAjaUoeb7tUMGRQLyl/PYz2pURithv 88fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:references :in-reply-to:from:mime-version:dkim-signature; bh=DMDAVT8+jSFRKW4nLUODpSb57j4Ye9kohAIn+1/vORY=; b=TrUXznAXbcmasBLAy/oS+IG4uih+hyhcInCzjOyT4DBwz32sw1uKfT8cH707b+UhHB 6gzdcsQhgH6RNPSKVRysoGm/RGr62hkTtNZQaZxC7yyL+JIJbrAMyY7Z+BY6/Yzthxqc puovGN3aafcfTakzO1SxD30xqTR9bTiwyMMGhUXA/I6z4xVhkAC55N9UUY+hCHrL3Qe8 OavowZkvT3mXQxATtaWLYA/7A+mOLWVwnQ3WtYFJztMcd/F7rj3XJhn/3crQQwycg0zP DUSUA6OJ1d0sNR08au0dBYcn0TA5hcmvxzaU63/C9s2UTmobU2PM8s8LyIFcM2Oapaaj RALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rdeca3Gp; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw4-20020a170906478400b006fec8cb2debsi7784961ejc.854.2022.06.13.02.29.13; Mon, 13 Jun 2022 02:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rdeca3Gp; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240716AbiFMJTi (ORCPT + 65 others); 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= 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 */ } }; -- 2.32.0