drivers/net/wireless/marvell/mwifiex/sdio.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/mwifiex/sdio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/mwifiex/sdio.c- Extension
.c- Size
- 84888 bytes
- Lines
- 3215
- 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/firmware.hdecl.hioctl.hutil.hfw.hmain.hwmm.h11n.hsdio.h
Detected Declarations
function mwifiex_sdio_probe_offunction mwifiex_sdio_probefunction mwifiex_sdio_resumefunction mwifiex_write_reg_lockedfunction mwifiex_write_regfunction mwifiex_read_regfunction mwifiex_write_data_syncfunction mwifiex_read_data_syncfunction mwifiex_sdio_read_fw_statusfunction mwifiex_check_fw_statusfunction mwifiex_check_winner_statusfunction mwifiex_sdio_removefunction mwifiex_sdio_suspendfunction mwifiex_sdio_coredumpfunction mwifiex_pm_wakeup_cardfunction mwifiex_pm_wakeup_card_completefunction mwifiex_sdio_dnld_fwfunction mwifiex_init_sdio_new_modefunction mwifiex_init_sdio_ioportfunction mwifiex_write_data_to_cardfunction increasedfunction increasedfunction mwifiex_sdio_poll_card_statusfunction mwifiex_sdio_disable_host_intfunction mwifiex_interrupt_statusfunction threadfunction mwifiex_sdio_enable_host_intfunction mwifiex_sdio_card_to_hostfunction mwifiex_prog_fw_w_helperfunction mwifiex_deaggr_sdio_pktfunction mwifiex_decode_rx_packetfunction mwifiex_sdio_card_to_host_mp_aggrfunction mwifiex_process_int_statusfunction mwifiex_host_to_card_mp_aggrfunction mwifiex_sdio_host_to_cardfunction typefunction mwifiex_alloc_sdio_mpa_buffersfunction mwifiex_unregister_devfunction mwifiex_register_devfunction mwifiex_init_sdiofunction mwifiex_cleanup_mpa_buffunction mwifiex_cleanup_sdiofunction mwifiex_update_mp_end_portfunction mwifiex_sdio_card_reset_workfunction mwifiex_sdio_rdwr_firmwarefunction mwifiex_sdio_fw_dumpfunction mwifiex_sdio_generic_fw_dumpfunction mwifiex_sdio_device_dump_work
Annotated Snippet
if (firmware_stat == FIRMWARE_READY_SDIO) {
ret = 0;
break;
}
msleep(100);
ret = -1;
}
if (card->fw_ready_extra_delay &&
firmware_stat == FIRMWARE_READY_SDIO)
/* firmware might pretend to be ready, when it's not.
* Wait a little bit more as a workaround.
*/
msleep(100);
return ret;
}
/* This function checks if WLAN is the winner.
*/
static int mwifiex_check_winner_status(struct mwifiex_adapter *adapter)
{
int ret = 0;
u8 winner = 0;
struct sdio_mmc_card *card = adapter->card;
if (mwifiex_read_reg(adapter, card->reg->status_reg_0, &winner))
return -1;
if (winner)
adapter->winner = 0;
else
adapter->winner = 1;
return ret;
}
/*
* SDIO remove.
*
* This function removes the interface and frees up the card structure.
*/
static void
mwifiex_sdio_remove(struct sdio_func *func)
{
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
struct mwifiex_private *priv;
int ret = 0;
u16 firmware_stat;
card = sdio_get_drvdata(func);
if (!card)
return;
wait_for_completion(&card->fw_done);
adapter = card->adapter;
if (!adapter || !adapter->priv_num)
return;
mwifiex_dbg(adapter, INFO, "info: SDIO func num=%d\n", func->num);
ret = mwifiex_sdio_read_fw_status(adapter, &firmware_stat);
if (!ret && firmware_stat == FIRMWARE_READY_SDIO &&
!adapter->mfg_mode) {
mwifiex_deauthenticate_all(adapter);
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
mwifiex_disable_auto_ds(priv);
mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
}
mwifiex_remove_card(adapter);
}
/*
* SDIO suspend.
*
* Kernel needs to suspend all functions separately. Therefore all
* registered functions must have drivers with suspend and resume
* methods. Failing that the kernel simply removes the whole card.
*
* If already not suspended, this function allocates and sends a host
* sleep activate request to the firmware and turns off the traffic.
*/
static int mwifiex_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
Annotation
- Immediate include surface: `linux/firmware.h`, `decl.h`, `ioctl.h`, `util.h`, `fw.h`, `main.h`, `wmm.h`, `11n.h`.
- Detected declarations: `function mwifiex_sdio_probe_of`, `function mwifiex_sdio_probe`, `function mwifiex_sdio_resume`, `function mwifiex_write_reg_locked`, `function mwifiex_write_reg`, `function mwifiex_read_reg`, `function mwifiex_write_data_sync`, `function mwifiex_read_data_sync`, `function mwifiex_sdio_read_fw_status`, `function mwifiex_check_fw_status`.
- 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.