[2/2] brcmfmac: Add PCIe ID of BCM4355 chip found on T2 Macs

Message ID B5647DBC-3D99-412F-BD04-071950D3CD48@live.com
State New
Headers
Series [1/2] brcmfmac: Use separate struct to declare firmware names for Apple OTP chips |

Commit Message

Aditya Garg Jan. 2, 2023, 2:41 p.m. UTC
  From: Aditya Garg <gargaditya08@live.com>

Commit 'dce45ded7619' added the BCM4355 chip support. This chip is also
found in MacBookAir8,1 and MacBookAir8,2. This patch adds necessary pcie
IDs to add support for the same.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c       | 4 ++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c       | 3 ++-
 drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)
  

Comments

Aditya Garg Jan. 2, 2023, 2:46 p.m. UTC | #1
> On 02-Jan-2023, at 8:10 PM, Aditya Garg <gargaditya08@live.com> wrote:
> 
> From: Aditya Garg <gargaditya08@live.com>
> 
> Commit 'dce45ded7619' added the BCM4355 chip support. This chip is also
> found in MacBookAir8,1 and MacBookAir8,2. This patch adds necessary pcie
> IDs to add support for the same.
> 
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c       | 4 ++--
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c       | 3 ++-
> drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 3 ++-
> 3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
> index 121893bba..2f338c5d9 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
> @@ -735,7 +735,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
> return 0x170000;
> case BRCM_CC_4378_CHIP_ID:
> return 0x352000;
> - case CY_CC_89459_CHIP_ID:
> + case BRCM_CC_4355_CHIP_ID:
> return ((ci->pub.chiprev < 9) ? 0x180000 : 0x160000);
> default:
> brcmf_err("unknown chip: %s\n", ci->pub.name);
> @@ -1427,7 +1427,7 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
> reg = chip->ops->read32(chip->ctx, addr);
> return reg != 0;
> case CY_CC_4373_CHIP_ID:
> - case CY_CC_89459_CHIP_ID:
> + case BRCM_CC_4355_CHIP_ID:
> /* explicitly check SR engine enable bit */
> addr = CORE_CC_REG(base, sr_control0);
> reg = chip->ops->read32(chip->ctx, addr);
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index ad7a780cd..0a7410196 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -78,6 +78,7 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
> BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C),
> BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350),
> BRCMF_FW_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C),
> + BRCMF_FW_ENTRY(BRCM_CC_4355_CHIP_ID, 0xFFFFFFFF, 4355)
Oops, forgot to add a comma here, sending a v2
> BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
> BRCMF_FW_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
> BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
> @@ -92,7 +93,6 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
> BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C),
> BRCMF_FW_ENTRY(BRCM_CC_43666_CHIP_ID, 0xFFFFFFF0, 4366C),
> BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
> - BRCMF_FW_ENTRY(CY_CC_89459_CHIP_ID, 0xFFFFFFFF, 4355),
> };
> 
> static const struct brcmf_firmware_mapping brcmf_pcie_otp_fwnames[] = {
> @@ -2599,6 +2599,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = {
> 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_4355_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),
> diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> index f4939cf62..fee1ff526 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> @@ -37,6 +37,7 @@
> #define BRCM_CC_4350_CHIP_ID 0x4350
> #define BRCM_CC_43525_CHIP_ID 43525
> #define BRCM_CC_4354_CHIP_ID 0x4354
> +#define BRCM_CC_4355_CHIP_ID 0x4355
> #define BRCM_CC_4356_CHIP_ID 0x4356
> #define BRCM_CC_43566_CHIP_ID 43566
> #define BRCM_CC_43567_CHIP_ID 43567
> @@ -56,7 +57,6 @@
> #define CY_CC_43012_CHIP_ID 43012
> #define CY_CC_43439_CHIP_ID 43439
> #define CY_CC_43752_CHIP_ID 43752
> -#define CY_CC_89459_CHIP_ID 0x4355
> 
> /* USB Device IDs */
> #define BRCM_USB_43143_DEVICE_ID 0xbd1e
> @@ -72,6 +72,7 @@
> #define BRCM_PCIE_4350_DEVICE_ID 0x43a3
> #define BRCM_PCIE_4354_DEVICE_ID 0x43df
> #define BRCM_PCIE_4354_RAW_DEVICE_ID 0x4354
> +#define BRCM_PCIE_4355_DEVICE_ID 0x43dc
> #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
> #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
> #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
> -- 
> 2.34.1
>
  
kernel test robot Jan. 3, 2023, 2:08 a.m. UTC | #2
Hi Aditya,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.2-rc2 next-20221226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aditya-Garg/brcmfmac-Add-PCIe-ID-of-BCM4355-chip-found-on-T2-Macs/20230102-234714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/B5647DBC-3D99-412F-BD04-071950D3CD48%40live.com
patch subject: [PATCH 2/2] brcmfmac: Add PCIe ID of BCM4355 chip found on T2 Macs
config: x86_64-allyesconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/960ea39e9583e9a433e6fc2ad30e919cc8cdcf0c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Aditya-Garg/brcmfmac-Add-PCIe-ID-of-BCM4355-chip-found-on-T2-Macs/20230102-234714
        git checkout 960ea39e9583e9a433e6fc2ad30e919cc8cdcf0c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/wireless/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:40:
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:45:9: error: expected '}' before '{' token
      45 |         { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME }
         |         ^
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:82:9: note: in expansion of macro 'BRCMF_FW_ENTRY'
      82 |         BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
         |         ^~~~~~~~~~~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:75:67: note: to match this '{'
      75 | static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
         |                                                                   ^
   In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:40:
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4371_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:63:1: note: in expansion of macro 'BRCMF_FW_DEF'
      63 | BRCMF_FW_DEF(4371, "brcmfmac4371-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4366B_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:61:1: note: in expansion of macro 'BRCMF_FW_DEF'
      61 | BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4365B_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:59:1: note: in expansion of macro 'BRCMF_FW_DEF'
      59 | BRCMF_FW_DEF(4365B, "brcmfmac4365b-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4364_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:58:1: note: in expansion of macro 'BRCMF_FW_DEF'
      58 | BRCMF_FW_DEF(4364, "brcmfmac4364-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4359_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:57:1: note: in expansion of macro 'BRCMF_FW_DEF'
      57 | BRCMF_FW_DEF(4359, "brcmfmac4359-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:33:19: warning: 'BRCM_4358_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      33 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:56:1: note: in expansion of macro 'BRCMF_FW_DEF'
      56 | BRCMF_FW_DEF(4358, "brcmfmac4358-pcie");
         | ^~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:39:19: warning: 'BRCM_43570_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      39 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:55:1: note: in expansion of macro 'BRCMF_FW_CLM_DEF'
      55 | BRCMF_FW_CLM_DEF(43570, "brcmfmac43570-pcie");
         | ^~~~~~~~~~~~~~~~
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:39:19: warning: 'BRCM_4356_FIRMWARE_BASENAME' defined but not used [-Wunused-const-variable=]
      39 | static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
         |                   ^~~~~
   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c:54:1: note: in expansion of macro 'BRCMF_FW_CLM_DEF'
      54 | BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-pcie");
         | ^~~~~~~~~~~~~~~~


vim +/BRCM_4371_FIRMWARE_BASENAME +33 drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h

46d703a775394e Hante Meuleman   2015-11-25  31  
41f573dbb534f1 Arend Van Spriel 2018-03-22  32  #define BRCMF_FW_DEF(fw_name, fw_base) \
41f573dbb534f1 Arend Van Spriel 2018-03-22 @33  static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
41f573dbb534f1 Arend Van Spriel 2018-03-22  34  	BRCMF_FW_DEFAULT_PATH fw_base; \
41f573dbb534f1 Arend Van Spriel 2018-03-22  35  MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin")
46d703a775394e Hante Meuleman   2015-11-25  36  
885f256f61f958 Matthias Brugger 2021-06-07  37  /* Firmware and Country Local Matrix files */
885f256f61f958 Matthias Brugger 2021-06-07  38  #define BRCMF_FW_CLM_DEF(fw_name, fw_base) \
885f256f61f958 Matthias Brugger 2021-06-07 @39  static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
885f256f61f958 Matthias Brugger 2021-06-07  40  	BRCMF_FW_DEFAULT_PATH fw_base; \
885f256f61f958 Matthias Brugger 2021-06-07  41  MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin"); \
885f256f61f958 Matthias Brugger 2021-06-07  42  MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".clm_blob")
885f256f61f958 Matthias Brugger 2021-06-07  43
  

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 121893bba..2f338c5d9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -735,7 +735,7 @@  static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
 		return 0x170000;
 	case BRCM_CC_4378_CHIP_ID:
 		return 0x352000;
-	case CY_CC_89459_CHIP_ID:
+	case BRCM_CC_4355_CHIP_ID:
 		return ((ci->pub.chiprev < 9) ? 0x180000 : 0x160000);
 	default:
 		brcmf_err("unknown chip: %s\n", ci->pub.name);
@@ -1427,7 +1427,7 @@  bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
 		reg = chip->ops->read32(chip->ctx, addr);
 		return reg != 0;
 	case CY_CC_4373_CHIP_ID:
-	case CY_CC_89459_CHIP_ID:
+	case BRCM_CC_4355_CHIP_ID:
 		/* explicitly check SR engine enable bit */
 		addr = CORE_CC_REG(base, sr_control0);
 		reg = chip->ops->read32(chip->ctx, addr);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index ad7a780cd..0a7410196 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -78,6 +78,7 @@  static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
 	BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C),
 	BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350),
 	BRCMF_FW_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C),
+	BRCMF_FW_ENTRY(BRCM_CC_4355_CHIP_ID, 0xFFFFFFFF, 4355)
 	BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
 	BRCMF_FW_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
 	BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
@@ -92,7 +93,6 @@  static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
 	BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C),
 	BRCMF_FW_ENTRY(BRCM_CC_43666_CHIP_ID, 0xFFFFFFF0, 4366C),
 	BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
-	BRCMF_FW_ENTRY(CY_CC_89459_CHIP_ID, 0xFFFFFFFF, 4355),
 };
 
 static const struct brcmf_firmware_mapping brcmf_pcie_otp_fwnames[] = {
@@ -2599,6 +2599,7 @@  static const struct pci_device_id brcmf_pcie_devid_table[] = {
 	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_4355_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),
diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
index f4939cf62..fee1ff526 100644
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
@@ -37,6 +37,7 @@ 
 #define BRCM_CC_4350_CHIP_ID		0x4350
 #define BRCM_CC_43525_CHIP_ID		43525
 #define BRCM_CC_4354_CHIP_ID		0x4354
+#define BRCM_CC_4355_CHIP_ID		0x4355
 #define BRCM_CC_4356_CHIP_ID		0x4356
 #define BRCM_CC_43566_CHIP_ID		43566
 #define BRCM_CC_43567_CHIP_ID		43567
@@ -56,7 +57,6 @@ 
 #define CY_CC_43012_CHIP_ID		43012
 #define CY_CC_43439_CHIP_ID		43439
 #define CY_CC_43752_CHIP_ID		43752
-#define CY_CC_89459_CHIP_ID		0x4355
 
 /* USB Device IDs */
 #define BRCM_USB_43143_DEVICE_ID	0xbd1e
@@ -72,6 +72,7 @@ 
 #define BRCM_PCIE_4350_DEVICE_ID	0x43a3
 #define BRCM_PCIE_4354_DEVICE_ID	0x43df
 #define BRCM_PCIE_4354_RAW_DEVICE_ID	0x4354
+#define BRCM_PCIE_4355_DEVICE_ID	0x43dc
 #define BRCM_PCIE_4356_DEVICE_ID	0x43ec
 #define BRCM_PCIE_43567_DEVICE_ID	0x43d3
 #define BRCM_PCIE_43570_DEVICE_ID	0x43d9