Re: [PATCH wireless-next 09/10] wifi: cw1200: add XR819 SDIO support
From: Ulf Hansson
Date: Mon Nov 30 2026 - 10:50:54 EST
On Thu, Nov 19, 2026 at 6:50 PM Arthur Heymans <arthur@xxxxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxx>
[...]
> /* 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;
Please fix the global_plat_data first, in a separate patch preceding
$subject patch.
> + 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);
This deserves a separate patch preceding $subject patch.
> 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
>
Other than the minor things above this looks good to me!
Kind regards
Uffe