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).
[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]/
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 | 10 ++++++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.h | 6 ++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 6 ++++++
7 files changed, 55 insertions(+)
--
2.39.1
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]>
---
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 10 ++++++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.h | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 74dfb89b2c94..4ed5b98fab23 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -26,10 +26,17 @@ static void rtw8822be_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->e.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 void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse,
struct rtw8822b_efuse *map)
{
ether_addr_copy(efuse->addr, map->u.mac_addr);
+
}
static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
@@ -62,6 +69,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_PCIE:
rtw8822be_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8822bs_efuse_parsing(efuse, map);
+ break;
case RTW_HCI_TYPE_USB:
rtw8822bu_efuse_parsing(efuse, map);
break;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.h b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
index 01d3644e0c94..8d05805c046c 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];
@@ -94,6 +99,7 @@ struct rtw8822b_efuse {
union {
struct rtw8822bu_efuse u;
struct rtw8822be_efuse e;
+ struct rtw8822bs_efuse s;
};
};
--
2.39.1
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]>
---
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 9 +++++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 6 ++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 964e27887fe2..8ec779c7ab84 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -29,6 +29,12 @@ static void rtw8822ce_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->e.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 void rtw8822cu_efuse_parsing(struct rtw_efuse *efuse,
struct rtw8822c_efuse *map)
{
@@ -64,6 +70,9 @@ static int rtw8822c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_PCIE:
rtw8822ce_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8822cs_efuse_parsing(efuse, map);
+ break;
case RTW_HCI_TYPE_USB:
rtw8822cu_efuse_parsing(efuse, map);
break;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
index 479d5d769c52..959d6537b2fe 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];
@@ -92,6 +97,7 @@ struct rtw8822c_efuse {
u8 res10[0x42];
union {
struct rtw8822cu_efuse u;
+ struct rtw8822cs_efuse s;
struct rtw8822ce_efuse e;
};
};
--
2.39.1
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.1
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]>
---
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..dd01b22f9770 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -26,6 +26,12 @@ static void rtw8821ce_efuse_parsing(struct rtw_efuse *efuse,
ether_addr_copy(efuse->addr, map->e.mac_addr);
}
+static void rtw8821cs_efuse_parsing(struct rtw_efuse *efuse,
+ struct rtw8821c_efuse *map)
+{
+ ether_addr_copy(efuse->addr, map->s.mac_addr);
+}
+
static void rtw8821cu_efuse_parsing(struct rtw_efuse *efuse,
struct rtw8821c_efuse *map)
{
@@ -74,6 +80,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
case RTW_HCI_TYPE_PCIE:
rtw8821ce_efuse_parsing(efuse, map);
break;
+ case RTW_HCI_TYPE_SDIO:
+ rtw8821cs_efuse_parsing(efuse, map);
+ break;
case RTW_HCI_TYPE_USB:
rtw8821cu_efuse_parsing(efuse, map);
break;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.h b/drivers/net/wireless/realtek/rtw88/rtw8821c.h
index 1c81260f3a54..1cc77a42be6f 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];
@@ -93,6 +98,7 @@ struct rtw8821c_efuse {
u8 res[3];
union {
struct rtw8821ce_efuse e;
+ struct rtw8821cs_efuse s;
struct rtw8821cu_efuse u;
};
};
--
2.39.1
> -----Original Message-----
> From: Martin Blumenstingl <[email protected]>
> Sent: Wednesday, February 15, 2023 5:14 AM
> 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 v1 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]>
> ---
> drivers/net/wireless/realtek/rtw88/rtw8822b.c | 10 ++++++++++
> drivers/net/wireless/realtek/rtw88/rtw8822b.h | 6 ++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> index 74dfb89b2c94..4ed5b98fab23 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
> @@ -26,10 +26,17 @@ static void rtw8822be_efuse_parsing(struct rtw_efuse *efuse,
> ether_addr_copy(efuse->addr, map->e.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 void rtw8822bu_efuse_parsing(struct rtw_efuse *efuse,
> struct rtw8822b_efuse *map)
> {
> ether_addr_copy(efuse->addr, map->u.mac_addr);
> +
Don't need to stir USB code.
> }
>
> static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> @@ -62,6 +69,9 @@ static int rtw8822b_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
> case RTW_HCI_TYPE_PCIE:
> rtw8822be_efuse_parsing(efuse, map);
> break;
> + case RTW_HCI_TYPE_SDIO:
> + rtw8822bs_efuse_parsing(efuse, map);
> + break;
> case RTW_HCI_TYPE_USB:
> rtw8822bu_efuse_parsing(efuse, map);
> break;
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> b/drivers/net/wireless/realtek/rtw88/rtw8822b.h
> index 01d3644e0c94..8d05805c046c 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];
> @@ -94,6 +99,7 @@ struct rtw8822b_efuse {
> union {
> struct rtw8822bu_efuse u;
> struct rtw8822be_efuse e;
> + struct rtw8822bs_efuse s;
No obvious problem in whole patchset. Only a nit about the order of PCIE-USB-SDIO.
Can we have them in consistent order?
Here, the order is USB-PCIE-SDIO, but patch 3/5 and 5/5 in different order.
It seems like we messed up the order when adding USB, but we can correct them
along with this patch. My prefer order is PCIE-USB-SDIO after adding SDIO,
because the order of existing code of 'switch...case' is PCIE-USB.
Apply this rule not only here also 'switch...case' and 'efuse parser'.
Ping-Ke