drivers/mmc/host/omap.c
Source file repositories/reference/linux-study-clean/drivers/mmc/host/omap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/host/omap.c- Extension
.c- Size
- 39155 bytes
- Lines
- 1571
- 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.
- 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/moduleparam.hlinux/init.hlinux/ioport.hlinux/platform_device.hlinux/interrupt.hlinux/dmaengine.hlinux/dma-mapping.hlinux/delay.hlinux/spinlock.hlinux/timer.hlinux/of.hlinux/mmc/host.hlinux/mmc/card.hlinux/mmc/mmc.hlinux/clk.hlinux/scatterlist.hlinux/slab.hlinux/gpio/consumer.hlinux/platform_data/mmc-omap.hlinux/workqueue.h
Detected Declarations
struct mmc_omap_hoststruct mmc_omap_slotstruct mmc_omap_hostfunction mmc_omap_fclk_offdelayfunction mmc_omap_fclk_enablefunction mmc_omap_select_slotfunction mmc_omap_slot_release_workfunction mmc_omap_release_slotfunction mmc_omap_cover_is_openfunction mmc_omap_show_cover_switchfunction mmc_omap_show_slot_namefunction mmc_omap_start_commandfunction mmc_omap_release_dmafunction mmc_omap_send_stop_workfunction mmc_omap_xfer_donefunction mmc_omap_send_abortfunction mmc_omap_abort_xferfunction mmc_omap_end_of_datafunction mmc_omap_dma_donefunction mmc_omap_cmd_donefunction mmc_omap_abort_commandfunction mmc_omap_cmd_timerfunction mmc_omap_clk_timerfunction mmc_omap_xfer_datafunction mmc_omap_report_irqfunction mmc_omap_report_irqfunction omap_mmc_notify_cover_eventfunction mmc_omap_cover_timerfunction mmc_omap_cover_bh_handlerfunction mmc_omap_dma_callbackfunction set_cmd_timeoutfunction set_data_timeoutfunction mmc_omap_prepare_datafunction mmc_omap_start_requestfunction mmc_omap_requestfunction mmc_omap_set_powerfunction mmc_omap_calc_divisorfunction mmc_omap_set_iosfunction mmc_omap_new_slotfunction mmc_omap_remove_slotfunction mmc_omap_probefunction mmc_omap_remove
Annotated Snippet
struct mmc_omap_slot {
int id;
unsigned int vdd;
u16 saved_con;
u16 bus_mode;
u16 power_mode;
unsigned int fclk_freq;
struct work_struct cover_bh_work;
struct timer_list cover_timer;
unsigned cover_open;
struct mmc_request *mrq;
struct mmc_omap_host *host;
struct mmc_host *mmc;
struct gpio_desc *vsd;
struct gpio_desc *vio;
struct gpio_desc *cover;
struct omap_mmc_slot_data *pdata;
};
struct mmc_omap_host {
int initialized;
struct mmc_request * mrq;
struct mmc_command * cmd;
struct mmc_data * data;
struct mmc_host * mmc;
struct device * dev;
unsigned char id; /* 16xx chips have 2 MMC blocks */
struct clk * iclk;
struct clk * fclk;
struct dma_chan *dma_rx;
u32 dma_rx_burst;
struct dma_chan *dma_tx;
u32 dma_tx_burst;
void __iomem *virt_base;
unsigned int phys_base;
int irq;
unsigned char bus_mode;
unsigned int reg_shift;
struct gpio_desc *slot_switch;
struct work_struct cmd_abort_work;
unsigned abort:1;
struct timer_list cmd_abort_timer;
struct work_struct slot_release_work;
struct mmc_omap_slot *next_slot;
struct work_struct send_stop_work;
struct mmc_data *stop_data;
struct sg_mapping_iter sg_miter;
unsigned int sg_len;
u32 total_bytes_left;
unsigned features;
unsigned brs_received:1, dma_done:1;
unsigned dma_in_use:1;
spinlock_t dma_lock;
struct mmc_omap_slot *slots[OMAP_MMC_MAX_SLOTS];
struct mmc_omap_slot *current_slot;
spinlock_t slot_lock;
wait_queue_head_t slot_wq;
int nr_slots;
struct timer_list clk_timer;
spinlock_t clk_lock; /* for changing enabled state */
unsigned int fclk_enabled:1;
struct workqueue_struct *mmc_omap_wq;
struct omap_mmc_platform_data *pdata;
};
static void mmc_omap_fclk_offdelay(struct mmc_omap_slot *slot)
{
unsigned long tick_ns;
if (slot != NULL && slot->host->fclk_enabled && slot->fclk_freq > 0) {
tick_ns = DIV_ROUND_UP(NSEC_PER_SEC, slot->fclk_freq);
ndelay(8 * tick_ns);
}
}
static void mmc_omap_fclk_enable(struct mmc_omap_host *host, unsigned int enable)
{
unsigned long flags;
spin_lock_irqsave(&host->clk_lock, flags);
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/ioport.h`, `linux/platform_device.h`, `linux/interrupt.h`, `linux/dmaengine.h`, `linux/dma-mapping.h`.
- Detected declarations: `struct mmc_omap_host`, `struct mmc_omap_slot`, `struct mmc_omap_host`, `function mmc_omap_fclk_offdelay`, `function mmc_omap_fclk_enable`, `function mmc_omap_select_slot`, `function mmc_omap_slot_release_work`, `function mmc_omap_release_slot`, `function mmc_omap_cover_is_open`, `function mmc_omap_show_cover_switch`.
- 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.