diff mbox series

[v2,2/4] brcmfmac: Support 89459 pcie

Message ID 20220922104140.11889-3-ian.lin@infineon.com (mailing list archive)
State Accepted
Commit dce45ded761946c053b9901f4b49f0439d934251
Delegated to: Kalle Valo
Headers show
Series New chip support and update fw capabilities series | expand

Commit Message

Ian Lin Sept. 22, 2022, 10:41 a.m. UTC
From: Alexander Prutskov <alep@cypress.com>

Adds support of 89459 chip pcie device and save restore support.

Signed-off-by: Alexander Prutskov <alep@cypress.com>
Signed-off-by: Joseph chuang <jiac@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Ian Lin <ian.lin@infineon.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c       | 3 +++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c       | 4 ++++
 drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 4 +++-
 3 files changed, 10 insertions(+), 1 deletion(-)

Comments

Hector Martin Oct. 17, 2022, 12:38 p.m. UTC | #1
Hi,

On 22/09/2022 19.41, Ian Lin wrote:
> From: Alexander Prutskov <alep@cypress.com>
> 
> Adds support of 89459 chip pcie device and save restore support.
> 
> Signed-off-by: Alexander Prutskov <alep@cypress.com>
> Signed-off-by: Joseph chuang <jiac@cypress.com>
> Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
> Signed-off-by: Ian Lin <ian.lin@infineon.com>
[...]

Can you explain how the CYW89459 is related to the BCM4355 family? I
have a patch [1] to add support for the BCM4355 variant present in some
Apple laptops which I was hoping to submit again for 6.2, and this patch
conflicts with it.

[1] https://lore.kernel.org/lkml/20220104072658.69756-19-marcan@marcan.st/

>  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");
> @@ -90,6 +91,7 @@ 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),
>  };

Is the CYW89459 just a rebrand of the BCM4355, or just a subset? If it
is a rebrand, it's okay if we call our Apple firmware
brcmfmac89459-pcie* (note that we use per-board firmware names, so it
wouldn't conflict with a generic one). However, if CYW89459 only refers
to specific variants, I think the firmware should be named after the
overall bcm4355 family.

I'm guessing you intend to ship firmware for this. Would that firmware
work for all 4355 variants, or only the CYW one? If only the CYW one, is
it possible to differentiate between them based on PCI revision ID? Note
that our 4355 has revision ID 12, and Apple specifically calls it 4355C1
(different chip revisions have different firmware builds, which is why I
named our firmware brcmfmac4355c1-pcie). If the CYW variant uses other
revision IDs that do not overlap, maybe we should have different
firmware entries for them with different masks.

>  
> 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 1003f123ec25..f4939cf62767 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
> @@ -56,6 +56,7 @@
>  #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

This seems suspicious. If the chip ID is 4355 and applies to non-Cypress
products, unlike the other constants in this list, this constant should
probably be named after BCM4355, not the Cypress part number.

>  
>  /* USB Device IDs */
>  #define BRCM_USB_43143_DEVICE_ID	0xbd1e
> @@ -90,7 +91,8 @@
>  #define BRCM_PCIE_4366_5G_DEVICE_ID	0x43c5
>  #define BRCM_PCIE_4371_DEVICE_ID	0x440d
>  #define BRCM_PCIE_4378_DEVICE_ID	0x4425
> -
> +#define CY_PCIE_89459_DEVICE_ID         0x4415
> +#define CY_PCIE_89459_RAW_DEVICE_ID     0x4355

Note that the PCI device ID for our 4355 is 0x43dc. Other sources call
this "BCM4355 D11AC", which is distinct from 0x4355 ("BCM43237 D11N")
and 0x4415 ("BCM43596 D11AC").

- Hector
Aditya Garg Jan. 2, 2023, 9:45 a.m. UTC | #2
Hi Hector

> 
> Is the CYW89459 just a rebrand of the BCM4355, or just a subset? If it
> is a rebrand, it's okay if we call our Apple firmware
> brcmfmac89459-pcie* (note that we use per-board firmware names, so it
> wouldn't conflict with a generic one). However, if CYW89459 only refers
> to specific variants, I think the firmware should be named after the
> overall bcm4355 family.
> 
> I'm guessing you intend to ship firmware for this. Would that firmware
> work for all 4355 variants, or only the CYW one? If only the CYW one, is
> it possible to differentiate between them based on PCI revision ID? Note
> that our 4355 has revision ID 12, and Apple specifically calls it 4355C1
> (different chip revisions have different firmware builds, which is why I
> named our firmware brcmfmac4355c1-pcie). If the CYW variant uses other
> revision IDs that do not overlap, maybe we should have different
> firmware entries for them with different masks.


Can we make a separate table for the OTP Apple chips, something like here :-

https://github.com/AdityaGarg8/linux/commit/fc41aac9283d2ba653a8b3191e8c0138c13d8ee1
Arend van Spriel Jan. 2, 2023, 1:58 p.m. UTC | #3
On 1/2/2023 10:45 AM, Aditya Garg wrote:
> Hi Hector
> 
>>
>> Is the CYW89459 just a rebrand of the BCM4355, or just a subset? If it
>> is a rebrand, it's okay if we call our Apple firmware
>> brcmfmac89459-pcie* (note that we use per-board firmware names, so it
>> wouldn't conflict with a generic one). However, if CYW89459 only refers
>> to specific variants, I think the firmware should be named after the
>> overall bcm4355 family.
>>
>> I'm guessing you intend to ship firmware for this. Would that firmware
>> work for all 4355 variants, or only the CYW one? If only the CYW one, is
>> it possible to differentiate between them based on PCI revision ID? Note
>> that our 4355 has revision ID 12, and Apple specifically calls it 4355C1
>> (different chip revisions have different firmware builds, which is why I
>> named our firmware brcmfmac4355c1-pcie). If the CYW variant uses other
>> revision IDs that do not overlap, maybe we should have different
>> firmware entries for them with different masks.
> 
> 
> Can we make a separate table for the OTP Apple chips, something like here :-
> 
> https://github.com/AdityaGarg8/linux/commit/fc41aac9283d2ba653a8b3191e8c0138c13d8ee1

I do not understand from this email thread why you would need separate 
tables. Can you explain?

Regards,
Arend
Hector Martin Jan. 2, 2023, 2:01 p.m. UTC | #4
On 02/01/2023 22.58, Arend van Spriel wrote:
> On 1/2/2023 10:45 AM, Aditya Garg wrote:
>> Hi Hector
>>
>>>
>>> Is the CYW89459 just a rebrand of the BCM4355, or just a subset? If it
>>> is a rebrand, it's okay if we call our Apple firmware
>>> brcmfmac89459-pcie* (note that we use per-board firmware names, so it
>>> wouldn't conflict with a generic one). However, if CYW89459 only refers
>>> to specific variants, I think the firmware should be named after the
>>> overall bcm4355 family.
>>>
>>> I'm guessing you intend to ship firmware for this. Would that firmware
>>> work for all 4355 variants, or only the CYW one? If only the CYW one, is
>>> it possible to differentiate between them based on PCI revision ID? Note
>>> that our 4355 has revision ID 12, and Apple specifically calls it 4355C1
>>> (different chip revisions have different firmware builds, which is why I
>>> named our firmware brcmfmac4355c1-pcie). If the CYW variant uses other
>>> revision IDs that do not overlap, maybe we should have different
>>> firmware entries for them with different masks.
>>
>>
>> Can we make a separate table for the OTP Apple chips, something like here :-
>>
>> https://github.com/AdityaGarg8/linux/commit/fc41aac9283d2ba653a8b3191e8c0138c13d8ee1
> 
> I do not understand from this email thread why you would need separate 
> tables. Can you explain?
> 

I think he's proposing we special-case Apple chips into their own
firmware table just to avoid colliding with non-Apple firmware usage,
which is honestly kind of tempting as the safe option if nobody from the
Broadcom/Cypress side is willing to clarify what, exactly, is the
relationship between these chips and what their respective revision
numbers are so we can *correctly* represent them and avoid further
confusion and problems down the line.

You might be able to help with that ;)

- Hector
Aditya Garg Jan. 2, 2023, 2:34 p.m. UTC | #5
> I think he's proposing we special-case Apple chips into their own
> firmware table just to avoid colliding with non-Apple firmware usage,
> which is honestly kind of tempting as the safe option if nobody from the
> Broadcom/Cypress side is willing to clarify what, exactly, is the
> relationship between these chips and what their respective revision
> numbers are so we can *correctly* represent them and avoid further
> confusion and problems down the line.

Exactly

> 
> You might be able to help with that ;)

I am sending the patch.

> 
> - Hector
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
index 3026166a56c1..121893bbaa1d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
@@ -735,6 +735,8 @@  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;
@@ -1425,6 +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:
 		/* 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 f98641bb1528..80083f9ea311 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -60,6 +60,7 @@  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");
@@ -90,6 +91,7 @@  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 */
@@ -2465,6 +2467,8 @@  static const struct pci_device_id brcmf_pcie_devid_table[] = {
 	BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
 	BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID),
 	BRCMF_PCIE_DEVICE(BRCM_PCIE_4378_DEVICE_ID),
+	BRCMF_PCIE_DEVICE(CY_PCIE_89459_DEVICE_ID),
+	BRCMF_PCIE_DEVICE(CY_PCIE_89459_RAW_DEVICE_ID),
 	{ /* 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 1003f123ec25..f4939cf62767 100644
--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
@@ -56,6 +56,7 @@ 
 #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
@@ -90,7 +91,8 @@ 
 #define BRCM_PCIE_4366_5G_DEVICE_ID	0x43c5
 #define BRCM_PCIE_4371_DEVICE_ID	0x440d
 #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 */