diff mbox series

[do,not,merge,4/4] wifi: mwifiex: add iw61x support

Message ID 20250326-mwifiex-iw61x-v1-4-ff875ed35efc@pengutronix.de (mailing list archive)
State New
Headers show
Series wifi: mwifiex: add iw61x support | expand

Commit Message

Sascha Hauer March 26, 2025, 12:18 p.m. UTC
This adds iw61x aka SD9177 support to the mwifiex driver. It is named
SD9177 in the downstream driver, I deliberately chose the NXP name in
the driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 79 +++++++++++++++++++++++++++++
 drivers/net/wireless/marvell/mwifiex/sdio.h |  3 ++
 include/linux/mmc/sdio_ids.h                |  3 ++
 3 files changed, 85 insertions(+)

Comments

Francesco Dolcini March 26, 2025, 12:23 p.m. UTC | #1
On Wed, Mar 26, 2025 at 01:18:34PM +0100, Sascha Hauer wrote:
> This adds iw61x aka SD9177 support to the mwifiex driver. It is named
> SD9177 in the downstream driver, I deliberately chose the NXP name in
> the driver.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/net/wireless/marvell/mwifiex/sdio.c | 79 +++++++++++++++++++++++++++++
>  drivers/net/wireless/marvell/mwifiex/sdio.h |  3 ++
>  include/linux/mmc/sdio_ids.h                |  3 ++
>  3 files changed, 85 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> index cbcb5674b8036..7b4045a40df57 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c

...

> @@ -3212,3 +3289,5 @@ MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME);
>  MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME);
>  MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME);
>  MODULE_FIRMWARE(SD8997_SDIOUART_FW_NAME);
> +MODULE_FIRMWARE(IW612_DEFAULT_FW_NAME);
> +MODULE_FIRMWARE(IW612_SDIOUART_FW_NAME);
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h
> index 65d142286c46e..97759456314b0 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.h
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h
> @@ -29,6 +29,9 @@
>  #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"
>  #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin"
>  #define SD8997_SDIOUART_FW_NAME "mrvl/sdiouart8997_combo_v4.bin"
> +#define IW612_DEFAULT_FW_NAME "nxp/sdsd_nw61x.bin"
> +#define IW612_SDIOUART_FW_NAME "nxp/sd_w61x.bin"

Is there a way to have BT over SDIO with iw61x? I was sure only sd-uart was
possible.

Francesco
Sascha Hauer March 26, 2025, 1:54 p.m. UTC | #2
Hi Francesco,

On Wed, Mar 26, 2025 at 01:23:35PM +0100, Francesco Dolcini wrote:
> On Wed, Mar 26, 2025 at 01:18:34PM +0100, Sascha Hauer wrote:
> > This adds iw61x aka SD9177 support to the mwifiex driver. It is named
> > SD9177 in the downstream driver, I deliberately chose the NXP name in
> > the driver.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  drivers/net/wireless/marvell/mwifiex/sdio.c | 79 +++++++++++++++++++++++++++++
> >  drivers/net/wireless/marvell/mwifiex/sdio.h |  3 ++
> >  include/linux/mmc/sdio_ids.h                |  3 ++
> >  3 files changed, 85 insertions(+)
> > 
> > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > index cbcb5674b8036..7b4045a40df57 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> 
> ...
> 
> > @@ -3212,3 +3289,5 @@ MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME);
> >  MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME);
> >  MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME);
> >  MODULE_FIRMWARE(SD8997_SDIOUART_FW_NAME);
> > +MODULE_FIRMWARE(IW612_DEFAULT_FW_NAME);
> > +MODULE_FIRMWARE(IW612_SDIOUART_FW_NAME);
> > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > index 65d142286c46e..97759456314b0 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/sdio.h
> > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > @@ -29,6 +29,9 @@
> >  #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"
> >  #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin"
> >  #define SD8997_SDIOUART_FW_NAME "mrvl/sdiouart8997_combo_v4.bin"
> > +#define IW612_DEFAULT_FW_NAME "nxp/sdsd_nw61x.bin"
> > +#define IW612_SDIOUART_FW_NAME "nxp/sd_w61x.bin"
> 
> Is there a way to have BT over SDIO with iw61x? I was sure only sd-uart was
> possible.

The communication to the Bluetooth module indeed is UART only.

I think nxp/sdsd_nw61x.bin contains firmwares for both the WiFi and
Bluetooth chip. When using this you can use the Bluetooth UART directly
without uploading a separate Bluetooth firmware.

nxp/sd_w61x.bin only contains the WiFi firmware, so you have to
upload a separate Bluetooth firmware over the UART interface.

Sascha
Francesco Dolcini March 27, 2025, 9:33 a.m. UTC | #3
On Wed, Mar 26, 2025 at 02:54:35PM +0100, Sascha Hauer wrote:
> On Wed, Mar 26, 2025 at 01:23:35PM +0100, Francesco Dolcini wrote:
> > On Wed, Mar 26, 2025 at 01:18:34PM +0100, Sascha Hauer wrote:
> > > This adds iw61x aka SD9177 support to the mwifiex driver. It is named
> > > SD9177 in the downstream driver, I deliberately chose the NXP name in
> > > the driver.
> > > 
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > ---
> > >  drivers/net/wireless/marvell/mwifiex/sdio.c | 79 +++++++++++++++++++++++++++++
> > >  drivers/net/wireless/marvell/mwifiex/sdio.h |  3 ++
> > >  include/linux/mmc/sdio_ids.h                |  3 ++
> > >  3 files changed, 85 insertions(+)
> > > 
> > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > index cbcb5674b8036..7b4045a40df57 100644
> > > --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > 
> > ...
> > 
> > > @@ -3212,3 +3289,5 @@ MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME);
> > >  MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME);
> > >  MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME);
> > >  MODULE_FIRMWARE(SD8997_SDIOUART_FW_NAME);
> > > +MODULE_FIRMWARE(IW612_DEFAULT_FW_NAME);
> > > +MODULE_FIRMWARE(IW612_SDIOUART_FW_NAME);
> > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > index 65d142286c46e..97759456314b0 100644
> > > --- a/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > @@ -29,6 +29,9 @@
> > >  #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"
> > >  #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin"
> > >  #define SD8997_SDIOUART_FW_NAME "mrvl/sdiouart8997_combo_v4.bin"
> > > +#define IW612_DEFAULT_FW_NAME "nxp/sdsd_nw61x.bin"
> > > +#define IW612_SDIOUART_FW_NAME "nxp/sd_w61x.bin"
> > 
> > Is there a way to have BT over SDIO with iw61x? I was sure only sd-uart was
> > possible.
> 
> The communication to the Bluetooth module indeed is UART only.
> 
> I think nxp/sdsd_nw61x.bin contains firmwares for both the WiFi and
> Bluetooth chip. When using this you can use the Bluetooth UART directly
> without uploading a separate Bluetooth firmware.
> 
> nxp/sd_w61x.bin only contains the WiFi firmware, so you have to
> upload a separate Bluetooth firmware over the UART interface.

If that the case what you did here is not correct.

The 2 firmware files here are used file depending on the BT host interface used
on the Wi-Fi/BT chip, and this is read from some strapping register. See commit
255ca28a659d ("mwifiex: Select firmware based on strapping").

BTW, this name sdsd_nw61x.bin is confusing, I would have expected this to be
something like sduart_nw61x.bin.

Francesco
Ernest Van Hoecke March 28, 2025, 3:05 p.m. UTC | #4
On Wed, Mar 26, 2025 at 01:18:34PM +0100, Sascha Hauer wrote:
> This adds iw61x aka SD9177 support to the mwifiex driver. It is named
> SD9177 in the downstream driver, I deliberately chose the NXP name in
> the driver.

Hi Sascha,

Thanks for sharing these patches. To test, I applied them to our
downstream branch based on the NXP BSP 6.6.52-2.2.0 and can confirm that
the driver works well on our iMX95-based board which uses a ublox
MAYA-W260 (IW611) for WiFi (SDIO) and BT (UART). Both STA and AP mode
looked good to me.

Kind regards,
Ernest
Sascha Hauer March 28, 2025, 3:10 p.m. UTC | #5
On Thu, Mar 27, 2025 at 10:33:17AM +0100, Francesco Dolcini wrote:
> On Wed, Mar 26, 2025 at 02:54:35PM +0100, Sascha Hauer wrote:
> > On Wed, Mar 26, 2025 at 01:23:35PM +0100, Francesco Dolcini wrote:
> > > On Wed, Mar 26, 2025 at 01:18:34PM +0100, Sascha Hauer wrote:
> > > > This adds iw61x aka SD9177 support to the mwifiex driver. It is named
> > > > SD9177 in the downstream driver, I deliberately chose the NXP name in
> > > > the driver.
> > > > 
> > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > > > ---
> > > >  drivers/net/wireless/marvell/mwifiex/sdio.c | 79 +++++++++++++++++++++++++++++
> > > >  drivers/net/wireless/marvell/mwifiex/sdio.h |  3 ++
> > > >  include/linux/mmc/sdio_ids.h                |  3 ++
> > > >  3 files changed, 85 insertions(+)
> > > > 
> > > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > > index cbcb5674b8036..7b4045a40df57 100644
> > > > --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> > > 
> > > ...
> > > 
> > > > @@ -3212,3 +3289,5 @@ MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME);
> > > >  MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME);
> > > >  MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME);
> > > >  MODULE_FIRMWARE(SD8997_SDIOUART_FW_NAME);
> > > > +MODULE_FIRMWARE(IW612_DEFAULT_FW_NAME);
> > > > +MODULE_FIRMWARE(IW612_SDIOUART_FW_NAME);
> > > > diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > > index 65d142286c46e..97759456314b0 100644
> > > > --- a/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > > +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h
> > > > @@ -29,6 +29,9 @@
> > > >  #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"
> > > >  #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin"
> > > >  #define SD8997_SDIOUART_FW_NAME "mrvl/sdiouart8997_combo_v4.bin"
> > > > +#define IW612_DEFAULT_FW_NAME "nxp/sdsd_nw61x.bin"
> > > > +#define IW612_SDIOUART_FW_NAME "nxp/sd_w61x.bin"
> > > 
> > > Is there a way to have BT over SDIO with iw61x? I was sure only sd-uart was
> > > possible.
> > 
> > The communication to the Bluetooth module indeed is UART only.
> > 
> > I think nxp/sdsd_nw61x.bin contains firmwares for both the WiFi and
> > Bluetooth chip. When using this you can use the Bluetooth UART directly
> > without uploading a separate Bluetooth firmware.
> > 
> > nxp/sd_w61x.bin only contains the WiFi firmware, so you have to
> > upload a separate Bluetooth firmware over the UART interface.
> 
> If that the case what you did here is not correct.
> 
> The 2 firmware files here are used file depending on the BT host interface used
> on the Wi-Fi/BT chip, and this is read from some strapping register. See commit
> 255ca28a659d ("mwifiex: Select firmware based on strapping").
> 
> BTW, this name sdsd_nw61x.bin is confusing, I would have expected this to be
> something like sduart_nw61x.bin.

You are right, there seem to be some things mixed up. I'll have a look
into it for the next round.

Sascha
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index cbcb5674b8036..7b4045a40df57 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -318,6 +318,62 @@  static const struct mwifiex_sdio_card_reg mwifiex_reg_sd89xx = {
 				 0x68, 0x69, 0x6a},
 };
 
+static const struct mwifiex_sdio_card_reg mwifiex_reg_iw612 = {
+	.start_rd_port = 0,
+	.start_wr_port = 0,
+	.base_0_reg = 0xF8,
+	.base_1_reg = 0xF9,
+	.poll_reg = 0x5C,
+	.host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK |
+			CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK,
+	.host_int_rsr_reg = 0x4,
+	.host_int_status_reg = 0x0C,
+	.host_int_mask_reg = 0x08,
+	.host_strap_reg = 0xF4,
+	.host_strap_mask = 0x01,
+	.host_strap_value = 0x01,
+	.status_reg_0 = 0xE8,
+	.status_reg_1 = 0xE9,
+	.sdio_int_mask = 0xff,
+	.data_port_mask = 0xffffffff,
+	.io_port_0_reg = 0xE4,
+	.io_port_1_reg = 0xE5,
+	.io_port_2_reg = 0xE6,
+	.max_mp_regs = 196,
+	.rd_bitmap_l = 0x10,
+	.rd_bitmap_u = 0x11,
+	.rd_bitmap_1l = 0x12,
+	.rd_bitmap_1u = 0x13,
+	.wr_bitmap_l = 0x14,
+	.wr_bitmap_u = 0x15,
+	.wr_bitmap_1l = 0x16,
+	.wr_bitmap_1u = 0x17,
+	.rd_len_p0_l = 0x18,
+	.rd_len_p0_u = 0x19,
+	.card_misc_cfg_reg = 0xd8,
+	.card_cfg_2_1_reg = 0xd9,
+	.cmd_rd_len_0 = 0xc0,
+	.cmd_rd_len_1 = 0xc1,
+	.cmd_rd_len_2 = 0xc2,
+	.cmd_rd_len_3 = 0xc3,
+	.cmd_cfg_0 = 0xc4,
+	.cmd_cfg_1 = 0xc5,
+	.cmd_cfg_2 = 0xc6,
+	.cmd_cfg_3 = 0xc7,
+	.fw_dump_host_ready = 0xcc,
+	.fw_dump_ctrl = 0xf0,
+	.fw_dump_start = 0xf1,
+	.fw_dump_end = 0xf8,
+	.func1_dump_reg_start = 0x10,
+	.func1_dump_reg_end = 0x17,
+	.func1_scratch_reg = 0xe8,
+	.func1_spec_reg_num = 13,
+	.func1_spec_reg_table = {0x08, 0x58, 0x5C, 0x5D,
+				 0x60, 0x61, 0x62, 0x64,
+				 0x65, 0x66, 0x68, 0x69,
+				 0x6a},
+};
+
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
 	.firmware = SD8786_DEFAULT_FW_NAME,
 	.reg = &mwifiex_reg_sd87xx,
@@ -441,6 +497,25 @@  static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
 	.host_mlme = false,
 };
 
+static const struct mwifiex_sdio_device mwifiex_sdio_iw612 = {
+	.firmware = IW612_DEFAULT_FW_NAME,
+	.firmware_sdiouart = IW612_SDIOUART_FW_NAME,
+	.reg = &mwifiex_reg_iw612,
+	.max_ports = 32,
+	.mp_agg_pkt_limit = 16,
+	.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
+	.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_MAX,
+	.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_MAX,
+	.supports_sdio_new_mode = true,
+	.has_control_mask = false,
+	.can_dump_fw = true,
+	.fw_dump_enh = true,
+	.can_auto_tdls = false,
+	.can_ext_scan = true,
+	.fw_ready_extra_delay = false,
+	.host_mlme = true,
+};
+
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
 	.firmware = SD8887_DEFAULT_FW_NAME,
 	.reg = &mwifiex_reg_sd8887,
@@ -974,6 +1049,8 @@  static const struct sdio_device_id mwifiex_ids[] = {
 		.driver_data = (unsigned long)&mwifiex_sdio_sd8987},
 	{SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8997_WLAN),
 		.driver_data = (unsigned long)&mwifiex_sdio_sd8997},
+	{SDIO_DEVICE(SDIO_VENDOR_ID_NXP, SDIO_DEVICE_ID_NXP_IW612_WLAN),
+		.driver_data = (unsigned long)&mwifiex_sdio_iw612},
 	{},
 };
 
@@ -3212,3 +3289,5 @@  MODULE_FIRMWARE(SD8978_SDIOUART_FW_NAME);
 MODULE_FIRMWARE(SD8987_DEFAULT_FW_NAME);
 MODULE_FIRMWARE(SD8997_DEFAULT_FW_NAME);
 MODULE_FIRMWARE(SD8997_SDIOUART_FW_NAME);
+MODULE_FIRMWARE(IW612_DEFAULT_FW_NAME);
+MODULE_FIRMWARE(IW612_SDIOUART_FW_NAME);
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h
index 65d142286c46e..97759456314b0 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.h
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.h
@@ -29,6 +29,9 @@ 
 #define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"
 #define SD8997_DEFAULT_FW_NAME "mrvl/sdsd8997_combo_v4.bin"
 #define SD8997_SDIOUART_FW_NAME "mrvl/sdiouart8997_combo_v4.bin"
+#define IW612_DEFAULT_FW_NAME "nxp/sdsd_nw61x.bin"
+#define IW612_SDIOUART_FW_NAME "nxp/sd_w61x.bin"
+
 
 #define BLOCK_MODE	1
 #define BYTE_MODE	0
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 7cddfdac2f576..a421c58abd331 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -115,6 +115,9 @@ 
 #define SDIO_VENDOR_ID_MICROCHIP_WILC		0x0296
 #define SDIO_DEVICE_ID_MICROCHIP_WILC1000	0x5347
 
+#define SDIO_VENDOR_ID_NXP			0x0471
+#define SDIO_DEVICE_ID_NXP_IW612_WLAN		0x0205
+
 #define SDIO_VENDOR_ID_REALTEK			0x024c
 #define SDIO_DEVICE_ID_REALTEK_RTW8723BS	0xb723
 #define SDIO_DEVICE_ID_REALTEK_RTW8821BS	0xb821