mmc: renesas-sdhi, tmio: make dma more modular
Refactor DMA support to allow it to be provided by a set of call-backs that are provided by a host driver. The motivation is to allow multiple DMA implementations to be provided and instantiated at run-time. Instantiate the existing DMA implementation from the sh_mobile_sdhi driver which appears to match the current use-case. This has the side effect of moving the DMA code from the tmio_core to the sh_mobile_sdhi driver. A follow-up patch will change the source file for the SDHI DMA implementation accordingly. Another follow-up patch will re-organise the SDHI driver removing the need for tmio_mmc_get_dma_ops(). Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:

committed by
Ulf Hansson

parent
b21f13d8f7
commit
631fa73cfb
@@ -114,6 +114,15 @@ struct tmio_mmc_dma {
|
||||
void (*enable)(struct tmio_mmc_host *host, bool enable);
|
||||
};
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
struct tmio_mmc_host {
|
||||
void __iomem *ctl;
|
||||
struct mmc_command *cmd;
|
||||
@@ -188,12 +197,15 @@ struct tmio_mmc_host {
|
||||
/* Tuning values: 1 for success, 0 for failure */
|
||||
DECLARE_BITMAP(taps, BITS_PER_BYTE * sizeof(long));
|
||||
unsigned int tap_num;
|
||||
|
||||
const struct tmio_mmc_dma_ops *dma_ops;
|
||||
};
|
||||
|
||||
struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
|
||||
void tmio_mmc_host_free(struct tmio_mmc_host *host);
|
||||
int tmio_mmc_host_probe(struct tmio_mmc_host *host,
|
||||
struct tmio_mmc_data *pdata);
|
||||
struct tmio_mmc_data *pdata,
|
||||
const struct tmio_mmc_dma_ops *dma_ops);
|
||||
void tmio_mmc_host_remove(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
|
||||
|
||||
@@ -201,6 +213,15 @@ 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);
|
||||
|
||||
#if IS_ENABLED(CONFIG_MMC_SDHI)
|
||||
const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void);
|
||||
#else
|
||||
static inline const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
|
||||
unsigned long *flags)
|
||||
{
|
||||
@@ -215,38 +236,6 @@ static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg,
|
||||
local_irq_restore(*flags);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
|
||||
void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);
|
||||
void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable);
|
||||
void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);
|
||||
void tmio_mmc_release_dma(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_abort_dma(struct tmio_mmc_host *host);
|
||||
#else
|
||||
static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
|
||||
struct mmc_data *data)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
|
||||
struct tmio_mmc_data *pdata)
|
||||
{
|
||||
host->chan_tx = NULL;
|
||||
host->chan_rx = NULL;
|
||||
}
|
||||
|
||||
static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int tmio_mmc_host_runtime_suspend(struct device *dev);
|
||||
int tmio_mmc_host_runtime_resume(struct device *dev);
|
||||
|
Reference in New Issue
Block a user