drivers/net/wireless/ath/ath6kl/sdio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath6kl/sdio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath6kl/sdio.c- Extension
.c- Size
- 37976 bytes
- Lines
- 1458
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/mmc/card.hlinux/mmc/mmc.hlinux/mmc/host.hlinux/mmc/sdio_func.hlinux/mmc/sdio_ids.hlinux/mmc/sdio.hlinux/mmc/sd.hhif.hhif-ops.htarget.hdebug.hcfg80211.htrace.h
Detected Declarations
struct ath6kl_sdiofunction buf_needs_bouncefunction ath6kl_sdio_set_mbox_infofunction ath6kl_sdio_set_cmd53_argfunction ath6kl_sdio_set_cmd52_argfunction ath6kl_sdio_func0_cmd52_wr_bytefunction ath6kl_sdio_iofunction ath6kl_sdio_free_bus_reqfunction ath6kl_sdio_setup_scat_datafunction ath6kl_sdio_scat_rwfunction ath6kl_sdio_alloc_prep_scat_reqfunction ath6kl_sdio_read_write_syncfunction __ath6kl_sdio_write_asyncfunction ath6kl_sdio_write_async_workfunction ath6kl_sdio_irq_handlerfunction ath6kl_sdio_power_onfunction ath6kl_sdio_power_offfunction ath6kl_sdio_write_asyncfunction ath6kl_sdio_irq_enablefunction ath6kl_sdio_is_on_irqfunction ath6kl_sdio_irq_disablefunction ath6kl_sdio_scatter_req_addfunction ath6kl_sdio_async_rw_scatterfunction ath6kl_sdio_cleanup_scatterfunction ath6kl_hif_rw_comp_handlerfunction ath6kl_sdio_enable_scatterfunction ath6kl_sdio_configfunction ath6kl_set_sdio_pm_capsfunction ath6kl_sdio_suspendfunction ath6kl_sdio_resumefunction ath6kl_set_addrwin_regfunction ath6kl_sdio_diag_read32function ath6kl_sdio_diag_write32function ath6kl_sdio_bmi_creditsfunction ath6kl_bmi_get_rx_lkahdfunction ath6kl_sdio_bmi_writefunction ath6kl_sdio_bmi_readfunction ath6kl_sdio_stopfunction list_for_each_entry_safefunction ath6kl_sdio_pm_suspendfunction ath6kl_sdio_pm_resumefunction ath6kl_sdio_probefunction ath6kl_sdio_remove
Annotated Snippet
struct ath6kl_sdio {
struct sdio_func *func;
/* protects access to bus_req_freeq */
spinlock_t lock;
/* free list */
struct list_head bus_req_freeq;
/* available bus requests */
struct bus_request bus_req[BUS_REQUEST_MAX_NUM];
struct ath6kl *ar;
u8 *dma_buffer;
/* protects access to dma_buffer */
struct mutex dma_buffer_mutex;
/* scatter request list head */
struct list_head scat_req;
atomic_t irq_handling;
wait_queue_head_t irq_wq;
/* protects access to scat_req */
spinlock_t scat_lock;
bool scatter_enabled;
bool is_disabled;
const struct sdio_device_id *id;
struct work_struct wr_async_work;
struct list_head wr_asyncq;
/* protects access to wr_asyncq */
spinlock_t wr_async_lock;
};
#define CMD53_ARG_READ 0
#define CMD53_ARG_WRITE 1
#define CMD53_ARG_BLOCK_BASIS 1
#define CMD53_ARG_FIXED_ADDRESS 0
#define CMD53_ARG_INCR_ADDRESS 1
static int ath6kl_sdio_config(struct ath6kl *ar);
static inline struct ath6kl_sdio *ath6kl_sdio_priv(struct ath6kl *ar)
{
return ar->hif_priv;
}
/*
* Macro to check if DMA buffer is WORD-aligned and DMA-able.
* Most host controllers assume the buffer is DMA'able and will
* bug-check otherwise (i.e. buffers on the stack). virt_addr_valid
* check fails on stack memory.
*/
static inline bool buf_needs_bounce(u8 *buf)
{
return ((unsigned long) buf & 0x3) || !virt_addr_valid(buf);
}
static void ath6kl_sdio_set_mbox_info(struct ath6kl *ar)
{
struct ath6kl_mbox_info *mbox_info = &ar->mbox_info;
/* EP1 has an extended range */
mbox_info->htc_addr = HIF_MBOX_BASE_ADDR;
mbox_info->htc_ext_addr = HIF_MBOX0_EXT_BASE_ADDR;
mbox_info->htc_ext_sz = HIF_MBOX0_EXT_WIDTH;
mbox_info->block_size = HIF_MBOX_BLOCK_SIZE;
mbox_info->gmbox_addr = HIF_GMBOX_BASE_ADDR;
mbox_info->gmbox_sz = HIF_GMBOX_WIDTH;
}
static inline void ath6kl_sdio_set_cmd53_arg(u32 *arg, u8 rw, u8 func,
u8 mode, u8 opcode, u32 addr,
u16 blksz)
{
*arg = (((rw & 1) << 31) |
((func & 0x7) << 28) |
((mode & 1) << 27) |
((opcode & 1) << 26) |
((addr & 0x1FFFF) << 9) |
(blksz & 0x1FF));
}
static inline void ath6kl_sdio_set_cmd52_arg(u32 *arg, u8 write, u8 raw,
unsigned int address,
Annotation
- Immediate include surface: `linux/module.h`, `linux/mmc/card.h`, `linux/mmc/mmc.h`, `linux/mmc/host.h`, `linux/mmc/sdio_func.h`, `linux/mmc/sdio_ids.h`, `linux/mmc/sdio.h`, `linux/mmc/sd.h`.
- Detected declarations: `struct ath6kl_sdio`, `function buf_needs_bounce`, `function ath6kl_sdio_set_mbox_info`, `function ath6kl_sdio_set_cmd53_arg`, `function ath6kl_sdio_set_cmd52_arg`, `function ath6kl_sdio_func0_cmd52_wr_byte`, `function ath6kl_sdio_io`, `function ath6kl_sdio_free_bus_req`, `function ath6kl_sdio_setup_scat_data`, `function ath6kl_sdio_scat_rw`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.