2023-02-18 15:30:22

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 0/5] rtw88: Add additional SDIO support bits

These patches are split from my big RFC series called "rtw88: Add
SDIO support" from [0].
The goal of this smaller series is to make it easier to review the
patches and already upstream support bits which are mostly
independent.

For patches 3-5 I got feedback from Ping-Ke in the RFC version where
he suggested to add __packed to various structs. This resulted in
discussions around that whole topic in [1] and [2]. Since I'm new
to that topic I sent an RFC patch [3] based on the suggestions from
Ping-Ke and David. That patch has not been reviewed yet. My
suggestion is to take the patches from this series first, then
come to a conclusion on the RFC patch which I'll then re-spin as
a normal patch with the required changes that will come up in the
discussion (if any).


Changes since v1 from [4]:
- keep a consistent order for newly added functions, case statements
and union members in patches 3, 4, 5 as suggested by Ping-Ke
- removed an extraneous newline which was added by accident from
patch 4


[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/linux-wireless/[email protected]/
[2] https://lore.kernel.org/linux-wireless/[email protected]/
[3] https://lore.kernel.org/lkml/[email protected]/
[4] https://lore.kernel.org/lkml/[email protected]/T/


Martin Blumenstingl (5):
wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()
wifi: rtw88: mac: Add SDIO HCI support in the TX/page table setup
wifi: rtw88: rtw8821c: Implement RTL8821CS (SDIO) efuse parsing
wifi: rtw88: rtw8822b: Implement RTL8822BS (SDIO) efuse parsing
wifi: rtw88: rtw8822c: Implement RTL8822CS (SDIO) efuse parsing

drivers/net/wireless/realtek/rtw88/mac.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8821c.h | 6 ++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.h | 8 +++++++-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 8 +++++++-
7 files changed, 56 insertions(+), 2 deletions(-)

--
2.39.2



2023-02-18 15:30:26

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 1/5] wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()

rtw_pwr_seq_parser() needs to know about the HCI bus interface mask for
the SDIO bus so it can parse the chip state change sequences.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 4e5c194aac29..3ed88d38f1b4 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -222,6 +222,9 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev,
case RTW_HCI_TYPE_USB:
intf_mask = RTW_PWR_INTF_USB_MSK;
break;
+ case RTW_HCI_TYPE_SDIO:
+ intf_mask = RTW_PWR_INTF_SDIO_MSK;
+ break;
default:
return -EINVAL;
}
--
2.39.2


2023-02-18 15:30:39

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 2/5] wifi: rtw88: mac: Add SDIO HCI support in the TX/page table setup

txdma_queue_mapping() and priority_queue_cfg() can use the first entry
of each chip's rqpn_table and page_table. Add this mapping so data
transmission is possible on SDIO based chipsets.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 3ed88d38f1b4..6a234eec09ff 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -1033,6 +1033,9 @@ static int txdma_queue_mapping(struct rtw_dev *rtwdev)
else
return -EINVAL;
break;
+ case RTW_HCI_TYPE_SDIO:
+ rqpn = &chip->rqpn_table[0];
+ break;
default:
return -EINVAL;
}
@@ -1195,6 +1198,9 @@ static int priority_queue_cfg(struct rtw_dev *rtwdev)
else
return -EINVAL;
break;
+ case RTW_HCI_TYPE_SDIO:
+ pg_tbl = &chip->page_table[0];
+ break;
default:
return -EINVAL;
}
--
2.39.2


2023-02-18 15:30:39

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 3/5] wifi: rtw88: rtw8821c: Implement RTL8821CS (SDIO) efuse parsing

The efuse of the SDIO RTL8821CS chip has only one known member: the mac
address is at offset 0x11a. Add a struct rtw8821cs_efuse describing this
and use it for copying the mac address when the SDIO bus is used.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
changes from v1 -> v2:
- add the new function/union member/case statement last (after USB)


drivers/net/wireless/realtek/rtw88/rtw8821c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8821c.h | 6 ++++++
2 files changed, 15 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 17f800f6efbd..7ae0541d7b99 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -32,6 +32,12 @@ static void rtw8821cu_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->u.mac_addr);
}

+static void rtw8821cs_efuse_parsing(struct rtw_efuse *efuse,
+ struct rtw8821c_efuse *map)
+{
+ ether_addr_copy(efuse->addr, map->s.mac_addr);
+}
+
enum rtw8821ce_rf_set {
SWITCH_TO_BTG,
SWITCH_TO_WLG,
@@ -77,6 +83,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_USB:
rtw8821cu_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8821cs_efuse_parsing(efuse, map);
+ break;
default:
/* unsupported now */
return -ENOTSUPP;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.h b/drivers/net/wireless/realtek/rtw88/rtw8821c.h
index 1c81260f3a54..fcff31688c45 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.h
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.h
@@ -65,6 +65,11 @@ struct rtw8821ce_efuse {
u8 res7;
};

+struct rtw8821cs_efuse {
+ u8 res4[0x4a]; /* 0xd0 */
+ u8 mac_addr[ETH_ALEN]; /* 0x11a */
+} __packed;
+
struct rtw8821c_efuse {
__le16 rtl_id;
u8 res0[0x0e];
@@ -94,6 +99,7 @@ struct rtw8821c_efuse {
union {
struct rtw8821ce_efuse e;
struct rtw8821cu_efuse u;
+ struct rtw8821cs_efuse s;
};
};

--
2.39.2


2023-02-18 15:30:40

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 4/5] wifi: rtw88: rtw8822b: Implement RTL8822BS (SDIO) efuse parsing

The efuse of the SDIO RTL8822BS chip has only one known member: the mac
address is at offset 0x11a. Add a struct rtw8822bs_efuse describing this
and use it for copying the mac address when the SDIO bus is used.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
changes from v1 -> v2:
- remove extra newline which was added by accident in the USB function
- add the new function/union member/case statement last (after USB)
- while here, also sort the union members to be consistent with
the switch case (PCIe first, USB second, SDIO last)


drivers/net/wireless/realtek/rtw88/rtw8822b.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.h | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 74dfb89b2c94..531b67787e2e 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -32,6 +32,12 @@ static void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->u.mac_addr);
}

+static void rtw8822bs_efuse_parsing(struct rtw_efuse *efuse,
+ struct rtw8822b_efuse *map)
+{
+ ether_addr_copy(efuse->addr, map->s.mac_addr);
+}
+
static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
{
struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -65,6 +71,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_USB:
rtw8822bu_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8822bs_efuse_parsing(efuse, map);
+ break;
default:
/* unsupported now */
return -ENOTSUPP;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.h b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
index 01d3644e0c94..2dc3a6660f06 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.h
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
@@ -65,6 +65,11 @@ struct rtw8822be_efuse {
u8 res7;
};

+struct rtw8822bs_efuse {
+ u8 res4[0x4a]; /* 0xd0 */
+ u8 mac_addr[ETH_ALEN]; /* 0x11a */
+} __packed;
+
struct rtw8822b_efuse {
__le16 rtl_id;
u8 res0[0x0e];
@@ -92,8 +97,9 @@ struct rtw8822b_efuse {
u8 country_code[2];
u8 res[3];
union {
- struct rtw8822bu_efuse u;
struct rtw8822be_efuse e;
+ struct rtw8822bu_efuse u;
+ struct rtw8822bs_efuse s;
};
};

--
2.39.2


2023-02-18 15:30:49

by Martin Blumenstingl

[permalink] [raw]
Subject: [PATCH v2 5/5] wifi: rtw88: rtw8822c: Implement RTL8822CS (SDIO) efuse parsing

The efuse of the SDIO RTL8822CS chip has only one known member: the mac
address is at offset 0x16a. Add a struct rtw8822cs_efuse describing this
and use it for copying the mac address when the SDIO bus is used.

Signed-off-by: Martin Blumenstingl <[email protected]>
---
- add the new function/union member/case statement last (after USB)
- while here, also sort the union members to be consistent with
the switch case (PCIe first, USB second, SDIO last)


drivers/net/wireless/realtek/rtw88/rtw8822c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 8 +++++++-
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 964e27887fe2..5a2c004b12df 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -35,6 +35,12 @@ static void rtw8822cu_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->u.mac_addr);
}

+static void rtw8822cs_efuse_parsing(struct rtw_efuse *efuse,
+ struct rtw8822c_efuse *map)
+{
+ ether_addr_copy(efuse->addr, map->s.mac_addr);
+}
+
static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
{
struct rtw_efuse *efuse = &rtwdev->efuse;
@@ -67,6 +73,9 @@ static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_USB:
rtw8822cu_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8822cs_efuse_parsing(efuse, map);
+ break;
default:
/* unsupported now */
return -ENOTSUPP;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
index 479d5d769c52..1bc0e7f5d6bb 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
@@ -16,6 +16,11 @@ struct rtw8822cu_efuse {
u8 res2[0x3d];
};

+struct rtw8822cs_efuse {
+ u8 res0[0x4a]; /* 0x120 */
+ u8 mac_addr[ETH_ALEN]; /* 0x16a */
+} __packed;
+
struct rtw8822ce_efuse {
u8 mac_addr[ETH_ALEN]; /* 0x120 */
u8 vender_id[2];
@@ -91,8 +96,9 @@ struct rtw8822c_efuse {
u8 res9;
u8 res10[0x42];
union {
- struct rtw8822cu_efuse u;
struct rtw8822ce_efuse e;
+ struct rtw8822cu_efuse u;
+ struct rtw8822cs_efuse s;
};
};

--
2.39.2


2023-02-20 00:25:37

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v2 1/5] wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()



> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Saturday, February 18, 2023 11:30 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected]; [email protected]; Neo
> Jou <[email protected]>; Jernej Skrabec <[email protected]>; Ping-Ke Shih <[email protected]>;
> Martin Blumenstingl <[email protected]>
> Subject: [PATCH v2 1/5] wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()
> rtw_pwr_seq_parser() needs to know about the HCI bus interface mask for
> the SDIO bus so it can parse the chip state change sequences.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> drivers/net/wireless/realtek/rtw88/mac.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index 4e5c194aac29..3ed88d38f1b4 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -222,6 +222,9 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev,
> case RTW_HCI_TYPE_USB:
> intf_mask = RTW_PWR_INTF_USB_MSK;
> break;
> + case RTW_HCI_TYPE_SDIO:
> + intf_mask = RTW_PWR_INTF_SDIO_MSK;
> + break;
> default:
> return -EINVAL;
> }
> --
> 2.39.2


2023-02-20 00:26:33

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v2 2/5] wifi: rtw88: mac: Add SDIO HCI support in the TX/page table setup



> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Saturday, February 18, 2023 11:30 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected]; [email protected]; Neo
> Jou <[email protected]>; Jernej Skrabec <[email protected]>; Ping-Ke Shih <[email protected]>;
> Martin Blumenstingl <[email protected]>
> Subject: [PATCH v2 2/5] wifi: rtw88: mac: Add SDIO HCI support in the TX/page table setup
>
> txdma_queue_mapping() and priority_queue_cfg() can use the first entry
> of each chip's rqpn_table and page_table. Add this mapping so data
> transmission is possible on SDIO based chipsets.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index 3ed88d38f1b4..6a234eec09ff 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -1033,6 +1033,9 @@ static int txdma_queue_mapping(struct rtw_dev *rtwdev)
> else
> return -EINVAL;
> break;
> + case RTW_HCI_TYPE_SDIO:
> + rqpn = &chip->rqpn_table[0];
> + break;
> default:
> return -EINVAL;
> }
> @@ -1195,6 +1198,9 @@ static int priority_queue_cfg(struct rtw_dev *rtwdev)
> else
> return -EINVAL;
> break;
> + case RTW_HCI_TYPE_SDIO:
> + pg_tbl = &chip->page_table[0];
> + break;
> default:
> return -EINVAL;
> }
> --
> 2.39.2


2023-02-20 00:27:06

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v2 3/5] wifi: rtw88: rtw8821c: Implement RTL8821CS (SDIO) efuse parsing



> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Saturday, February 18, 2023 11:30 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected]; [email protected]; Neo
> Jou <[email protected]>; Jernej Skrabec <[email protected]>; Ping-Ke Shih <[email protected]>;
> Martin Blumenstingl <[email protected]>
> Subject: [PATCH v2 3/5] wifi: rtw88: rtw8821c: Implement RTL8821CS (SDIO) efuse parsing
>
> The efuse of the SDIO RTL8821CS chip has only one known member: the mac
> address is at offset 0x11a. Add a struct rtw8821cs_efuse describing this
> and use it for copying the mac address when the SDIO bus is used.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> changes from v1 -> v2:
> - add the new function/union member/case statement last (after USB)
>
>
> drivers/net/wireless/realtek/rtw88/rtw8821c.c | 9 +++++++++
> drivers/net/wireless/realtek/rtw88/rtw8821c.h | 6 ++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> index 17f800f6efbd..7ae0541d7b99 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> @@ -32,6 +32,12 @@ static void rtw8821cu_efuse_parsing(struct rtw_efuse *efuse,
> ether_addr_copy(efuse->addr, map->u.mac_addr);
> }
>
> +static void rtw8821cs_efuse_parsing(struct rtw_efuse *efuse,
> + struct rtw8821c_efuse *map)
> +{
> + ether_addr_copy(efuse->addr, map->s.mac_addr);
> +}
> +
> enum rtw8821ce_rf_set {
> SWITCH_TO_BTG,
> SWITCH_TO_WLG,
> @@ -77,6 +83,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> case RTW_HCI_TYPE_USB:
> rtw8821cu_efuse_parsing(efuse, map);
> break;
> + case RTW_HCI_TYPE_SDIO:
> + rtw8821cs_efuse_parsing(efuse, map);
> + break;
> default:
> /* unsupported now */
> return -ENOTSUPP;
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.h
> b/drivers/net/wireless/realtek/rtw88/rtw8821c.h
> index 1c81260f3a54..fcff31688c45 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.h
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.h
> @@ -65,6 +65,11 @@ struct rtw8821ce_efuse {
> u8 res7;
> };
>
> +struct rtw8821cs_efuse {
> + u8 res4[0x4a]; /* 0xd0 */
> + u8 mac_addr[ETH_ALEN]; /* 0x11a */
> +} __packed;
> +
> struct rtw8821c_efuse {
> __le16 rtl_id;
> u8 res0[0x0e];
> @@ -94,6 +99,7 @@ struct rtw8821c_efuse {
> union {
> struct rtw8821ce_efuse e;
> struct rtw8821cu_efuse u;
> + struct rtw8821cs_efuse s;
> };
> };
>
> --
> 2.39.2


2023-02-20 00:27:19

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v2 4/5] wifi: rtw88: rtw8822b: Implement RTL8822BS (SDIO) efuse parsing



> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Saturday, February 18, 2023 11:30 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected]; [email protected]; Neo
> Jou <[email protected]>; Jernej Skrabec <[email protected]>; Ping-Ke Shih <[email protected]>;
> Martin Blumenstingl <[email protected]>
> Subject: [PATCH v2 4/5] wifi: rtw88: rtw8822b: Implement RTL8822BS (SDIO) efuse parsing
>
> The efuse of the SDIO RTL8822BS chip has only one known member: the mac
> address is at offset 0x11a. Add a struct rtw8822bs_efuse describing this
> and use it for copying the mac address when the SDIO bus is used.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> changes from v1 -> v2:
> - remove extra newline which was added by accident in the USB function
> - add the new function/union member/case statement last (after USB)
> - while here, also sort the union members to be consistent with
> the switch case (PCIe first, USB second, SDIO last)
>
>
> drivers/net/wireless/realtek/rtw88/rtw8822b.c | 9 +++++++++
> drivers/net/wireless/realtek/rtw88/rtw8822b.h | 8 +++++++-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> index 74dfb89b2c94..531b67787e2e 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> @@ -32,6 +32,12 @@ static void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse,
> ether_addr_copy(efuse->addr, map->u.mac_addr);
> }
>
> +static void rtw8822bs_efuse_parsing(struct rtw_efuse *efuse,
> + struct rtw8822b_efuse *map)
> +{
> + ether_addr_copy(efuse->addr, map->s.mac_addr);
> +}
> +
> static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> {
> struct rtw_efuse *efuse = &rtwdev->efuse;
> @@ -65,6 +71,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> case RTW_HCI_TYPE_USB:
> rtw8822bu_efuse_parsing(efuse, map);
> break;
> + case RTW_HCI_TYPE_SDIO:
> + rtw8822bs_efuse_parsing(efuse, map);
> + break;
> default:
> /* unsupported now */
> return -ENOTSUPP;
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> index 01d3644e0c94..2dc3a6660f06 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> @@ -65,6 +65,11 @@ struct rtw8822be_efuse {
> u8 res7;
> };
>
> +struct rtw8822bs_efuse {
> + u8 res4[0x4a]; /* 0xd0 */
> + u8 mac_addr[ETH_ALEN]; /* 0x11a */
> +} __packed;
> +
> struct rtw8822b_efuse {
> __le16 rtl_id;
> u8 res0[0x0e];
> @@ -92,8 +97,9 @@ struct rtw8822b_efuse {
> u8 country_code[2];
> u8 res[3];
> union {
> - struct rtw8822bu_efuse u;
> struct rtw8822be_efuse e;
> + struct rtw8822bu_efuse u;
> + struct rtw8822bs_efuse s;
> };
> };
>
> --
> 2.39.2


2023-02-20 00:27:41

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v2 5/5] wifi: rtw88: rtw8822c: Implement RTL8822CS (SDIO) efuse parsing



> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Saturday, February 18, 2023 11:30 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected]; [email protected]; Neo
> Jou <[email protected]>; Jernej Skrabec <[email protected]>; Ping-Ke Shih <[email protected]>;
> Martin Blumenstingl <[email protected]>
> Subject: [PATCH v2 5/5] wifi: rtw88: rtw8822c: Implement RTL8822CS (SDIO) efuse parsing
>
> The efuse of the SDIO RTL8822CS chip has only one known member: the mac
> address is at offset 0x16a. Add a struct rtw8822cs_efuse describing this
> and use it for copying the mac address when the SDIO bus is used.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> - add the new function/union member/case statement last (after USB)
> - while here, also sort the union members to be consistent with
> the switch case (PCIe first, USB second, SDIO last)
>
>
> drivers/net/wireless/realtek/rtw88/rtw8822c.c | 9 +++++++++
> drivers/net/wireless/realtek/rtw88/rtw8822c.h | 8 +++++++-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> index 964e27887fe2..5a2c004b12df 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> @@ -35,6 +35,12 @@ static void rtw8822cu_efuse_parsing(struct rtw_efuse *efuse,
> ether_addr_copy(efuse->addr, map->u.mac_addr);
> }
>
> +static void rtw8822cs_efuse_parsing(struct rtw_efuse *efuse,
> + struct rtw8822c_efuse *map)
> +{
> + ether_addr_copy(efuse->addr, map->s.mac_addr);
> +}
> +
> static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> {
> struct rtw_efuse *efuse = &rtwdev->efuse;
> @@ -67,6 +73,9 @@ static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> case RTW_HCI_TYPE_USB:
> rtw8822cu_efuse_parsing(efuse, map);
> break;
> + case RTW_HCI_TYPE_SDIO:
> + rtw8822cs_efuse_parsing(efuse, map);
> + break;
> default:
> /* unsupported now */
> return -ENOTSUPP;
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h
> b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
> index 479d5d769c52..1bc0e7f5d6bb 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
> @@ -16,6 +16,11 @@ struct rtw8822cu_efuse {
> u8 res2[0x3d];
> };
>
> +struct rtw8822cs_efuse {
> + u8 res0[0x4a]; /* 0x120 */
> + u8 mac_addr[ETH_ALEN]; /* 0x16a */
> +} __packed;
> +
> struct rtw8822ce_efuse {
> u8 mac_addr[ETH_ALEN]; /* 0x120 */
> u8 vender_id[2];
> @@ -91,8 +96,9 @@ struct rtw8822c_efuse {
> u8 res9;
> u8 res10[0x42];
> union {
> - struct rtw8822cu_efuse u;
> struct rtw8822ce_efuse e;
> + struct rtw8822cu_efuse u;
> + struct rtw8822cs_efuse s;
> };
> };
>
> --
> 2.39.2


2023-02-22 12:31:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 1/5] wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()

Martin Blumenstingl <[email protected]> wrote:

> rtw_pwr_seq_parser() needs to know about the HCI bus interface mask for
> the SDIO bus so it can parse the chip state change sequences.
>
> Signed-off-by: Martin Blumenstingl <[email protected]>
> Reviewed-by: Ping-Ke Shih <[email protected]>

5 patches applied to wireless-next.git, thanks.

96c79da2e4d1 wifi: rtw88: mac: Add support for the SDIO HCI in rtw_pwr_seq_parser()
8599ea40582d wifi: rtw88: mac: Add SDIO HCI support in the TX/page table setup
64e9d5646535 wifi: rtw88: rtw8821c: Implement RTL8821CS (SDIO) efuse parsing
9e688784b8a1 wifi: rtw88: rtw8822b: Implement RTL8822BS (SDIO) efuse parsing
ad0a677bce20 wifi: rtw88: rtw8822c: Implement RTL8822CS (SDIO) efuse parsing

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches