2023-01-04 10:05:40

by Hector Martin

[permalink] [raw]
Subject: [PATCH v1 0/4] BCM4355/4364/4377 support & identification fixes

Hi all,

This series adds support for the BCM4355, BCM4364, and BCM4377 variants
found on Intel Apple Macs of the T2 era (and a few pre-T2 ones).

The first patch fixes a bunch of confusion introduced when adding
support for the Cypress 89459 chip, which is, as far as I can tell,
just a BCM4355.

The subsequent patches add the firmware names and remaining missing
device IDs, including splitting the BCM4364 firmware name by revision
(since it was previously added without giving thought to the existence
of more than one revision in the wild with different firmwares,
resulting in different users manually copying different incompatible
firmwares as the same firmware name).

None of these devices have firmware in linux-firmware, so we should
still be able to tweak firmware filenames without breaking anyone that
matters. Apple T2 users these days are mostly using downstream trees
with the Asahi Linux WLAN patches merged anyway, so they already know
about this.

Note that these devices aren't fully usable as far as firmware
selection on these platforms without some extra patches to add support
for fetching the required info from ACPI, but I want to get the device
ID stuff out of the way first to move forward.

Hector Martin (4):
wifi: brcmfmac: Rename Cypress 89459 to BCM4355
brcmfmac: pcie: Add IDs/properties for BCM4355
brcmfmac: pcie: Add IDs/properties for BCM4377
brcmfmac: pcie: Perform correct BCM4364 firmware selection

.../broadcom/brcm80211/brcmfmac/chip.c | 6 ++--
.../broadcom/brcm80211/brcmfmac/pcie.c | 32 +++++++++++++++----
.../broadcom/brcm80211/include/brcm_hw_ids.h | 9 ++++--
3 files changed, 35 insertions(+), 12 deletions(-)

--
2.35.1


2023-01-04 10:05:53

by Hector Martin

[permalink] [raw]
Subject: [PATCH v1 1/4] wifi: brcmfmac: Rename Cypress 89459 to BCM4355

The commit that introduced support for this chip incorrectly claimed it
is a Cypress-specific part, while in actuality it is just a variant of
BCM4355 silicon (as evidenced by the chip ID).

The relationship between Cypress products and Broadcom products isn't
entirely clear, but given what little information is available and prior
art in the driver, it seems the convention should be that originally
Broadcom parts should retain the Broadcom name.

Thus, rename the relevant constants and firmware file. Also rename the
specific 89459 PCIe ID to BCM43596, which seems to be the original
subvariant name for this PCI ID (as defined in the out-of-tree bcmdhd
driver). Also declare the firmware as CLM-capable, since it is.

Fixes: dce45ded7619 ("brcmfmac: Support 89459 pcie")
Signed-off-by: Hector Martin <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++----
.../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 6 +++---
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 121893bbaa1d..3e42c2bd0d9a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -726,6 +726,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
case BRCM_CC_43664_CHIP_ID:
case BRCM_CC_43666_CHIP_ID:
return 0x200000;
+ case BRCM_CC_4355_CHIP_ID:
case BRCM_CC_4359_CHIP_ID:
return (ci->pub.chiprev < 9) ? 0x180000 : 0x160000;
case BRCM_CC_4364_CHIP_ID:
@@ -735,8 +736,6 @@ 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:
- return ((ci->pub.chiprev < 9) ? 0x180000 : 0x160000);
default:
brcmf_err("unknown chip: %s\n", ci->pub.name);
break;
@@ -1426,8 +1425,8 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
addr = CORE_CC_REG(base, sr_control1);
reg = chip->ops->read32(chip->ctx, addr);
return reg != 0;
+ case BRCM_CC_4355_CHIP_ID:
case CY_CC_4373_CHIP_ID:
- case CY_CC_89459_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 ae57a9a3ab05..3264be485e20 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -51,6 +51,7 @@ enum brcmf_pcie_state {
BRCMF_FW_DEF(43602, "brcmfmac43602-pcie");
BRCMF_FW_DEF(4350, "brcmfmac4350-pcie");
BRCMF_FW_DEF(4350C, "brcmfmac4350c2-pcie");
+BRCMF_FW_CLM_DEF(4355, "brcmfmac4355-pcie");
BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-pcie");
BRCMF_FW_CLM_DEF(43570, "brcmfmac43570-pcie");
BRCMF_FW_DEF(4358, "brcmfmac4358-pcie");
@@ -62,7 +63,6 @@ BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie");
BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie");
BRCMF_FW_DEF(4371, "brcmfmac4371-pcie");
BRCMF_FW_CLM_DEF(4378B1, "brcmfmac4378b1-pcie");
-BRCMF_FW_DEF(4355, "brcmfmac89459-pcie");

/* firmware config files */
MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.txt");
@@ -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),
@@ -93,7 +94,6 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
BRCMF_FW_ENTRY(BRCM_CC_43666_CHIP_ID, 0xFFFFFFF0, 4366C),
BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0xFFFFFFFF, 4378B1), /* revision ID 3 */
- BRCMF_FW_ENTRY(CY_CC_89459_CHIP_ID, 0xFFFFFFFF, 4355),
};

#define BRCMF_PCIE_FW_UP_TIMEOUT 5000 /* msec */
@@ -2590,6 +2590,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_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),
@@ -2609,9 +2610,8 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = {
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),
+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43596_DEVICE_ID, WCC),
BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID, WCC),
- BRCMF_PCIE_DEVICE(CY_PCIE_89459_DEVICE_ID, CYW),
- BRCMF_PCIE_DEVICE(CY_PCIE_89459_RAW_DEVICE_ID, CYW),
{ /* end: all zeroes */ }
};

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 f4939cf62767..cacc43db86eb 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_RAW_DEVICE_ID 0x4355
#define BRCM_PCIE_4356_DEVICE_ID 0x43ec
#define BRCM_PCIE_43567_DEVICE_ID 0x43d3
#define BRCM_PCIE_43570_DEVICE_ID 0x43d9
@@ -90,9 +91,8 @@
#define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
#define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
#define BRCM_PCIE_4371_DEVICE_ID 0x440d
+#define BRCM_PCIE_43596_DEVICE_ID 0x4415
#define BRCM_PCIE_4378_DEVICE_ID 0x4425
-#define CY_PCIE_89459_DEVICE_ID 0x4415
-#define CY_PCIE_89459_RAW_DEVICE_ID 0x4355

/* brcmsmac IDs */
#define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
--
2.35.1

2023-01-04 10:06:47

by Hector Martin

[permalink] [raw]
Subject: [PATCH v1 2/4] brcmfmac: pcie: Add IDs/properties for BCM4355

This chip is present on at least these Apple T2 Macs:

* hawaii: MacBook Air 13" (Late 2018)
* hawaii: MacBook Air 13" (True Tone, 2019)

Users report seeing PCI revision ID 12 for this chip, which Arend
reports should be revision C2, but Apple has the firmware tagged as
revision C1. Assume the right cutoff point for firmware versions is
revision ID 11 then, and leave older revisions using the non-versioned
firmware filename (Apple only uses C1 firmware builds).

Signed-off-by: Hector Martin <[email protected]>
---
.../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 10 +++++++++-
.../wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 +
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 3264be485e20..bb4faea0f0b6 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -52,6 +52,7 @@ BRCMF_FW_DEF(43602, "brcmfmac43602-pcie");
BRCMF_FW_DEF(4350, "brcmfmac4350-pcie");
BRCMF_FW_DEF(4350C, "brcmfmac4350c2-pcie");
BRCMF_FW_CLM_DEF(4355, "brcmfmac4355-pcie");
+BRCMF_FW_CLM_DEF(4355C1, "brcmfmac4355c1-pcie");
BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-pcie");
BRCMF_FW_CLM_DEF(43570, "brcmfmac43570-pcie");
BRCMF_FW_DEF(4358, "brcmfmac4358-pcie");
@@ -78,7 +79,8 @@ 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_4355_CHIP_ID, 0x000007FF, 4355),
+ BRCMF_FW_ENTRY(BRCM_CC_4355_CHIP_ID, 0xFFFFF800, 4355C1), /* rev ID 12/C2 seen */
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),
@@ -1994,6 +1996,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)
int ret;

switch (devinfo->ci->chip) {
+ case BRCM_CC_4355_CHIP_ID:
+ coreid = BCMA_CORE_CHIPCOMMON;
+ base = 0x8c0;
+ words = 0xb2;
+ break;
case BRCM_CC_4378_CHIP_ID:
coreid = BCMA_CORE_GCI;
base = 0x1120;
@@ -2591,6 +2598,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = {
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_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 cacc43db86eb..a722c37d7399 100644
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
@@ -73,6 +73,7 @@
#define BRCM_PCIE_4354_DEVICE_ID 0x43df
#define BRCM_PCIE_4354_RAW_DEVICE_ID 0x4354
#define BRCM_PCIE_4355_RAW_DEVICE_ID 0x4355
+#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.35.1

2023-01-04 10:06:48

by Hector Martin

[permalink] [raw]
Subject: [PATCH v1 3/4] brcmfmac: pcie: Add IDs/properties for BCM4377

This chip is present on at least these Apple T2 Macs:

* tahiti: MacBook Pro 13" (2020, 2 TB3)
* formosa: MacBook Pro 13" (Touch/2019)
* fiji: MacBook Air 13" (Scissor, 2020)

Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Hector Martin <[email protected]>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 +
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++
.../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
3 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 3e42c2bd0d9a..8073f31be27d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -733,6 +733,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
case CY_CC_4373_CHIP_ID:
return 0x160000;
case CY_CC_43752_CHIP_ID:
+ case BRCM_CC_4377_CHIP_ID:
return 0x170000;
case BRCM_CC_4378_CHIP_ID:
return 0x352000;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index bb4faea0f0b6..c203f14343d3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -63,6 +63,7 @@ BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie");
BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie");
BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie");
BRCMF_FW_DEF(4371, "brcmfmac4371-pcie");
+BRCMF_FW_CLM_DEF(4377B3, "brcmfmac4377b3-pcie");
BRCMF_FW_CLM_DEF(4378B1, "brcmfmac4378b1-pcie");

/* firmware config files */
@@ -95,6 +96,7 @@ 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(BRCM_CC_4377_CHIP_ID, 0xFFFFFFFF, 4377B3), /* revision ID 4 */
BRCMF_FW_ENTRY(BRCM_CC_4378_CHIP_ID, 0xFFFFFFFF, 4378B1), /* revision ID 3 */
};

@@ -2001,6 +2003,7 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)
base = 0x8c0;
words = 0xb2;
break;
+ case BRCM_CC_4377_CHIP_ID:
case BRCM_CC_4378_CHIP_ID:
coreid = BCMA_CORE_GCI;
base = 0x1120;
@@ -2619,7 +2622,9 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = {
BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID, BCA),
BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID, WCC),
BRCMF_PCIE_DEVICE(BRCM_PCIE_43596_DEVICE_ID, WCC),
+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4377_DEVICE_ID, WCC),
BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID, WCC),
+
{ /* end: all zeroes */ }
};

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 a722c37d7399..be9232c21789 100644
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
@@ -52,6 +52,7 @@
#define BRCM_CC_43664_CHIP_ID 43664
#define BRCM_CC_43666_CHIP_ID 43666
#define BRCM_CC_4371_CHIP_ID 0x4371
+#define BRCM_CC_4377_CHIP_ID 0x4377
#define BRCM_CC_4378_CHIP_ID 0x4378
#define CY_CC_4373_CHIP_ID 0x4373
#define CY_CC_43012_CHIP_ID 43012
@@ -93,6 +94,7 @@
#define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
#define BRCM_PCIE_4371_DEVICE_ID 0x440d
#define BRCM_PCIE_43596_DEVICE_ID 0x4415
+#define BRCM_PCIE_4377_DEVICE_ID 0x4488
#define BRCM_PCIE_4378_DEVICE_ID 0x4425

/* brcmsmac IDs */
--
2.35.1

2023-01-04 10:07:04

by Hector Martin

[permalink] [raw]
Subject: [PATCH v1 4/4] brcmfmac: pcie: Perform correct BCM4364 firmware selection

This chip exists in two revisions (B2=r3 and B3=r4) on different
platforms, and was added without regard to doing proper firmware
selection or differentiating between them. Fix this to have proper
per-revision firmwares and support Apple NVRAM selection.

Revision B2 is present on at least these Apple T2 Macs:

kauai: MacBook Pro 15" (Touch/2018-2019)
maui: MacBook Pro 13" (Touch/2018-2019)
lanai: Mac mini (Late 2018)
ekans: iMac Pro 27" (5K, Late 2017)

And these non-T2 Macs:

nihau: iMac 27" (5K, 2019)

Revision B3 is present on at least these Apple T2 Macs:

bali: MacBook Pro 16" (2019)
trinidad: MacBook Pro 13" (2020, 4 TB3)
borneo: MacBook Pro 16" (2019, 5600M)
kahana: Mac Pro (2019)
kahana: Mac Pro (2019, Rack)
hanauma: iMac 27" (5K, 2020)
kure: iMac 27" (5K, 2020, 5700/XT)

Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2")
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Hector Martin <[email protected]>
---
.../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index c203f14343d3..65e0604c0c42 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -57,7 +57,8 @@ BRCMF_FW_CLM_DEF(4356, "brcmfmac4356-pcie");
BRCMF_FW_CLM_DEF(43570, "brcmfmac43570-pcie");
BRCMF_FW_DEF(4358, "brcmfmac4358-pcie");
BRCMF_FW_DEF(4359, "brcmfmac4359-pcie");
-BRCMF_FW_DEF(4364, "brcmfmac4364-pcie");
+BRCMF_FW_CLM_DEF(4364B2, "brcmfmac4364b2-pcie");
+BRCMF_FW_CLM_DEF(4364B3, "brcmfmac4364b3-pcie");
BRCMF_FW_DEF(4365B, "brcmfmac4365b-pcie");
BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie");
BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie");
@@ -88,7 +89,8 @@ static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
BRCMF_FW_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570),
BRCMF_FW_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
- BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0xFFFFFFFF, 4364),
+ BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0x0000000F, 4364B2), /* 3 */
+ BRCMF_FW_ENTRY(BRCM_CC_4364_CHIP_ID, 0xFFFFFFF0, 4364B3), /* 4 */
BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B),
BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C),
BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
@@ -2003,6 +2005,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)
base = 0x8c0;
words = 0xb2;
break;
+ case BRCM_CC_4364_CHIP_ID:
+ coreid = BCMA_CORE_CHIPCOMMON;
+ base = 0x8c0;
+ words = 0x1a0;
+ break;
case BRCM_CC_4377_CHIP_ID:
case BRCM_CC_4378_CHIP_ID:
coreid = BCMA_CORE_GCI;
--
2.35.1

2023-01-04 13:33:03

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 1/4] wifi: brcmfmac: Rename Cypress 89459 to BCM4355

On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
> The commit that introduced support for this chip incorrectly claimed it
> is a Cypress-specific part, while in actuality it is just a variant of
> BCM4355 silicon (as evidenced by the chip ID).
>
> The relationship between Cypress products and Broadcom products isn't
> entirely clear, but given what little information is available and prior
> art in the driver, it seems the convention should be that originally
> Broadcom parts should retain the Broadcom name.
>
> Thus, rename the relevant constants and firmware file. Also rename the
> specific 89459 PCIe ID to BCM43596, which seems to be the original
> subvariant name for this PCI ID (as defined in the out-of-tree bcmdhd
> driver). Also declare the firmware as CLM-capable, since it is.
>
> Fixes: dce45ded7619 ("brcmfmac: Support 89459 pcie")
> Signed-off-by: Hector Martin <[email protected]>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++----
> .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 6 +++---
> 3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
> index 121893bbaa1d..3e42c2bd0d9a 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c

[...]

> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index ae57a9a3ab05..3264be485e20 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c

[...]

> @@ -2590,6 +2590,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_RAW_DEVICE_ID, WCC),

A bit of a problem here. If Cypress want to support this device,
regardless how they branded it, they will provide its firmware. Given
that they initially added it (as 89459) I suppose we should mark it with
CYW and not WCC. Actually, see my comment below on RAW dev ids.

> 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 f4939cf62767..cacc43db86eb 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h

[...]

> @@ -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_RAW_DEVICE_ID 0x4355

I would remove all RAW device ids. These should not be observed outside
chip vendor walls.


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 13:38:10

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 2/4] brcmfmac: pcie: Add IDs/properties for BCM4355

On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
> This chip is present on at least these Apple T2 Macs:
>
> * hawaii: MacBook Air 13" (Late 2018)
> * hawaii: MacBook Air 13" (True Tone, 2019)
>
> Users report seeing PCI revision ID 12 for this chip, which Arend
> reports should be revision C2, but Apple has the firmware tagged as
> revision C1. Assume the right cutoff point for firmware versions is
> revision ID 11 then, and leave older revisions using the non-versioned
> firmware filename (Apple only uses C1 firmware builds).

Reviewed-by: Arend van Spriel <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 10 +++++++++-
> .../wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 +
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 3264be485e20..bb4faea0f0b6 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c

[...]

> @@ -1994,6 +1996,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)
> int ret;
>
> switch (devinfo->ci->chip) {
> + case BRCM_CC_4355_CHIP_ID:
> + coreid = BCMA_CORE_CHIPCOMMON;
> + base = 0x8c0;
> + words = 0xb2;
> + break;
> case BRCM_CC_4378_CHIP_ID:
> coreid = BCMA_CORE_GCI;
> base = 0x1120;

This bit is not described in the commit message. Can you remind me why
the driver needs to read OTP?


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 13:38:40

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 1/4] wifi: brcmfmac: Rename Cypress 89459 to BCM4355

On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
> The commit that introduced support for this chip incorrectly claimed it
> is a Cypress-specific part, while in actuality it is just a variant of
> BCM4355 silicon (as evidenced by the chip ID).

[...]

> Fixes: dce45ded7619 ("brcmfmac: Support 89459 pcie")

Forgot to add:

Reviewed-by: Arend van Spriel <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++----
> .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 6 +++---
> 3 files changed, 9 insertions(+), 10 deletions(-)


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 13:39:24

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 3/4] brcmfmac: pcie: Add IDs/properties for BCM4377

On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
> This chip is present on at least these Apple T2 Macs:
>
> * tahiti: MacBook Pro 13" (2020, 2 TB3)
> * formosa: MacBook Pro 13" (Touch/2019)
> * fiji: MacBook Air 13" (Scissor, 2020)
>
> Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 +
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++
> .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 2 ++
> 3 files changed, 8 insertions(+)


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 13:47:25

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 4/4] brcmfmac: pcie: Perform correct BCM4364 firmware selection

On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
> This chip exists in two revisions (B2=r3 and B3=r4) on different
> platforms, and was added without regard to doing proper firmware
> selection or differentiating between them. Fix this to have proper
> per-revision firmwares and support Apple NVRAM selection.
>
> Revision B2 is present on at least these Apple T2 Macs:
>
> kauai: MacBook Pro 15" (Touch/2018-2019)
> maui: MacBook Pro 13" (Touch/2018-2019)
> lanai: Mac mini (Late 2018)
> ekans: iMac Pro 27" (5K, Late 2017)
>
> And these non-T2 Macs:
>
> nihau: iMac 27" (5K, 2019)
>
> Revision B3 is present on at least these Apple T2 Macs:
>
> bali: MacBook Pro 16" (2019)
> trinidad: MacBook Pro 13" (2020, 4 TB3)
> borneo: MacBook Pro 16" (2019, 5600M)
> kahana: Mac Pro (2019)
> kahana: Mac Pro (2019, Rack)
> hanauma: iMac 27" (5K, 2020)
> kure: iMac 27" (5K, 2020, 5700/XT)
>
> Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2")
> Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Arend van Spriel <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 15:56:49

by Aditya Garg

[permalink] [raw]
Subject: Re: [PATCH v1 4/4] brcmfmac: pcie: Perform correct BCM4364 firmware selection


> On 04-Jan-2023, at 3:31 PM, Hector Martin <[email protected]> wrote:
>
> This chip exists in two revisions (B2=r3 and B3=r4) on different
> platforms, and was added without regard to doing proper firmware
> selection or differentiating between them. Fix this to have proper
> per-revision firmwares and support Apple NVRAM selection.
>
> Revision B2 is present on at least these Apple T2 Macs:
>
> kauai: MacBook Pro 15" (Touch/2018-2019)
> maui: MacBook Pro 13" (Touch/2018-2019)
> lanai: Mac mini (Late 2018)
> ekans: iMac Pro 27" (5K, Late 2017)
>
> And these non-T2 Macs:
>
> nihau: iMac 27" (5K, 2019)
>
> Revision B3 is present on at least these Apple T2 Macs:
>
> bali: MacBook Pro 16" (2019)
> trinidad: MacBook Pro 13" (2020, 4 TB3)
> borneo: MacBook Pro 16" (2019, 5600M)
> kahana: Mac Pro (2019)
> kahana: Mac Pro (2019, Rack)
> hanauma: iMac 27" (5K, 2020)
> kure: iMac 27" (5K, 2020, 5700/XT)
>
> Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2")
> Reviewed-by: Linus Walleij <[email protected]>
> Signed-off-by: Hector Martin <[email protected]>
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>

Hi Hector

Shouldn’t there be a WCC instead of BCA here :

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c?h=v6.2-rc2#n2603

2023-01-04 16:28:36

by Hector Martin

[permalink] [raw]
Subject: Re: [PATCH v1 2/4] brcmfmac: pcie: Add IDs/properties for BCM4355

On 04/01/2023 22.35, Arend van Spriel wrote:
> On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
>> This chip is present on at least these Apple T2 Macs:
>>
>> * hawaii: MacBook Air 13" (Late 2018)
>> * hawaii: MacBook Air 13" (True Tone, 2019)
>>
>> Users report seeing PCI revision ID 12 for this chip, which Arend
>> reports should be revision C2, but Apple has the firmware tagged as
>> revision C1. Assume the right cutoff point for firmware versions is
>> revision ID 11 then, and leave older revisions using the non-versioned
>> firmware filename (Apple only uses C1 firmware builds).
>
> Reviewed-by: Arend van Spriel <[email protected]>
>> Signed-off-by: Hector Martin <[email protected]>
>> ---
>> .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 10 +++++++++-
>> .../wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 +
>> 2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>> index 3264be485e20..bb4faea0f0b6 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>
> [...]
>
>> @@ -1994,6 +1996,11 @@ static int brcmf_pcie_read_otp(struct brcmf_pciedev_info *devinfo)
>> int ret;
>>
>> switch (devinfo->ci->chip) {
>> + case BRCM_CC_4355_CHIP_ID:
>> + coreid = BCMA_CORE_CHIPCOMMON;
>> + base = 0x8c0;
>> + words = 0xb2;
>> + break;
>> case BRCM_CC_4378_CHIP_ID:
>> coreid = BCMA_CORE_GCI;
>> base = 0x1120;
>
> This bit is not described in the commit message. Can you remind me why
> the driver needs to read OTP?

Apple platforms use a vendor-specific OTP area to store identification
information used to select the right firmware/txcap/clm/nvram blobs. See
6bad3eeab6d3d (already upstream) and the immediately preceding commits
for how this all works.

In principle this should just return gracefully if that part of the OTP
is empty, though when I originally wrote this code we only knew of Apple
platforms using these chips anyway. If you think this might possibly
introduce issues to other platforms using the same chips (e.g. if
reading the OTP fails outright for some reason), we could gate it on the
presence of a valid devinfo->settings->antenna_sku, which would indicate
an Apple platform (since that property is specific to the Apple
firmware-selection process and only populated on those platforms).

- Hector

2023-01-04 16:37:29

by Hector Martin

[permalink] [raw]
Subject: Re: [PATCH v1 1/4] wifi: brcmfmac: Rename Cypress 89459 to BCM4355

On 04/01/2023 22.29, Arend van Spriel wrote:
> On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
>> The commit that introduced support for this chip incorrectly claimed it
>> is a Cypress-specific part, while in actuality it is just a variant of
>> BCM4355 silicon (as evidenced by the chip ID).
>>
>> The relationship between Cypress products and Broadcom products isn't
>> entirely clear, but given what little information is available and prior
>> art in the driver, it seems the convention should be that originally
>> Broadcom parts should retain the Broadcom name.
>>
>> Thus, rename the relevant constants and firmware file. Also rename the
>> specific 89459 PCIe ID to BCM43596, which seems to be the original
>> subvariant name for this PCI ID (as defined in the out-of-tree bcmdhd
>> driver). Also declare the firmware as CLM-capable, since it is.
>>
>> Fixes: dce45ded7619 ("brcmfmac: Support 89459 pcie")
>> Signed-off-by: Hector Martin <[email protected]>
>> ---
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++---
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++----
>> .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 6 +++---
>> 3 files changed, 9 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>> index 121893bbaa1d..3e42c2bd0d9a 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>
> [...]
>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>> index ae57a9a3ab05..3264be485e20 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>
> [...]
>
>> @@ -2590,6 +2590,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_RAW_DEVICE_ID, WCC),
>
> A bit of a problem here. If Cypress want to support this device,
> regardless how they branded it, they will provide its firmware. Given
> that they initially added it (as 89459) I suppose we should mark it with
> CYW and not WCC. Actually, see my comment below on RAW dev ids.

Right, I thought we might wind up with this issue. So then the question
becomes: can we give responsibility over PCI ID 0x4415 to Cypress and
mark just that one as CYW (if so it probably makes sense to keep that
labeled CYW89459 instead of BCM43596), and if not, is there some other
way to tell apart Cypress and Broadcom products we can use? I believe
the Apple side firmware is developed by Broadcom, not Cypress.

Note that even if we split by PCI device ID here, we still have a
problem with firmware selection, since that means we're requesting the
same firmware filename for both vendors (since that only tests the chip
ID and revision ID). If Apple is the *only* Broadcom customer using
these chips then we can get away with this, since I can just make sure
the fancy Apple firmware selection will never collide with the vanilla
firmware filename. But if other customers of both companies are both
shipping the same chip with different and incompatible generic firmware,
we need some way to tell them apart.

>
>> 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 f4939cf62767..cacc43db86eb 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
>> +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
>
> [...]
>
>> @@ -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_RAW_DEVICE_ID 0x4355
>
> I would remove all RAW device ids. These should not be observed outside
> chip vendor walls.

Ack, I'll remove this one instead of renaming it (or I can just drop all
the existing RAW IDs first in one commit at the head of v2 if you prefer
that).

- Hector

2023-01-04 19:31:03

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 1/4] wifi: brcmfmac: Rename Cypress 89459 to BCM4355

On January 4, 2023 5:35:08 PM Hector Martin <[email protected]> wrote:

> On 04/01/2023 22.29, Arend van Spriel wrote:
>> On 1/4/2023 11:01 AM, 'Hector Martin' via BRCM80211-DEV-LIST,PDL wrote:
>>> The commit that introduced support for this chip incorrectly claimed it
>>> is a Cypress-specific part, while in actuality it is just a variant of
>>> BCM4355 silicon (as evidenced by the chip ID).
>>>
>>> The relationship between Cypress products and Broadcom products isn't
>>> entirely clear, but given what little information is available and prior
>>> art in the driver, it seems the convention should be that originally
>>> Broadcom parts should retain the Broadcom name.
>>>
>>> Thus, rename the relevant constants and firmware file. Also rename the
>>> specific 89459 PCIe ID to BCM43596, which seems to be the original
>>> subvariant name for this PCI ID (as defined in the out-of-tree bcmdhd
>>> driver). Also declare the firmware as CLM-capable, since it is.
>>>
>>> Fixes: dce45ded7619 ("brcmfmac: Support 89459 pcie")
>>> Signed-off-by: Hector Martin <[email protected]>
>>> ---
>>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++---
>>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++----
>>> .../net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 6 +++---
>>> 3 files changed, 9 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>>> index 121893bbaa1d..3e42c2bd0d9a 100644
>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
>>
>> [...]
>>
>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>>> index ae57a9a3ab05..3264be485e20 100644
>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
>>
>> [...]
>>
>>> @@ -2590,6 +2590,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_RAW_DEVICE_ID, WCC),
>>
>> A bit of a problem here. If Cypress want to support this device,
>> regardless how they branded it, they will provide its firmware. Given
>> that they initially added it (as 89459) I suppose we should mark it with
>> CYW and not WCC. Actually, see my comment below on RAW dev ids.
>
> Right, I thought we might wind up with this issue. So then the question
> becomes: can we give responsibility over PCI ID 0x4415 to Cypress and
> mark just that one as CYW (if so it probably makes sense to keep that
> labeled CYW89459 instead of BCM43596), and if not, is there some other
> way to tell apart Cypress and Broadcom products we can use? I believe
> the Apple side firmware is developed by Broadcom, not Cypress.
>
> Note that even if we split by PCI device ID here, we still have a
> problem with firmware selection, since that means we're requesting the
> same firmware filename for both vendors (since that only tests the chip
> ID and revision ID). If Apple is the *only* Broadcom customer using
> these chips then we can get away with this, since I can just make sure
> the fancy Apple firmware selection will never collide with the vanilla
> firmware filename. But if other customers of both companies are both
> shipping the same chip with different and incompatible generic firmware,
> we need some way to tell them apart.

AFAIK Apple chips are exclusive. The vendor marking was added by recent
patch series I worked on. So per device id we assign the vendor. If
needed we can use subvendor or subdevid to separate them appropriately.

>
>
>>
>>> 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 f4939cf62767..cacc43db86eb 100644
>>> --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
>>> +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
>>
>> [...]
>>
>>> @@ -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_RAW_DEVICE_ID 0x4355
>>
>> I would remove all RAW device ids. These should not be observed outside
>> chip vendor walls.
>
> Ack, I'll remove this one instead of renaming it (or I can just drop all
> the existing RAW IDs first in one commit at the head of v2 if you prefer
> that).

Let's drop the existing RAW IDs with a separate patch explaining why ;-)

Regards,
Arend



Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-01-04 19:56:57

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH v1 4/4] brcmfmac: pcie: Perform correct BCM4364 firmware selection

On 1/4/2023 4:56 PM, Aditya Garg wrote:
>
>> On 04-Jan-2023, at 3:31 PM, Hector Martin <[email protected]> wrote:
>>
>> This chip exists in two revisions (B2=r3 and B3=r4) on different
>> platforms, and was added without regard to doing proper firmware
>> selection or differentiating between them. Fix this to have proper
>> per-revision firmwares and support Apple NVRAM selection.
>>
>> Revision B2 is present on at least these Apple T2 Macs:
>>
>> kauai: MacBook Pro 15" (Touch/2018-2019)
>> maui: MacBook Pro 13" (Touch/2018-2019)
>> lanai: Mac mini (Late 2018)
>> ekans: iMac Pro 27" (5K, Late 2017)
>>
>> And these non-T2 Macs:
>>
>> nihau: iMac 27" (5K, 2019)
>>
>> Revision B3 is present on at least these Apple T2 Macs:
>>
>> bali: MacBook Pro 16" (2019)
>> trinidad: MacBook Pro 13" (2020, 4 TB3)
>> borneo: MacBook Pro 16" (2019, 5600M)
>> kahana: Mac Pro (2019)
>> kahana: Mac Pro (2019, Rack)
>> hanauma: iMac 27" (5K, 2020)
>> kure: iMac 27" (5K, 2020, 5700/XT)
>>
>> Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2")
>> Reviewed-by: Linus Walleij <[email protected]>
>> Signed-off-by: Hector Martin <[email protected]>
>> ---
>> .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>
> Hi Hector
>
> Shouldn’t there be a WCC instead of BCA here :
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c?h=v6.2-rc2#n2603

You are right. Thanks for catching that. As Hector is changing that
entry he can hopefully take care of it.

Regards,
Arend


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature