Devicetree
 help / color / mirror / Atom feed
* [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support
@ 2026-11-19 17:49 Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 01/10] wifi: cw1200: avoid removing the debugfs directory twice Arthur Heymans
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

The XRadio XR819 is a 2.4 GHz 802.11b/g/n SDIO chip found on Allwinner
boards such as the Orange Pi Zero. XRadio likely bought the IP from
ST-Ericsson: the XR819's host interface is based on the WSM interface
of the CW1x60, and it reports the CW1x60 hardware revision. This series
therefore adds it to cw1200 rather than adding a new driver.

Patches 1-5 fix existing cw1200 bugs. They do not depend on the XR819
changes and carry Fixes: tags:

  1  a double debugfs removal on unbind
  2  SDD elements read without length checks or unaligned access
  3  SDIO transfers from stack buffers
  4  GPIO interrupt setup not unwound on error
  5  mac80211 unregistered after the interrupt is freed, so every
     unbind of an associated device ends with "stuck in firmware,
     killing BH"

Patches 6-7 add the vendor prefix and a binding for the SDIO function,
with an optional GPIO interrupt and MAC address. Patches 8-9 add the
XR819: a first-stage loader written to SRAM before the usual firmware
download, the SDIO ID 0020:2281, and a card reset on probe so that the
device can be bound again after an unbind. Patch 10 takes over the
orphaned driver as Odd Fixes, as I presume someone needs to do it?

Firmware
--------
The vendor firmware is not redistributable, and it speaks a dialect of
WSM that cw1200 does not: it reads bits 6-7 of the message ID as an
interface number where cw1200 puts a link ID, and its TX confirmations
carry per-rate retry counts in place of the media and queue delays.
The firmware these patches are tested with therefore comes from a
reverse-engineering project and speaks the WSM that cw1200 expects.
The firmware is written in rust and runs on a ARM966E-S core. It
is licensed MIT OR Apache-2.0 and builds the three files the driver
requests, xr819/boot_xr819.bin, xr819/fw_xr819.bin and
xr819/sdd_xr819.bin (this one is pure calibration data).
Code repo:

  https://github.com/ArthurHeymans/xradio-open-firmware

Documentation on the hardware obtained through reverse engineering and
black box testing.

  https://arthurheymans.github.io/xradio-open-firmware/

I plan to submit them to linux-firmware once the driver side is
settled.

Testing
-------
Tested on an Orange Pi Zero against an Intel peer with WPA2: station,
access point, a 10-minute traffic soak, and repeated unbind and bind
with both the SDIO and a GPIO interrupt. SPI is build-tested only, and
without CW1200 hardware, patches 1-5 are tested on the XR819 only.
Details:
https://arthurheymans.github.io/xradio-open-firmware/orange-pi-zero-smoke.html

Tools
-----
The patches were written with AI coding assistants from my instructions:
OpenAI Codex for patches 1-4 and 6-9, Anthropic Claude for patches 5
and 10. The assistants also ran the board tests above on my hardware.
I have reviewed every patch and take responsibility for them.

Arthur Heymans (10):
  wifi: cw1200: avoid removing the debugfs directory twice
  wifi: cw1200: check SDD element lengths before reading them
  wifi: cw1200: bounce SDIO transfers that use stack buffers
  wifi: cw1200: unwind GPIO interrupt setup on error
  wifi: cw1200: unregister from mac80211 before freeing the interrupt
  dt-bindings: vendor-prefixes: add XRadio
  dt-bindings: net: wireless: add XRadio XR819
  wifi: cw1200: load the XR819 bootloader into SRAM
  wifi: cw1200: add XR819 SDIO support
  MAINTAINERS: add myself for the cw1200 driver

 .../bindings/net/wireless/xradio,xr819.yaml   |  49 +++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   4 +-
 drivers/net/wireless/st/cw1200/Kconfig        |   6 +-
 drivers/net/wireless/st/cw1200/cw1200.h       |   9 +
 drivers/net/wireless/st/cw1200/cw1200_sdio.c  | 200 ++++++++++++++----
 drivers/net/wireless/st/cw1200/cw1200_spi.c   |   2 +
 drivers/net/wireless/st/cw1200/debug.c        |  19 +-
 drivers/net/wireless/st/cw1200/debug.h        |   1 -
 drivers/net/wireless/st/cw1200/fwio.c         |  67 +++++-
 drivers/net/wireless/st/cw1200/fwio.h         |   3 +
 drivers/net/wireless/st/cw1200/hwio.h         |   1 +
 drivers/net/wireless/st/cw1200/main.c         |  50 ++++-
 drivers/net/wireless/st/cw1200/sta.c          |  26 ++-
 include/linux/mmc/sdio_ids.h                  |   1 +
 15 files changed, 361 insertions(+), 79 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml


base-commit: e1dd8486807c1acf9551250b7f81e116a21e6ad6
-- 
2.56.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 01/10] wifi: cw1200: avoid removing the debugfs directory twice
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 02/10] wifi: cw1200: check SDD element lengths before reading them Arthur Heymans
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

Unregistering the wiphy removes its cw1200 debugfs directory. On SDIO
unbind, cw1200_debug_release() then tries to remove the stale dentry.
Leave directory removal to the wiphy and free the counters as before.

Prepared with OpenAI Codex.

Fixes: fa8eeae10257 ("cw1200: Remove "ITP" debug subsystem.")
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/debug.c | 19 ++++++++-----------
 drivers/net/wireless/st/cw1200/debug.h |  1 -
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/debug.c b/drivers/net/wireless/st/cw1200/debug.c
index 7dad6d3ba239..6b8b6ca35103 100644
--- a/drivers/net/wireless/st/cw1200/debug.c
+++ b/drivers/net/wireless/st/cw1200/debug.c
@@ -359,19 +359,20 @@ static const struct file_operations fops_wsm_dumps = {
 
 int cw1200_debug_init(struct cw1200_common *priv)
 {
+	struct dentry *dir;
 	int ret = -ENOMEM;
 	struct cw1200_debug_priv *d = kzalloc_obj(struct cw1200_debug_priv);
 	priv->debug = d;
 	if (!d)
 		return ret;
 
-	d->debugfs_phy = debugfs_create_dir("cw1200",
-					    priv->hw->wiphy->debugfsdir);
-	debugfs_create_file("status", 0400, d->debugfs_phy, priv,
+	/* wiphy_unregister() removes the whole subtree. */
+	dir = debugfs_create_dir("cw1200", priv->hw->wiphy->debugfsdir);
+	debugfs_create_file("status", 0400, dir, priv,
 			    &cw1200_status_fops);
-	debugfs_create_file("counters", 0400, d->debugfs_phy, priv,
+	debugfs_create_file("counters", 0400, dir, priv,
 			    &cw1200_counters_fops);
-	debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy, priv,
+	debugfs_create_file("wsm_dumps", 0200, dir, priv,
 			    &fops_wsm_dumps);
 
 	return 0;
@@ -379,10 +380,6 @@ int cw1200_debug_init(struct cw1200_common *priv)
 
 void cw1200_debug_release(struct cw1200_common *priv)
 {
-	struct cw1200_debug_priv *d = priv->debug;
-	if (d) {
-		debugfs_remove_recursive(d->debugfs_phy);
-		priv->debug = NULL;
-		kfree(d);
-	}
+	kfree(priv->debug);
+	priv->debug = NULL;
 }
diff --git a/drivers/net/wireless/st/cw1200/debug.h b/drivers/net/wireless/st/cw1200/debug.h
index 80bc1567533a..339a375b4c18 100644
--- a/drivers/net/wireless/st/cw1200/debug.h
+++ b/drivers/net/wireless/st/cw1200/debug.h
@@ -10,7 +10,6 @@
 #define CW1200_DEBUG_H_INCLUDED
 
 struct cw1200_debug_priv {
-	struct dentry *debugfs_phy;
 	int tx;
 	int tx_agg;
 	int rx;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 02/10] wifi: cw1200: check SDD element lengths before reading them
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 01/10] wifi: cw1200: avoid removing the debugfs directory twice Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 03/10] wifi: cw1200: bounce SDIO transfers that use stack buffers Arthur Heymans
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

SDD elements have byte alignment. Read the PTA and reference clock
fields with get_unaligned_le16() and reject short elements instead of
using incomplete board configuration data.

Prepared with OpenAI Codex.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/sta.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/sta.c b/drivers/net/wireless/st/cw1200/sta.c
index 5d8eaa700779..db9f0c4a07aa 100644
--- a/drivers/net/wireless/st/cw1200/sta.c
+++ b/drivers/net/wireless/st/cw1200/sta.c
@@ -11,6 +11,7 @@
 #include <linux/firmware.h>
 #include <linux/module.h>
 #include <linux/etherdevice.h>
+#include <linux/unaligned.h>
 
 #include "cw1200.h"
 #include "sta.h"
@@ -1072,28 +1073,34 @@ static int cw1200_parse_sdd_file(struct cw1200_common *priv)
 	while (p + 2 <= priv->sdd->data + priv->sdd->size) {
 		if (p + p[1] + 2 > priv->sdd->data + priv->sdd->size) {
 			pr_warn("Malformed sdd structure\n");
-			return -1;
+			return -EINVAL;
 		}
 		switch (p[0]) {
 		case SDD_PTA_CFG_ELT_ID: {
 			u16 v;
+
 			if (p[1] < 4) {
 				pr_warn("SDD_PTA_CFG_ELT_ID malformed\n");
-				ret = -1;
-				break;
+				return -EINVAL;
 			}
-			v = le16_to_cpu(*((__le16 *)(p + 2)));
+			v = get_unaligned_le16(p + 2);
 			if (!v)  /* non-zero means this is enabled */
 				break;
 
-			v = le16_to_cpu(*((__le16 *)(p + 4)));
+			v = get_unaligned_le16(p + 4);
 			priv->conf_listen_interval = (v >> 7) & 0x1F;
 			pr_debug("PTA found; Listen Interval %d\n",
 				 priv->conf_listen_interval);
 			break;
 		}
 		case SDD_REFERENCE_FREQUENCY_ELT_ID: {
-			u16 clk = le16_to_cpu(*((__le16 *)(p + 2)));
+			u16 clk;
+
+			if (p[1] < sizeof(clk)) {
+				pr_warn("SDD reference frequency malformed\n");
+				return -EINVAL;
+			}
+			clk = get_unaligned_le16(p + 2);
 			if (clk != priv->hw_refclk)
 				pr_warn("SDD file doesn't match configured refclk (%d vs %d)\n",
 					clk, priv->hw_refclk);
@@ -1147,7 +1154,12 @@ int cw1200_setup_mac(struct cw1200_common *priv)
 			pr_err("Can't load sdd file %s.\n", priv->sdd_path);
 			return ret;
 		}
-		cw1200_parse_sdd_file(priv);
+		ret = cw1200_parse_sdd_file(priv);
+		if (ret) {
+			release_firmware(priv->sdd);
+			priv->sdd = NULL;
+			return ret;
+		}
 	}
 
 	cfg.dpdData = priv->sdd->data;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 03/10] wifi: cw1200: bounce SDIO transfers that use stack buffers
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 01/10] wifi: cw1200: avoid removing the debugfs directory twice Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 02/10] wifi: cw1200: check SDD element lengths before reading them Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 04/10] wifi: cw1200: unwind GPIO interrupt setup on error Arthur Heymans
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

Register accesses pass stack words to sdio_memcpy_fromio() and
sdio_memcpy_toio(). Use a heap buffer for stack and non-linear
addresses; keep the direct path for ordinary packet buffers.

Prepared with OpenAI Codex.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/cw1200_sdio.c | 35 ++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
index 2b6afe221268..1894359ee9b4 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
@@ -10,6 +10,9 @@
 #include <linux/interrupt.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/sched/task_stack.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/card.h>
@@ -61,14 +64,42 @@ static int cw1200_sdio_memcpy_fromio(struct hwbus_priv *self,
 				     unsigned int addr,
 				     void *dst, int count)
 {
-	return sdio_memcpy_fromio(self->func, dst, addr, count);
+	void *bounce;
+	int ret;
+
+	if (virt_addr_valid(dst) && !object_is_on_stack(dst))
+		return sdio_memcpy_fromio(self->func, dst, addr, count);
+
+	bounce = kmalloc(count, GFP_KERNEL);
+	if (!bounce)
+		return -ENOMEM;
+
+	ret = sdio_memcpy_fromio(self->func, bounce, addr, count);
+	if (!ret)
+		memcpy(dst, bounce, count);
+	kfree(bounce);
+
+	return ret;
 }
 
 static int cw1200_sdio_memcpy_toio(struct hwbus_priv *self,
 				   unsigned int addr,
 				   const void *src, int count)
 {
-	return sdio_memcpy_toio(self->func, addr, (void *)src, count);
+	void *bounce;
+	int ret;
+
+	if (virt_addr_valid(src) && !object_is_on_stack(src))
+		return sdio_memcpy_toio(self->func, addr, (void *)src, count);
+
+	bounce = kmemdup(src, count, GFP_KERNEL);
+	if (!bounce)
+		return -ENOMEM;
+
+	ret = sdio_memcpy_toio(self->func, addr, bounce, count);
+	kfree(bounce);
+
+	return ret;
 }
 
 static void cw1200_sdio_lock(struct hwbus_priv *self)
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 04/10] wifi: cw1200: unwind GPIO interrupt setup on error
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (2 preceding siblings ...)
  2026-11-19 17:49 ` [PATCH wireless-next 03/10] wifi: cw1200: bounce SDIO transfers that use stack buffers Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 05/10] wifi: cw1200: unregister from mac80211 before freeing the interrupt Arthur Heymans
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

If requesting the GPIO interrupt fails, the wake reference and the
card interrupt enables remain set. Drop the wake reference and restore
the original CCCR interrupt-enable byte on the error paths.

Prepared with OpenAI Codex.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/cw1200_sdio.c | 38 ++++++++++----------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
index 1894359ee9b4..dda201e69735 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
@@ -143,37 +143,35 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
 static int cw1200_request_irq(struct hwbus_priv *self)
 {
 	int ret;
-	u8 cccr;
+	int err;
+	u8 ien;
 
-	cccr = sdio_f0_readb(self->func, SDIO_CCCR_IENx, &ret);
-	if (WARN_ON(ret))
-		goto err;
-
-	/* Master interrupt enable ... */
-	cccr |= BIT(0);
-
-	/* ... for our function */
-	cccr |= BIT(self->func->num);
+	ien = sdio_f0_readb(self->func, SDIO_CCCR_IENx, &ret);
+	if (ret)
+		return ret;
 
-	sdio_f0_writeb(self->func, cccr, SDIO_CCCR_IENx, &ret);
-	if (WARN_ON(ret))
-		goto err;
+	sdio_f0_writeb(self->func, ien | BIT(0) | BIT(self->func->num),
+		       SDIO_CCCR_IENx, &ret);
+	if (ret)
+		return ret;
 
 	ret = enable_irq_wake(self->pdata->irq);
-	if (WARN_ON(ret))
-		goto err;
+	if (ret)
+		goto restore_ien;
 
 	/* Request the IRQ */
 	ret =  request_threaded_irq(self->pdata->irq, cw1200_gpio_hardirq,
 				    cw1200_gpio_irq,
 				    IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
 				    "cw1200_wlan_irq", self);
-	if (WARN_ON(ret))
-		goto err;
-
-	return 0;
+	if (!ret)
+		return 0;
 
-err:
+	disable_irq_wake(self->pdata->irq);
+restore_ien:
+	sdio_f0_writeb(self->func, ien, SDIO_CCCR_IENx, &err);
+	if (err)
+		dev_warn(&self->func->dev, "cannot restore interrupt enables: %d\n", err);
 	return ret;
 }
 
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 05/10] wifi: cw1200: unregister from mac80211 before freeing the interrupt
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (3 preceding siblings ...)
  2026-11-19 17:49 ` [PATCH wireless-next 04/10] wifi: cw1200: unwind GPIO interrupt setup on error Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 17:49 ` [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio Arthur Heymans
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

Removing the device unregisters the hardware from mac80211 only after the
bus driver has freed the interrupt and cw1200_core_release() has disabled
the device interrupts. Unregistering removes the interfaces, which sends
WSM commands such as RESET and CONFIGURATION, and their confirmations
then never arrive. Each unbind of an associated device waits for the
command timeout and ends with:

  CMD req (0x0009) stuck in firmware, killing BH
  [BH] Fatal error, exiting.

Add cw1200_core_unregister() and call it from the SDIO and SPI remove
paths while the interrupt still works. The interrupt is still freed
before cw1200_core_release() frees the device, as the handler uses it.

Tested on an Orange Pi Zero (XR819 over SDIO) with both the SDIO and a
GPIO interrupt: repeated unbind and bind while associated no longer
logs the error. The SPI change is build-tested only.

Prepared with Anthropic Claude.

Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/cw1200.h      |  1 +
 drivers/net/wireless/st/cw1200/cw1200_sdio.c |  2 ++
 drivers/net/wireless/st/cw1200/cw1200_spi.c  |  2 ++
 drivers/net/wireless/st/cw1200/main.c        | 13 +++++++++++--
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200.h b/drivers/net/wireless/st/cw1200/cw1200.h
index 48f808cdc1cb..6dc85ef6e0fa 100644
--- a/drivers/net/wireless/st/cw1200/cw1200.h
+++ b/drivers/net/wireless/st/cw1200/cw1200.h
@@ -293,6 +293,7 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
 		      struct cw1200_common **pself,
 		      int ref_clk, const u8 *macaddr,
 		      const char *sdd_path, bool have_5ghz);
+void cw1200_core_unregister(struct cw1200_common *self);
 void cw1200_core_release(struct cw1200_common *self);
 
 #define FWLOAD_BLOCK_SIZE (1024)
diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
index dda201e69735..4f4bd668ebd2 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
@@ -359,6 +359,8 @@ static void cw1200_sdio_disconnect(struct sdio_func *func)
 	struct hwbus_priv *self = sdio_get_drvdata(func);
 
 	if (self) {
+		if (self->core)
+			cw1200_core_unregister(self->core);
 		cw1200_sdio_irq_unsubscribe(self);
 		if (self->core) {
 			cw1200_core_release(self->core);
diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c
index f71e71e06359..c08d1ce5605d 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c
@@ -437,6 +437,8 @@ static void cw1200_spi_disconnect(struct spi_device *func)
 	struct hwbus_priv *self = spi_get_drvdata(func);
 
 	if (self) {
+		if (self->core)
+			cw1200_core_unregister(self->core);
 		cw1200_spi_irq_unsubscribe(self);
 		if (self->core) {
 			cw1200_core_release(self->core);
diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c
index 5d569eeb353f..ee9fcecb0100 100644
--- a/drivers/net/wireless/st/cw1200/main.c
+++ b/drivers/net/wireless/st/cw1200/main.c
@@ -456,8 +456,6 @@ static void cw1200_unregister_common(struct ieee80211_hw *dev)
 	struct cw1200_common *priv = dev->priv;
 	int i;
 
-	ieee80211_unregister_hw(dev);
-
 	timer_delete_sync(&priv->mcast_timeout);
 	cw1200_unregister_bh(priv);
 
@@ -594,6 +592,17 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
 }
 EXPORT_SYMBOL_GPL(cw1200_core_probe);
 
+/*
+ * Removing the interfaces sends WSM commands, which need the device
+ * interrupt for their confirmations, so the bus driver calls this before
+ * it frees its interrupt and calls cw1200_core_release().
+ */
+void cw1200_core_unregister(struct cw1200_common *self)
+{
+	ieee80211_unregister_hw(self->hw);
+}
+EXPORT_SYMBOL_GPL(cw1200_core_unregister);
+
 void cw1200_core_release(struct cw1200_common *self)
 {
 	/* Disable device interrupts */
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (4 preceding siblings ...)
  2026-11-19 17:49 ` [PATCH wireless-next 05/10] wifi: cw1200: unregister from mac80211 before freeing the interrupt Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 18:03   ` Conor Dooley
  2026-11-19 17:49 ` [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819 Arthur Heymans
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

Add the vendor prefix for XRadio Wi-Fi chips.

Prepared with OpenAI Codex.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 5471a06f93f1..066c2e90f289 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1959,6 +1959,8 @@ patternProperties:
     description: Xilinx
   "^xnano,.*":
     description: Xnano
+  "^xradio,.*":
+    description: XRadio Technology
   "^xunlong,.*":
     description: Shenzhen Xunlong Software CO.,Limited
   "^xylon,.*":
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (5 preceding siblings ...)
  2026-11-19 17:49 ` [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio Arthur Heymans
@ 2026-11-19 17:49 ` Arthur Heymans
  2026-11-19 18:01   ` Conor Dooley
  2026-11-19 18:03   ` sashiko-bot
  2026-11-19 17:50 ` [PATCH wireless-next 08/10] wifi: cw1200: load the XR819 bootloader into SRAM Arthur Heymans
                   ` (2 subsequent siblings)
  9 siblings, 2 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:49 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

The XR819 exposes one SDIO function. Boards may provide a MAC address
and wire a GPIO interrupt instead of using the SDIO interrupt.

Prepared with OpenAI Codex.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 .../bindings/net/wireless/xradio,xr819.yaml   | 49 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml

diff --git a/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
new file mode 100644
index 000000000000..4f6919b6bcbd
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wireless/xradio,xr819.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: XRadio XR819 SDIO wireless controller
+
+maintainers:
+  - Arthur Heymans <arthur@aheymans.xyz>
+
+description:
+  The XR819 is a 2.4 GHz IEEE 802.11b/g/n controller connected to the host
+  through SDIO. Its out-of-band interrupt may be connected to a host GPIO.
+
+properties:
+  compatible:
+    const: xradio,xr819
+
+  reg:
+    const: 1
+
+  interrupts:
+    maxItems: 1
+
+  local-mac-address: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    mmc {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        wifi@1 {
+            compatible = "xradio,xr819";
+            reg = <1>;
+            interrupt-parent = <&pio>;
+            interrupts = <10 IRQ_TYPE_EDGE_RISING>;
+            local-mac-address = [02 00 00 00 00 01];
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 0cf311e6c4be..6e7b5f6beba4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7211,6 +7211,7 @@ F:	Documentation/process/cve.rst
 CW1200 WLAN driver
 S:	Orphan
 L:	linux-wireless@vger.kernel.org
+F:	Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
 F:	drivers/net/wireless/st/
 F:	include/linux/platform_data/net-cw1200.h
 
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 08/10] wifi: cw1200: load the XR819 bootloader into SRAM
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (6 preceding siblings ...)
  2026-11-19 17:49 ` [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819 Arthur Heymans
@ 2026-11-19 17:50 ` Arthur Heymans
  2026-11-19 17:50 ` [PATCH wireless-next 09/10] wifi: cw1200: add XR819 SDIO support Arthur Heymans
  2026-11-19 17:50 ` [PATCH wireless-next 10/10] MAINTAINERS: add myself for the cw1200 driver Arthur Heymans
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:50 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

XR819 shares the CW1x60 revision field but needs a first-stage loader
at 0x08000000. Write it before releasing the CPU from reset, then use
the existing firmware download path.

Prepared with OpenAI Codex.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/cw1200.h |  8 +++
 drivers/net/wireless/st/cw1200/fwio.c   | 67 +++++++++++++++++++++++--
 drivers/net/wireless/st/cw1200/fwio.h   |  3 ++
 drivers/net/wireless/st/cw1200/hwio.h   |  1 +
 drivers/net/wireless/st/cw1200/main.c   | 37 +++++++++++---
 5 files changed, 105 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/cw1200.h b/drivers/net/wireless/st/cw1200/cw1200.h
index 6dc85ef6e0fa..b25b60d377f6 100644
--- a/drivers/net/wireless/st/cw1200/cw1200.h
+++ b/drivers/net/wireless/st/cw1200/cw1200.h
@@ -116,7 +116,9 @@ struct cw1200_common {
 		CW1200_HW_REV_CUT20 = 20,
 		CW1200_HW_REV_CUT22 = 22,
 		CW1X60_HW_REV       = 40,
+		XR819_HW_REV        = 41,
 	} hw_revision;
+	bool				is_xr819;
 	int                             hw_refclk;
 	bool				hw_have_5ghz;
 	const struct firmware		*sdd;
@@ -293,6 +295,12 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
 		      struct cw1200_common **pself,
 		      int ref_clk, const u8 *macaddr,
 		      const char *sdd_path, bool have_5ghz);
+int cw1200_core_probe_xr819(const struct hwbus_ops *hwbus_ops,
+			    struct hwbus_priv *hwbus,
+			    struct device *pdev,
+			    struct cw1200_common **pself,
+			    int ref_clk, const u8 *macaddr,
+			    const char *sdd_path);
 void cw1200_core_unregister(struct cw1200_common *self);
 void cw1200_core_release(struct cw1200_common *self);
 
diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c
index 2a03dc533b6a..08b6f02e3ffd 100644
--- a/drivers/net/wireless/st/cw1200/fwio.c
+++ b/drivers/net/wireless/st/cw1200/fwio.c
@@ -14,6 +14,7 @@
 #include <linux/vmalloc.h>
 #include <linux/sched.h>
 #include <linux/firmware.h>
+#include <linux/unaligned.h>
 
 #include "cw1200.h"
 #include "fwio.h"
@@ -116,6 +117,11 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
 		if (!priv->sdd_path)
 			priv->sdd_path = SDD_FILE_CW1X60;
 		break;
+	case XR819_HW_REV:
+		fw_path = FIRMWARE_XR819;
+		if (!priv->sdd_path)
+			priv->sdd_path = SDD_FILE_XR819;
+		break;
 	default:
 		pr_err("Invalid silicon revision %d.\n", priv->hw_revision);
 		return -EINVAL;
@@ -128,9 +134,11 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
 	APB_WRITE(DOWNLOAD_STATUS_REG, DOWNLOAD_PENDING);
 	APB_WRITE(DOWNLOAD_FLAGS_REG, 0);
 
-	/* Write the NOP Instruction */
-	REG_WRITE(ST90TDS_SRAM_BASE_ADDR_REG_ID, 0xFFF20000);
-	REG_WRITE(ST90TDS_AHB_DPORT_REG_ID, 0xEAFFFFFE);
+	if (!priv->is_xr819) {
+		/* Write the NOP Instruction */
+		REG_WRITE(ST90TDS_SRAM_BASE_ADDR_REG_ID, 0xFFF20000);
+		REG_WRITE(ST90TDS_AHB_DPORT_REG_ID, 0xEAFFFFFE);
+	}
 
 	/* Release CPU from RESET */
 	REG_READ(ST90TDS_CONFIG_REG_ID, val32);
@@ -261,6 +269,45 @@ static int cw1200_load_firmware_cw1200(struct cw1200_common *priv)
 #undef REG_READ
 }
 
+static int cw1200_load_bootloader_xr819(struct cw1200_common *priv)
+{
+	const struct firmware *bootloader;
+	u32 addr = XR819_BOOT_BASE;
+	size_t i;
+	int ret;
+
+	ret = request_firmware(&bootloader, BOOTLOADER_XR819, priv->pdev);
+	if (ret) {
+		dev_err(priv->pdev, "can't load bootloader file %s\n",
+			BOOTLOADER_XR819);
+		return ret;
+	}
+
+	if (!bootloader->size || bootloader->size > U32_MAX - addr ||
+	    !IS_ALIGNED(bootloader->size, sizeof(u32))) {
+		dev_err(priv->pdev, "invalid bootloader size %zu\n", bootloader->size);
+		ret = -EINVAL;
+		goto release;
+	}
+
+	for (i = 0; i < bootloader->size; i += sizeof(u32), addr += sizeof(u32)) {
+		u32 word = get_unaligned_le32(bootloader->data + i);
+
+		ret = cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID,
+					  addr);
+		if (ret)
+			goto release;
+
+		ret = cw1200_reg_write_32(priv, ST90TDS_AHB_DPORT_REG_ID, word);
+		if (ret)
+			goto release;
+	}
+
+release:
+	release_firmware(bootloader);
+	return ret;
+}
+
 
 static int config_reg_read(struct cw1200_common *priv, u32 *val)
 {
@@ -443,8 +490,13 @@ int cw1200_load_firmware(struct cw1200_common *priv)
 		break;
 	}
 	case 4:
-		pr_info("CW1x60 silicon detected.\n");
-		priv->hw_revision = CW1X60_HW_REV;
+		if (priv->is_xr819) {
+			dev_info(priv->pdev, "XR819 silicon detected\n");
+			priv->hw_revision = XR819_HW_REV;
+		} else {
+			pr_info("CW1x60 silicon detected.\n");
+			priv->hw_revision = CW1X60_HW_REV;
+		}
 		break;
 	default:
 		pr_err("Unsupported silicon major revision %d.\n",
@@ -473,6 +525,11 @@ int cw1200_load_firmware(struct cw1200_common *priv)
 			ret = -ENOTSUPP;
 			goto out;
 		}
+		if (priv->is_xr819) {
+			ret = cw1200_load_bootloader_xr819(priv);
+			if (ret)
+				goto out;
+		}
 		ret = cw1200_load_firmware_cw1200(priv);
 		break;
 	default:
diff --git a/drivers/net/wireless/st/cw1200/fwio.h b/drivers/net/wireless/st/cw1200/fwio.h
index c287160a492e..a3effef6d500 100644
--- a/drivers/net/wireless/st/cw1200/fwio.h
+++ b/drivers/net/wireless/st/cw1200/fwio.h
@@ -25,6 +25,9 @@
 #define SDD_FILE_20		"sdd_20.bin"
 #define SDD_FILE_11		"sdd_11.bin"
 #define SDD_FILE_10		"sdd_10.bin"
+#define BOOTLOADER_XR819	"xr819/boot_xr819.bin"
+#define FIRMWARE_XR819		"xr819/fw_xr819.bin"
+#define SDD_FILE_XR819		"xr819/sdd_xr819.bin"
 
 int cw1200_load_firmware(struct cw1200_common *priv);
 
diff --git a/drivers/net/wireless/st/cw1200/hwio.h b/drivers/net/wireless/st/cw1200/hwio.h
index d1e629a566c2..376dd1525fe2 100644
--- a/drivers/net/wireless/st/cw1200/hwio.h
+++ b/drivers/net/wireless/st/cw1200/hwio.h
@@ -89,6 +89,7 @@ struct download_cntl_t {
 
 
 #define SYS_BASE_ADDR_SILICON		(0)
+#define XR819_BOOT_BASE			0x08000000
 #define PAC_BASE_ADDRESS_SILICON	(SYS_BASE_ADDR_SILICON + 0x09000000)
 #define PAC_SHARED_MEMORY_SILICON	(PAC_BASE_ADDRESS_SILICON)
 
diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c
index ee9fcecb0100..998b8e45e503 100644
--- a/drivers/net/wireless/st/cw1200/main.c
+++ b/drivers/net/wireless/st/cw1200/main.c
@@ -515,12 +515,13 @@ u32 cw1200_dpll_from_clk(u16 clk_khz)
 	}
 }
 
-int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
-		      struct hwbus_priv *hwbus,
-		      struct device *pdev,
-		      struct cw1200_common **core,
-		      int ref_clk, const u8 *macaddr,
-		      const char *sdd_path, bool have_5ghz)
+static int __cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
+			       struct hwbus_priv *hwbus,
+			       struct device *pdev,
+			       struct cw1200_common **core,
+			       int ref_clk, const u8 *macaddr,
+			       const char *sdd_path, bool have_5ghz,
+			       bool is_xr819)
 {
 	int err = -EINVAL;
 	struct ieee80211_hw *dev;
@@ -535,6 +536,7 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
 		goto err;
 
 	priv = dev->priv;
+	priv->is_xr819 = is_xr819;
 	priv->hw_refclk = ref_clk;
 	if (cw1200_refclk)
 		priv->hw_refclk = cw1200_refclk;
@@ -590,8 +592,31 @@ int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
 	*core = NULL;
 	return err;
 }
+
+int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
+		      struct hwbus_priv *hwbus,
+		      struct device *pdev,
+		      struct cw1200_common **core,
+		      int ref_clk, const u8 *macaddr,
+		      const char *sdd_path, bool have_5ghz)
+{
+	return __cw1200_core_probe(hwbus_ops, hwbus, pdev, core, ref_clk,
+				   macaddr, sdd_path, have_5ghz, false);
+}
 EXPORT_SYMBOL_GPL(cw1200_core_probe);
 
+int cw1200_core_probe_xr819(const struct hwbus_ops *hwbus_ops,
+			    struct hwbus_priv *hwbus,
+			    struct device *pdev,
+			    struct cw1200_common **core,
+			    int ref_clk, const u8 *macaddr,
+			    const char *sdd_path)
+{
+	return __cw1200_core_probe(hwbus_ops, hwbus, pdev, core, ref_clk,
+				   macaddr, sdd_path, false, true);
+}
+EXPORT_SYMBOL_GPL(cw1200_core_probe_xr819);
+
 /*
  * Removing the interfaces sends WSM commands, which need the device
  * interrupt for their confirmations, so the bus driver calls this before
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 09/10] wifi: cw1200: add XR819 SDIO support
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (7 preceding siblings ...)
  2026-11-19 17:50 ` [PATCH wireless-next 08/10] wifi: cw1200: load the XR819 bootloader into SRAM Arthur Heymans
@ 2026-11-19 17:50 ` Arthur Heymans
  2026-11-19 17:50 ` [PATCH wireless-next 10/10] MAINTAINERS: add myself for the cw1200 driver Arthur Heymans
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:50 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

Match SDIO ID 0020:2281 and use the XR819 download path. Reset the
card on probe: disabling the function leaves the host interface in
queue mode, and a second firmware download fails without the reset.

Use the board MAC address and GPIO interrupt when provided. Otherwise
use the SDIO interrupt.

Prepared with OpenAI Codex.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 drivers/net/wireless/st/cw1200/Kconfig       |   6 +-
 drivers/net/wireless/st/cw1200/cw1200_sdio.c | 123 +++++++++++++++----
 include/linux/mmc/sdio_ids.h                 |   1 +
 3 files changed, 107 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/st/cw1200/Kconfig b/drivers/net/wireless/st/cw1200/Kconfig
index 03575e9894bb..8c2f759d8bd8 100644
--- a/drivers/net/wireless/st/cw1200/Kconfig
+++ b/drivers/net/wireless/st/cw1200/Kconfig
@@ -3,7 +3,8 @@ config CW1200
 	tristate "CW1200 WLAN support"
 	depends on MAC80211 && CFG80211
 	help
-	  This is a driver for the ST-E CW1100 & CW1200 WLAN chipsets.
+	  This is a driver for the ST-E CW1100, CW1200 and XRadio XR819
+	  WLAN chipsets.
 	  This option just enables the driver core, see below for
 	  specific bus support.
 
@@ -13,7 +14,8 @@ config CW1200_WLAN_SDIO
 	tristate "Support SDIO platforms"
 	depends on CW1200 && MMC
 	help
-	  Enable support for the CW1200 connected via an SDIO bus.
+	  Enable support for CW1200-family devices connected via an SDIO bus,
+	  including the XRadio XR819.
 	  By default this driver only supports the Sagrad SG901-1091/1098 EVK
 	  and similar designs that utilize a hardware reset circuit. To
 	  support different CW1200 SDIO designs you will need to override
diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
index 4f4bd668ebd2..330a4d0946bc 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
@@ -18,6 +18,9 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio.h>
 #include <linux/mmc/sdio_ids.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_net.h>
 #include <net/mac80211.h>
 
 #include "cw1200.h"
@@ -50,14 +53,28 @@ struct hwbus_priv {
 	struct sdio_func	*func;
 	struct cw1200_common	*core;
 	const struct cw1200_platform_data_sdio *pdata;
+	struct cw1200_platform_data_sdio pdata_storage;
+	u8 macaddr[ETH_ALEN];
+	bool is_xr819;
 };
 
 static const struct sdio_device_id cw1200_sdio_ids[] = {
 	{ SDIO_DEVICE(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_CW1200) },
+	{ SDIO_DEVICE(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_XR819) },
 	{ /* end: all zeroes */			},
 };
 MODULE_DEVICE_TABLE(sdio, cw1200_sdio_ids);
 
+static const struct of_device_id cw1200_sdio_of_match[] = {
+	{ .compatible = "xradio,xr819" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, cw1200_sdio_of_match);
+
+MODULE_FIRMWARE("xr819/boot_xr819.bin");
+MODULE_FIRMWARE("xr819/fw_xr819.bin");
+MODULE_FIRMWARE("xr819/sdd_xr819.bin");
+
 /* hwbus_ops implemetation */
 
 static int cw1200_sdio_memcpy_fromio(struct hwbus_priv *self,
@@ -142,6 +159,7 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
 
 static int cw1200_request_irq(struct hwbus_priv *self)
 {
+	unsigned long trigger = irq_get_trigger_type(self->pdata->irq);
 	int ret;
 	int err;
 	u8 ien;
@@ -160,10 +178,10 @@ static int cw1200_request_irq(struct hwbus_priv *self)
 		goto restore_ien;
 
 	/* Request the IRQ */
-	ret =  request_threaded_irq(self->pdata->irq, cw1200_gpio_hardirq,
-				    cw1200_gpio_irq,
-				    IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
-				    "cw1200_wlan_irq", self);
+	ret = request_threaded_irq(self->pdata->irq, cw1200_gpio_hardirq,
+				   cw1200_gpio_irq, IRQF_ONESHOT |
+				   (trigger ?: IRQF_TRIGGER_HIGH),
+				   "cw1200_wlan_irq", self);
 	if (!ret)
 		return 0;
 
@@ -303,11 +321,28 @@ static const struct hwbus_ops cw1200_sdio_hwbus_ops = {
 	.power_mgmt		= cw1200_sdio_pm,
 };
 
+static int cw1200_sdio_core_probe(struct hwbus_priv *self,
+				  struct sdio_func *func)
+{
+	if (self->is_xr819)
+		return cw1200_core_probe_xr819(&cw1200_sdio_hwbus_ops, self,
+						&func->dev, &self->core,
+						self->pdata->ref_clk,
+						self->pdata->macaddr,
+						self->pdata->sdd_file);
+
+	return cw1200_core_probe(&cw1200_sdio_hwbus_ops, self, &func->dev,
+				 &self->core, self->pdata->ref_clk,
+				 self->pdata->macaddr, self->pdata->sdd_file,
+				 self->pdata->have_5ghz);
+}
+
 /* Probe Function to be called by SDIO stack when device is discovered */
 static int cw1200_sdio_probe(struct sdio_func *func,
 			     const struct sdio_device_id *id)
 {
 	struct hwbus_priv *self;
+	int irq;
 	int status;
 
 	pr_info("cw1200_wlan_sdio: Probe called\n");
@@ -324,30 +359,75 @@ static int cw1200_sdio_probe(struct sdio_func *func,
 
 	func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
 
-	self->pdata = global_plat_data; /* FIXME */
+	self->pdata_storage = *global_plat_data;
+	self->pdata = &self->pdata_storage;
+	self->is_xr819 = id->device == SDIO_DEVICE_ID_STE_XR819;
+	if (self->is_xr819) {
+		func->card->quirks |= MMC_QUIRK_BROKEN_BYTE_MODE_512;
+		self->pdata_storage.ref_clk = 24000;
+		self->pdata_storage.have_5ghz = false;
+		self->pdata_storage.sdd_file = "xr819/sdd_xr819.bin";
+
+		if (of_property_present(func->dev.of_node, "interrupts") ||
+		    of_property_present(func->dev.of_node, "interrupts-extended")) {
+			irq = of_irq_get(func->dev.of_node, 0);
+			if (irq <= 0) {
+				status = dev_err_probe(&func->dev, irq ?: -EINVAL,
+						       "cannot map GPIO interrupt\n");
+				goto free_self;
+			}
+			self->pdata_storage.irq = irq;
+		}
+
+		status = of_get_mac_address(func->dev.of_node, self->macaddr);
+		if (status == -EPROBE_DEFER)
+			goto free_self;
+		if (!status)
+			self->pdata_storage.macaddr = self->macaddr;
+	}
 	self->func = func;
+	if (self->is_xr819) {
+		/* Disabling the function leaves the HIF in queue mode. Reset
+		 * the single-function XR819 before starting another download.
+		 */
+		sdio_claim_host(func);
+		status = mmc_hw_reset(func->card);
+		sdio_release_host(func);
+		if (status)
+			goto free_self;
+	}
 	sdio_set_drvdata(func, self);
 	sdio_claim_host(func);
-	sdio_enable_func(func);
+	status = sdio_enable_func(func);
 	sdio_release_host(func);
+	if (status)
+		goto clear_drvdata;
 
-	status = cw1200_sdio_irq_subscribe(self);
-
-	status = cw1200_core_probe(&cw1200_sdio_hwbus_ops,
-				   self, &func->dev, &self->core,
-				   self->pdata->ref_clk,
-				   self->pdata->macaddr,
-				   self->pdata->sdd_file,
-				   self->pdata->have_5ghz);
-	if (status) {
-		cw1200_sdio_irq_unsubscribe(self);
+	if (self->is_xr819) {
 		sdio_claim_host(func);
-		sdio_disable_func(func);
+		status = sdio_set_block_size(func, SDIO_BLOCK_SIZE);
 		sdio_release_host(func);
-		sdio_set_drvdata(func, NULL);
-		kfree(self);
+		if (status)
+			goto disable_func;
 	}
 
+	status = cw1200_sdio_irq_subscribe(self);
+	if (status)
+		goto disable_func;
+
+	status = cw1200_sdio_core_probe(self, func);
+	if (!status)
+		return 0;
+
+	cw1200_sdio_irq_unsubscribe(self);
+disable_func:
+	sdio_claim_host(func);
+	sdio_disable_func(func);
+	sdio_release_host(func);
+clear_drvdata:
+	sdio_set_drvdata(func, NULL);
+free_self:
+	kfree(self);
 	return status;
 }
 
@@ -408,11 +488,12 @@ static struct sdio_driver sdio_driver = {
 	.id_table	= cw1200_sdio_ids,
 	.probe		= cw1200_sdio_probe,
 	.remove		= cw1200_sdio_disconnect,
-#ifdef CONFIG_PM
 	.drv = {
+#ifdef CONFIG_PM
 		.pm = &cw1200_pm_ops,
-	}
 #endif
+		.of_match_table = cw1200_sdio_of_match,
+	},
 };
 
 /* Init Module function -> Called by insmod */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index dfffda3d8002..35789be747a5 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -27,6 +27,7 @@
 
 #define SDIO_VENDOR_ID_STE			0x0020
 #define SDIO_DEVICE_ID_STE_CW1200		0x2280
+#define SDIO_DEVICE_ID_STE_XR819		0x2281
 
 #define SDIO_VENDOR_ID_INTEL			0x0089
 #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX	0x1402
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH wireless-next 10/10] MAINTAINERS: add myself for the cw1200 driver
  2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
                   ` (8 preceding siblings ...)
  2026-11-19 17:50 ` [PATCH wireless-next 09/10] wifi: cw1200: add XR819 SDIO support Arthur Heymans
@ 2026-11-19 17:50 ` Arthur Heymans
  9 siblings, 0 replies; 14+ messages in thread
From: Arthur Heymans @ 2026-11-19 17:50 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	Ulf Hansson, linux-mmc, Solomon Peachy, linux-kernel,
	Arthur Heymans

The driver has been orphaned. I am adding XR819 support to it and can
look after fixes, so take it over as Odd Fixes.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
 MAINTAINERS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6e7b5f6beba4..3ee6e717bfc2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7209,8 +7209,9 @@ S:	Maintained
 F:	Documentation/process/cve.rst
 
 CW1200 WLAN driver
-S:	Orphan
+M:	Arthur Heymans <arthur@aheymans.xyz>
 L:	linux-wireless@vger.kernel.org
+S:	Odd Fixes
 F:	Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
 F:	drivers/net/wireless/st/
 F:	include/linux/platform_data/net-cw1200.h
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819
  2026-11-19 17:49 ` [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819 Arthur Heymans
@ 2026-11-19 18:01   ` Conor Dooley
  2026-11-19 18:03   ` sashiko-bot
  1 sibling, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2026-11-19 18:01 UTC (permalink / raw)
  To: Arthur Heymans
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, Ulf Hansson, linux-mmc, Solomon Peachy,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2676 bytes --]

On Thu, Nov 19, 2026 at 06:49:59PM +0100, Arthur Heymans wrote:
> The XR819 exposes one SDIO function. Boards may provide a MAC address
> and wire a GPIO interrupt instead of using the SDIO interrupt.
> 
> Prepared with OpenAI Codex.
> 
> Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> ---
>  .../bindings/net/wireless/xradio,xr819.yaml   | 49 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
> new file mode 100644
> index 000000000000..4f6919b6bcbd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
> @@ -0,0 +1,49 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/wireless/xradio,xr819.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: XRadio XR819 SDIO wireless controller
> +
> +maintainers:
> +  - Arthur Heymans <arthur@aheymans.xyz>
> +
> +description:
> +  The XR819 is a 2.4 GHz IEEE 802.11b/g/n controller connected to the host
> +  through SDIO. Its out-of-band interrupt may be connected to a host GPIO.
> +
> +properties:
> +  compatible:
> +    const: xradio,xr819
> +
> +  reg:
> +    const: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  local-mac-address: true
> +
> +required:
> +  - compatible
> +  - reg

Is this not missing several clocks and supplies?
Datasheet I found online had multiple of both.

Cheers,
Conor.

> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    mmc {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        wifi@1 {
> +            compatible = "xradio,xr819";
> +            reg = <1>;
> +            interrupt-parent = <&pio>;
> +            interrupts = <10 IRQ_TYPE_EDGE_RISING>;
> +            local-mac-address = [02 00 00 00 00 01];
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0cf311e6c4be..6e7b5f6beba4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7211,6 +7211,7 @@ F:	Documentation/process/cve.rst
>  CW1200 WLAN driver
>  S:	Orphan
>  L:	linux-wireless@vger.kernel.org
> +F:	Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
>  F:	drivers/net/wireless/st/
>  F:	include/linux/platform_data/net-cw1200.h
>  
> -- 
> 2.56.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819
  2026-11-19 17:49 ` [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819 Arthur Heymans
  2026-11-19 18:01   ` Conor Dooley
@ 2026-11-19 18:03   ` sashiko-bot
  1 sibling, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-19 18:03 UTC (permalink / raw)
  To: Arthur Heymans; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: wireless: xradio,xr819: missing
  wireless-controller.yaml ref
--

commit b88f95dc24f2d5de0e0e72e80a5e05cb457e6ac2
Author: Arthur Heymans <arthur@aheymans.xyz>

dt-bindings: net: wireless: add XRadio XR819

This commit adds a DT binding schema for the XRadio XR819 SDIO wireless
controller and adds it to MAINTAINERS under the CW1200 WLAN driver entry.

> diff --git a/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
> new file mode 100644
> index 0000000000000..4f6919b6bcbd8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/xradio,xr819.yaml
> @@ -0,0 +1,49 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/wireless/xradio,xr819.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: XRadio XR819 SDIO wireless controller
> +
> +maintainers:
> +  - Arthur Heymans <arthur@aheymans.xyz>
> +
> +description:
> +  The XR819 is a 2.4 GHz IEEE 802.11b/g/n controller connected to the host
> +  through SDIO. Its out-of-band interrupt may be connected to a host GPIO.
> +
> +properties:
> +  compatible:
> +    const: xradio,xr819
> +
> +  reg:
> +    const: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  local-mac-address: true
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false

[Severity: Low]
Should this schema reference wireless-controller.yaml# with
unevaluatedProperties: false instead of listing local-mac-address: true with
additionalProperties: false?

Neither wireless-controller.yaml nor network-class.yaml sets select: true, so
listing local-mac-address: true leaves it without its uint8-array type and
6-byte length constraints from network-class.yaml, while additionalProperties:
false rejects other standard properties from wireless-controller.yaml such as
mac-address (which of_get_mac_address() in cw1200_sdio_probe() checks first
and which bootloaders populate via ethernet aliases).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119175002.458988-1-arthur@aheymans.xyz?part=7

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio
  2026-11-19 17:49 ` [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio Arthur Heymans
@ 2026-11-19 18:03   ` Conor Dooley
  0 siblings, 0 replies; 14+ messages in thread
From: Conor Dooley @ 2026-11-19 18:03 UTC (permalink / raw)
  To: Arthur Heymans
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, Ulf Hansson, linux-mmc, Solomon Peachy,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

On Thu, Nov 19, 2026 at 06:49:58PM +0100, Arthur Heymans wrote:
> Add the vendor prefix for XRadio Wi-Fi chips.
> 

> Prepared with OpenAI Codex.

This should not be in the commit message.
pw-bot: changes-requested

> 
> Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
> ---
>  Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 5471a06f93f1..066c2e90f289 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -1959,6 +1959,8 @@ patternProperties:
>      description: Xilinx
>    "^xnano,.*":
>      description: Xnano
> +  "^xradio,.*":
> +    description: XRadio Technology

Gemini seems to think that the company is called "Xradio Technology Co.,
Ltd." or "Guangzhou Xradio Technology Co., Ltd.". Either is appropriate.

>    "^xunlong,.*":
>      description: Shenzhen Xunlong Software CO.,Limited

As you can see, we have existing examples of where the city is included.

Cheers,
Conor.

>    "^xylon,.*":
> -- 
> 2.56.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-19 18:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 17:49 [PATCH wireless-next 00/10] wifi: cw1200: add XRadio XR819 support Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 01/10] wifi: cw1200: avoid removing the debugfs directory twice Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 02/10] wifi: cw1200: check SDD element lengths before reading them Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 03/10] wifi: cw1200: bounce SDIO transfers that use stack buffers Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 04/10] wifi: cw1200: unwind GPIO interrupt setup on error Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 05/10] wifi: cw1200: unregister from mac80211 before freeing the interrupt Arthur Heymans
2026-11-19 17:49 ` [PATCH wireless-next 06/10] dt-bindings: vendor-prefixes: add XRadio Arthur Heymans
2026-11-19 18:03   ` Conor Dooley
2026-11-19 17:49 ` [PATCH wireless-next 07/10] dt-bindings: net: wireless: add XRadio XR819 Arthur Heymans
2026-11-19 18:01   ` Conor Dooley
2026-11-19 18:03   ` sashiko-bot
2026-11-19 17:50 ` [PATCH wireless-next 08/10] wifi: cw1200: load the XR819 bootloader into SRAM Arthur Heymans
2026-11-19 17:50 ` [PATCH wireless-next 09/10] wifi: cw1200: add XR819 SDIO support Arthur Heymans
2026-11-19 17:50 ` [PATCH wireless-next 10/10] MAINTAINERS: add myself for the cw1200 driver Arthur Heymans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox