drivers/mmc/host/tmio_mmc.h

Source file repositories/reference/linux-study-clean/drivers/mmc/host/tmio_mmc.h

File Facts

System
Linux kernel
Corpus path
drivers/mmc/host/tmio_mmc.h
Extension
.h
Size
9724 bytes
Lines
297
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 tmio_mmc_dma_ops {
	void (*start)(struct tmio_mmc_host *host, struct mmc_data *data);
	void (*enable)(struct tmio_mmc_host *host, bool enable);
	void (*request)(struct tmio_mmc_host *host,
			struct tmio_mmc_data *pdata);
	void (*release)(struct tmio_mmc_host *host);
	void (*abort)(struct tmio_mmc_host *host);
	void (*dataend)(struct tmio_mmc_host *host);

	/* optional */
	void (*end)(struct tmio_mmc_host *host);	/* held host->lock */
	bool (*dma_irq)(struct tmio_mmc_host *host);
};

struct tmio_mmc_host {
	void __iomem *ctl;
	struct mmc_command      *cmd;
	struct mmc_request      *mrq;
	struct mmc_data         *data;
	struct mmc_host         *mmc;
	struct mmc_host_ops     ops;

	/* pio related stuff */
	struct scatterlist      *sg_ptr;
	struct scatterlist      *sg_orig;
	unsigned int            sg_len;
	unsigned int            sg_off;
	unsigned int		bus_shift;

	struct platform_device *pdev;
	struct tmio_mmc_data *pdata;

	/* DMA support */
	bool			dma_on;
	struct dma_chan		*chan_rx;
	struct dma_chan		*chan_tx;
	struct work_struct	dma_issue;
	struct scatterlist	bounce_sg;
	u8			*bounce_buf;

	/* Track lost interrupts */
	struct delayed_work	delayed_reset_work;
	struct work_struct	done;

	/* Cache */
	u32			sdcard_irq_mask;
	u32			sdio_irq_mask;
	unsigned int		clk_cache;
	u32			sdcard_irq_setbit_mask;
	u32			sdcard_irq_mask_all;

	spinlock_t		lock;		/* protect host private data */
	unsigned long		last_req_ts;
	struct mutex		ios_lock;	/* protect set_ios() context */
	bool			native_hotplug;
	bool			sdio_irq_enabled;

	/* Mandatory callback */
	int (*clk_enable)(struct tmio_mmc_host *host);
	void (*set_clock)(struct tmio_mmc_host *host, unsigned int clock);

	/* Optional callbacks */
	void (*clk_disable)(struct tmio_mmc_host *host);
	int (*multi_io_quirk)(struct mmc_card *card,
			      unsigned int direction, int blk_size);
	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
	void (*reset)(struct tmio_mmc_host *host, bool preserve);
	bool (*check_retune)(struct tmio_mmc_host *host, struct mmc_request *mrq);
	void (*fixup_request)(struct tmio_mmc_host *host, struct mmc_request *mrq);
	unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host);
	void (*sdio_irq)(struct tmio_mmc_host *host);

	const struct tmio_mmc_dma_ops *dma_ops;
};

struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
					  struct tmio_mmc_data *pdata);
int tmio_mmc_host_probe(struct tmio_mmc_host *host);
void tmio_mmc_host_remove(struct tmio_mmc_host *host);
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);

void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
irqreturn_t tmio_mmc_irq(int irq, void *devid);

int tmio_mmc_host_runtime_suspend(struct device *dev);
int tmio_mmc_host_runtime_resume(struct device *dev);

static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
{

Annotation

Implementation Notes