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.

Dependency Surface

Detected Declarations

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

Implementation Notes