mirror of https://gitee.com/openkylin/linux.git
mmc: renesas-sdhi: rename tmio_mmc_dma.c => renesas_sdhi_sys_dmac.c
Rename the source file for DMA for SDHI as a follow-up to attaching DMA code to the SDHI driver rather than the tmio_core driver. The name "renesas" is chosen as the SDHI driver is applicable to a wider range of SoCs than SH-Mobile it seems to be a more appropriate name. However, the SDHI driver source itself, is left as sh_mobile_sdhi to avoid unnecessary churn. The name sys_dmac was chosen to reflect the type of DMA used. Internal symbols have also been renamed to reflect the filename change. A follow-up patch will re-organise the SDHI driver removing the need for renesas_sdhi_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:
parent
426e95d176
commit
c2a96987c7
|
@ -36,7 +36,7 @@ obj-$(CONFIG_MMC_S3C) += s3cmci.o
|
|||
obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o
|
||||
obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o
|
||||
obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o
|
||||
obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o tmio_mmc_dma.o
|
||||
obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o renesas_sdhi_sys_dmac.o
|
||||
obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
|
||||
obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o
|
||||
obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Renesas Mobile SDHI
|
||||
*
|
||||
* Copyright (C) 2017 Horms Solutions Ltd., Simon Horman
|
||||
* Copyright (C) 2017 Renesas Electronics Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef RENESAS_SDHI_H
|
||||
#define RENESAS_SDHI_H
|
||||
|
||||
#include "tmio_mmc.h"
|
||||
|
||||
const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void);
|
||||
#endif
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
#define TMIO_MMC_MIN_DMA_LEN 8
|
||||
|
||||
static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
|
||||
static void renesas_sdhi_sys_dmac_enable_dma(struct tmio_mmc_host *host,
|
||||
bool enable)
|
||||
{
|
||||
if (!host->chan_tx || !host->chan_rx)
|
||||
return;
|
||||
|
@ -29,19 +30,19 @@ static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
|
|||
host->dma->enable(host, enable);
|
||||
}
|
||||
|
||||
static void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
|
||||
static void renesas_sdhi_sys_dmac_abort_dma(struct tmio_mmc_host *host)
|
||||
{
|
||||
tmio_mmc_enable_dma(host, false);
|
||||
renesas_sdhi_sys_dmac_enable_dma(host, false);
|
||||
|
||||
if (host->chan_rx)
|
||||
dmaengine_terminate_all(host->chan_rx);
|
||||
if (host->chan_tx)
|
||||
dmaengine_terminate_all(host->chan_tx);
|
||||
|
||||
tmio_mmc_enable_dma(host, true);
|
||||
renesas_sdhi_sys_dmac_enable_dma(host, true);
|
||||
}
|
||||
|
||||
static void tmio_mmc_dma_callback(void *arg)
|
||||
static void renesas_sdhi_sys_dmac_dma_callback(void *arg)
|
||||
{
|
||||
struct tmio_mmc_host *host = arg;
|
||||
|
||||
|
@ -69,7 +70,7 @@ static void tmio_mmc_dma_callback(void *arg)
|
|||
spin_unlock_irq(&host->lock);
|
||||
}
|
||||
|
||||
static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
|
||||
static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
|
||||
{
|
||||
struct scatterlist *sg = host->sg_ptr, *sg_tmp;
|
||||
struct dma_async_tx_descriptor *desc = NULL;
|
||||
|
@ -115,7 +116,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
|
|||
|
||||
if (desc) {
|
||||
reinit_completion(&host->dma_dataend);
|
||||
desc->callback = tmio_mmc_dma_callback;
|
||||
desc->callback = renesas_sdhi_sys_dmac_dma_callback;
|
||||
desc->callback_param = host;
|
||||
|
||||
cookie = dmaengine_submit(desc);
|
||||
|
@ -127,7 +128,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
|
|||
pio:
|
||||
if (!desc) {
|
||||
/* DMA failed, fall back to PIO */
|
||||
tmio_mmc_enable_dma(host, false);
|
||||
renesas_sdhi_sys_dmac_enable_dma(host, false);
|
||||
if (ret >= 0)
|
||||
ret = -EIO;
|
||||
host->chan_rx = NULL;
|
||||
|
@ -143,7 +144,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
|
|||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
|
||||
static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
|
||||
{
|
||||
struct scatterlist *sg = host->sg_ptr, *sg_tmp;
|
||||
struct dma_async_tx_descriptor *desc = NULL;
|
||||
|
@ -193,7 +194,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
|
|||
|
||||
if (desc) {
|
||||
reinit_completion(&host->dma_dataend);
|
||||
desc->callback = tmio_mmc_dma_callback;
|
||||
desc->callback = renesas_sdhi_sys_dmac_dma_callback;
|
||||
desc->callback_param = host;
|
||||
|
||||
cookie = dmaengine_submit(desc);
|
||||
|
@ -205,7 +206,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
|
|||
pio:
|
||||
if (!desc) {
|
||||
/* DMA failed, fall back to PIO */
|
||||
tmio_mmc_enable_dma(host, false);
|
||||
renesas_sdhi_sys_dmac_enable_dma(host, false);
|
||||
if (ret >= 0)
|
||||
ret = -EIO;
|
||||
host->chan_tx = NULL;
|
||||
|
@ -221,19 +222,19 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
|
|||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_start_dma(struct tmio_mmc_host *host,
|
||||
static void renesas_sdhi_sys_dmac_start_dma(struct tmio_mmc_host *host,
|
||||
struct mmc_data *data)
|
||||
{
|
||||
if (data->flags & MMC_DATA_READ) {
|
||||
if (host->chan_rx)
|
||||
tmio_mmc_start_dma_rx(host);
|
||||
renesas_sdhi_sys_dmac_start_dma_rx(host);
|
||||
} else {
|
||||
if (host->chan_tx)
|
||||
tmio_mmc_start_dma_tx(host);
|
||||
renesas_sdhi_sys_dmac_start_dma_tx(host);
|
||||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_issue_tasklet_fn(unsigned long priv)
|
||||
static void renesas_sdhi_sys_dmac_issue_tasklet_fn(unsigned long priv)
|
||||
{
|
||||
struct tmio_mmc_host *host = (struct tmio_mmc_host *)priv;
|
||||
struct dma_chan *chan = NULL;
|
||||
|
@ -255,8 +256,8 @@ static void tmio_mmc_issue_tasklet_fn(unsigned long priv)
|
|||
dma_async_issue_pending(chan);
|
||||
}
|
||||
|
||||
static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
|
||||
struct tmio_mmc_data *pdata)
|
||||
static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
|
||||
struct tmio_mmc_data *pdata)
|
||||
{
|
||||
/* We can only either use DMA for both Tx and Rx or not use it at all */
|
||||
if (!host->dma || (!host->pdev->dev.of_node &&
|
||||
|
@ -319,10 +320,12 @@ static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
|
|||
goto ebouncebuf;
|
||||
|
||||
init_completion(&host->dma_dataend);
|
||||
tasklet_init(&host->dma_issue, tmio_mmc_issue_tasklet_fn, (unsigned long)host);
|
||||
tasklet_init(&host->dma_issue,
|
||||
renesas_sdhi_sys_dmac_issue_tasklet_fn,
|
||||
(unsigned long)host);
|
||||
}
|
||||
|
||||
tmio_mmc_enable_dma(host, true);
|
||||
renesas_sdhi_sys_dmac_enable_dma(host, true);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -336,7 +339,7 @@ static void tmio_mmc_request_dma(struct tmio_mmc_host *host,
|
|||
host->chan_tx = NULL;
|
||||
}
|
||||
|
||||
static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
|
||||
static void renesas_sdhi_sys_dmac_release_dma(struct tmio_mmc_host *host)
|
||||
{
|
||||
if (host->chan_tx) {
|
||||
struct dma_chan *chan = host->chan_tx;
|
||||
|
@ -354,15 +357,15 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct tmio_mmc_dma_ops tmio_mmc_dma_ops = {
|
||||
.start = tmio_mmc_start_dma,
|
||||
.enable = tmio_mmc_enable_dma,
|
||||
.request = tmio_mmc_request_dma,
|
||||
.release = tmio_mmc_release_dma,
|
||||
.abort = tmio_mmc_abort_dma,
|
||||
static const struct tmio_mmc_dma_ops renesas_sdhi_sys_dmac_dma_ops = {
|
||||
.start = renesas_sdhi_sys_dmac_start_dma,
|
||||
.enable = renesas_sdhi_sys_dmac_enable_dma,
|
||||
.request = renesas_sdhi_sys_dmac_request_dma,
|
||||
.release = renesas_sdhi_sys_dmac_release_dma,
|
||||
.abort = renesas_sdhi_sys_dmac_abort_dma,
|
||||
};
|
||||
|
||||
const struct tmio_mmc_dma_ops *tmio_mmc_get_dma_ops(void)
|
||||
const struct tmio_mmc_dma_ops *renesas_sdhi_get_dma_ops(void)
|
||||
{
|
||||
return &tmio_mmc_dma_ops;
|
||||
return &renesas_sdhi_sys_dmac_dma_ops;
|
||||
}
|
|
@ -35,6 +35,7 @@
|
|||
#include <linux/pinctrl/pinctrl-state.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include "renesas_sdhi.h"
|
||||
#include "tmio_mmc.h"
|
||||
|
||||
#define EXT_ACC 0xe4
|
||||
|
@ -667,7 +668,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
|
|||
/* All SDHI have SDIO status bits which must be 1 */
|
||||
mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
|
||||
|
||||
ret = tmio_mmc_host_probe(host, mmc_data, tmio_mmc_get_dma_ops());
|
||||
ret = tmio_mmc_host_probe(host, mmc_data, renesas_sdhi_get_dma_ops());
|
||||
if (ret < 0)
|
||||
goto efree;
|
||||
|
||||
|
|
|
@ -213,15 +213,6 @@ 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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue