drivers/mmc/host/mxcmmc.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/mxcmmc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/mxcmmc.c- Extension
.c- Size
- 29711 bytes
- Lines
- 1232
- Domain
- Driver Families
- Bucket
- drivers/mmc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/ioport.hlinux/platform_device.hlinux/highmem.hlinux/interrupt.hlinux/irq.hlinux/blkdev.hlinux/dma-mapping.hlinux/mmc/host.hlinux/mmc/card.hlinux/delay.hlinux/clk.hlinux/io.hlinux/regulator/consumer.hlinux/dmaengine.hlinux/types.hlinux/of.hlinux/of_dma.hlinux/mmc/slot-gpio.hasm/dma.hasm/irq.hlinux/platform_data/mmc-mxcmmc.hlinux/dma/imx-dma.h
Detected Declarations
struct mxcmci_hostenum mxcmci_typefunction is_imx31_mmcfunction is_mpc512x_mmcfunction mxcmci_readlfunction mxcmci_writelfunction mxcmci_readwfunction mxcmci_writewfunction mxcmci_set_powerfunction mxcmci_use_dmafunction mxcmci_softresetfunction buffer_swap32function mxcmci_swap_buffersfunction mxcmci_swap_buffersfunction for_each_sgfunction mxcmci_dma_callbackfunction mxcmci_start_cmdfunction mxcmci_finish_requestfunction mxcmci_finish_datafunction mxcmci_read_responsefunction mxcmci_poll_statusfunction mxcmci_pullfunction mxcmci_pushfunction mxcmci_transfer_datafunction mxcmci_dataworkfunction mxcmci_data_donefunction mxcmci_cmd_donefunction mxcmci_irqfunction mxcmci_requestfunction mxcmci_set_clk_ratefunction mxcmci_setup_dmafunction mxcmci_set_iosfunction mxcmci_detect_irqfunction mxcmci_get_rofunction mxcmci_enable_sdio_irqfunction mxcmci_init_cardfunction filterfunction mxcmci_watchdogfunction mxcmci_probefunction mxcmci_removefunction mxcmci_suspendfunction mxcmci_resume
Annotated Snippet
struct mxcmci_host {
struct mmc_host *mmc;
void __iomem *base;
dma_addr_t phys_base;
int detect_irq;
struct dma_chan *dma;
struct dma_async_tx_descriptor *desc;
int do_dma;
int default_irq_mask;
int use_sdio;
unsigned int power_mode;
struct imxmmc_platform_data *pdata;
struct mmc_request *req;
struct mmc_command *cmd;
struct mmc_data *data;
unsigned int datasize;
unsigned int dma_dir;
u16 rev_no;
unsigned int cmdat;
struct clk *clk_ipg;
struct clk *clk_per;
int clock;
struct work_struct datawork;
spinlock_t lock;
int burstlen;
int dmareq;
struct dma_slave_config dma_slave_config;
struct imx_dma_data dma_data;
struct timer_list watchdog;
enum mxcmci_type devtype;
};
static const struct of_device_id mxcmci_of_match[] = {
{
.compatible = "fsl,imx21-mmc",
.data = (void *) IMX21_MMC,
}, {
.compatible = "fsl,imx31-mmc",
.data = (void *) IMX31_MMC,
}, {
.compatible = "fsl,mpc5121-sdhc",
.data = (void *) MPC512X_MMC,
}, {
/* sentinel */
}
};
MODULE_DEVICE_TABLE(of, mxcmci_of_match);
static inline int is_imx31_mmc(struct mxcmci_host *host)
{
return host->devtype == IMX31_MMC;
}
static inline int is_mpc512x_mmc(struct mxcmci_host *host)
{
return host->devtype == MPC512X_MMC;
}
static inline u32 mxcmci_readl(struct mxcmci_host *host, int reg)
{
if (IS_ENABLED(CONFIG_PPC_MPC512x))
return ioread32be(host->base + reg);
else
return readl(host->base + reg);
}
static inline void mxcmci_writel(struct mxcmci_host *host, u32 val, int reg)
{
if (IS_ENABLED(CONFIG_PPC_MPC512x))
iowrite32be(val, host->base + reg);
else
writel(val, host->base + reg);
}
static inline u16 mxcmci_readw(struct mxcmci_host *host, int reg)
{
if (IS_ENABLED(CONFIG_PPC_MPC512x))
return ioread32be(host->base + reg);
else
return readw(host->base + reg);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/ioport.h`, `linux/platform_device.h`, `linux/highmem.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/blkdev.h`.
- Detected declarations: `struct mxcmci_host`, `enum mxcmci_type`, `function is_imx31_mmc`, `function is_mpc512x_mmc`, `function mxcmci_readl`, `function mxcmci_writel`, `function mxcmci_readw`, `function mxcmci_writew`, `function mxcmci_set_power`, `function mxcmci_use_dma`.
- Atlas domain: Driver Families / drivers/mmc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.