drivers/net/wireless/ti/wl1251/sdio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ti/wl1251/sdio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ti/wl1251/sdio.c- Extension
.c- Size
- 7239 bytes
- Lines
- 331
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/module.hlinux/mod_devicetable.hlinux/mmc/sdio_func.hlinux/mmc/sdio_ids.hlinux/platform_device.hlinux/irq.hlinux/pm_runtime.hlinux/of.hlinux/of_irq.hwl1251.h
Detected Declarations
struct wl1251_sdiofunction wl1251_sdio_interruptfunction wl1251_sdio_readfunction wl1251_sdio_writefunction wl1251_sdio_read_elpfunction wl1251_sdio_write_elpfunction wl1251_sdio_resetfunction wl1251_sdio_disable_irqfunction wl1251_line_irqfunction wl1251_enable_line_irqfunction wl1251_disable_line_irqfunction wl1251_sdio_set_powerfunction wl1251_sdio_probefunction wl1251_sdio_removefunction wl1251_suspendfunction wl1251_resume
Annotated Snippet
struct wl1251_sdio {
struct sdio_func *func;
u32 elp_val;
};
static struct sdio_func *wl_to_func(struct wl1251 *wl)
{
struct wl1251_sdio *wl_sdio = wl->if_priv;
return wl_sdio->func;
}
static void wl1251_sdio_interrupt(struct sdio_func *func)
{
struct wl1251 *wl = sdio_get_drvdata(func);
wl1251_debug(DEBUG_IRQ, "IRQ");
/* FIXME should be synchronous for sdio */
ieee80211_queue_work(wl->hw, &wl->irq_work);
}
static const struct sdio_device_id wl1251_devices[] = {
{ SDIO_DEVICE(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251) },
{}
};
MODULE_DEVICE_TABLE(sdio, wl1251_devices);
static void wl1251_sdio_read(struct wl1251 *wl, int addr,
void *buf, size_t len)
{
int ret;
struct sdio_func *func = wl_to_func(wl);
sdio_claim_host(func);
ret = sdio_memcpy_fromio(func, buf, addr, len);
if (ret)
wl1251_error("sdio read failed (%d)", ret);
sdio_release_host(func);
}
static void wl1251_sdio_write(struct wl1251 *wl, int addr,
void *buf, size_t len)
{
int ret;
struct sdio_func *func = wl_to_func(wl);
sdio_claim_host(func);
ret = sdio_memcpy_toio(func, addr, buf, len);
if (ret)
wl1251_error("sdio write failed (%d)", ret);
sdio_release_host(func);
}
static void wl1251_sdio_read_elp(struct wl1251 *wl, int addr, u32 *val)
{
int ret = 0;
struct wl1251_sdio *wl_sdio = wl->if_priv;
struct sdio_func *func = wl_sdio->func;
/*
* The hardware only supports RAW (read after write) access for
* reading, regular sdio_readb won't work here (it interprets
* the unused bits of CMD52 as write data even if we send read
* request).
*/
sdio_claim_host(func);
*val = sdio_writeb_readb(func, wl_sdio->elp_val, addr, &ret);
sdio_release_host(func);
if (ret)
wl1251_error("sdio_readb failed (%d)", ret);
}
static void wl1251_sdio_write_elp(struct wl1251 *wl, int addr, u32 val)
{
int ret = 0;
struct wl1251_sdio *wl_sdio = wl->if_priv;
struct sdio_func *func = wl_sdio->func;
sdio_claim_host(func);
sdio_writeb(func, val, addr, &ret);
sdio_release_host(func);
if (ret)
wl1251_error("sdio_writeb failed (%d)", ret);
else
wl_sdio->elp_val = val;
}
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/mmc/sdio_func.h`, `linux/mmc/sdio_ids.h`, `linux/platform_device.h`, `linux/irq.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct wl1251_sdio`, `function wl1251_sdio_interrupt`, `function wl1251_sdio_read`, `function wl1251_sdio_write`, `function wl1251_sdio_read_elp`, `function wl1251_sdio_write_elp`, `function wl1251_sdio_reset`, `function wl1251_sdio_disable_irq`, `function wl1251_line_irq`, `function wl1251_enable_line_irq`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.