* [PATCH 0/7]: mmc: shmobile: DMA cleanup
@ 2014-12-15 2:27 Kuninori Morimoto
2014-12-15 2:27 ` [PATCH 1/7] mmc: tmio: add .enable_dma Kuninori Morimoto
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:27 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Kuninori Morimoto, Linux-SH, linux-mmc
Hi Ulf, Chris, and Simon
These are DMA cleanup patches for SH-Mobile SDHI.
5) is based on 1).
6) is based on 2).
Kuninori Morimoto (7):
1) mmc: tmio: add .enable_dma
2) mmc: tmio: enable SoC specific DMA buswidth settings
3) mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
4) mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
5) mmc: sh_mobile_sdhi: use .enable_dma
6) mmc: sh_mobile: enable 32bit DMA access
7) mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
drivers/mmc/host/sh_mobile_sdhi.c | 66 +++++++++++++++++++++++++++----------
drivers/mmc/host/tmio_mmc_dma.c | 12 ++++---
include/linux/mfd/tmio.h | 11 +++----
3 files changed, 61 insertions(+), 28 deletions(-)
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/7] mmc: tmio: add .enable_dma
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
@ 2014-12-15 2:27 ` Kuninori Morimoto
2014-12-19 11:52 ` Ulf Hansson
2014-12-15 2:28 ` [PATCH 2/7] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:27 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Some controllers need DMA special register/setting.
This patch adds new .enable_dma callback for it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/tmio_mmc_dma.c | 3 +++
include/linux/mfd/tmio.h | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 7d07738..f0bf6df 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -30,6 +30,9 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
+
+ if (host->pdata->dma->enable)
+ host->pdata->dma->enable(host, enable);
}
void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 5738817..6788f9b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
struct dma_chan;
+struct tmio_mmc_host;
struct tmio_mmc_dma {
void *chan_priv_tx;
@@ -120,10 +121,9 @@ struct tmio_mmc_dma {
int alignment_shift;
dma_addr_t dma_rx_offset;
bool (*filter)(struct dma_chan *chan, void *arg);
+ void (*enable)(struct tmio_mmc_host *host, bool enable);
};
-struct tmio_mmc_host;
-
/*
* data for the MMC controller
*/
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/7] mmc: tmio: enable SoC specific DMA buswidth settings
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
2014-12-15 2:27 ` [PATCH 1/7] mmc: tmio: add .enable_dma Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 3/7] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Renesas SDHI which is based on TMIO driver has 2 type SoC. 1st one is
used as SH-Mobile series, and 2nd is R-Car series. R-Car series SoC has
DMA buswidth setting register which enables 32bit access.
This patch adds .dma_buswidth and enables it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/tmio_mmc_dma.c | 8 ++++++--
include/linux/mfd/tmio.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index f0bf6df..be82257 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -295,7 +295,9 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
cfg.slave_id = pdata->dma->slave_id_tx;
cfg.direction = DMA_MEM_TO_DEV;
cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift);
- cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ cfg.dst_addr_width = host->pdata->dma_buswidth;
+ if (!cfg.dst_addr_width)
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
cfg.src_addr = 0;
ret = dmaengine_slave_config(host->chan_tx, &cfg);
if (ret < 0)
@@ -314,7 +316,9 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
cfg.slave_id = pdata->dma->slave_id_rx;
cfg.direction = DMA_DEV_TO_MEM;
cfg.src_addr = cfg.dst_addr + pdata->dma->dma_rx_offset;
- cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ cfg.src_addr_width = host->pdata->dma_buswidth;
+ if (!cfg.src_addr_width)
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
cfg.dst_addr = 0;
ret = dmaengine_slave_config(host->chan_rx, &cfg);
if (ret < 0)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 6788f9b..85bd65b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -2,6 +2,7 @@
#define MFD_TMIO_H
#include <linux/device.h>
+#include <linux/dmaengine.h>
#include <linux/fb.h>
#include <linux/io.h>
#include <linux/jiffies.h>
@@ -133,6 +134,7 @@ struct tmio_mmc_data {
unsigned long capabilities2;
unsigned long flags;
unsigned long bus_shift;
+ enum dma_slave_buswidth dma_buswidth;
u32 ocr_mask; /* available voltages */
struct tmio_mmc_dma *dma;
struct device *dev;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/7] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
2014-12-15 2:27 ` [PATCH 1/7] mmc: tmio: add .enable_dma Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 2/7] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 4/7] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Latest SDHI on Renesas has expand register mapping.
update mmc_data->bus_shift for it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 00c8ebd..1c1e919 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -272,7 +272,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
}
/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
- mmc_data->bus_shift = resource_size(res) >> 9;
+ if (resource_size(res) > 0x100)
+ mmc_data->bus_shift = 1;
+ else
+ mmc_data->bus_shift = 0;
ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
if (ret < 0)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/7] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
` (2 preceding siblings ...)
2014-12-15 2:28 ` [PATCH 3/7] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 5/7] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
getting struct sh_mobile_sdhi from struct mmc_host needs to use
complex container_of(). This patch adds new host_to_priv macro to
get it easily.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 1c1e919..c0ef63b 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -35,6 +35,8 @@
#define EXT_ACC 0xe4
+#define host_to_priv(host) container_of((host)->pdata, struct sh_mobile_sdhi, mmc_data)
+
struct sh_mobile_sdhi_of_data {
unsigned long tmio_flags;
unsigned long capabilities;
@@ -88,7 +90,7 @@ static int sh_mobile_sdhi_clk_enable(struct platform_device *pdev, unsigned int
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct tmio_mmc_host *host = mmc_priv(mmc);
- struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
+ struct sh_mobile_sdhi *priv = host_to_priv(host);
int ret = clk_prepare_enable(priv->clk);
if (ret < 0)
return ret;
@@ -101,7 +103,7 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct tmio_mmc_host *host = mmc_priv(mmc);
- struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
+ struct sh_mobile_sdhi *priv = host_to_priv(host);
clk_disable_unprepare(priv->clk);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/7] mmc: sh_mobile_sdhi: use .enable_dma
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
` (3 preceding siblings ...)
2014-12-15 2:28 ` [PATCH 4/7] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 6/7] mmc: sh_mobile: enable 32bit DMA access Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 7/7] mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
tmio_mmc_data has .enable_dma callback now.
let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index c0ef63b..0bec741 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -158,6 +158,11 @@ static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card,
return blk_size;
}
+static void sh_mobile_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
+{
+ sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
+}
+
static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
{
mmc_detect_change(platform_get_drvdata(pdev), msecs_to_jiffies(100));
@@ -236,6 +241,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
dma_priv->alignment_shift = 1; /* 2-byte alignment */
dma_priv->filter = shdma_chan_filter;
+ dma_priv->enable = sh_mobile_sdhi_enable_dma;
mmc_data->dma = dma_priv;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/7] mmc: sh_mobile: enable 32bit DMA access
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
` (4 preceding siblings ...)
2014-12-15 2:28 ` [PATCH 5/7] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 7/7] mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Now, sh_mobile_sdhi can use 32bit DMA access in R-Cer Gen2.
Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 44 +++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 0bec741..9d65fae 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -41,6 +41,7 @@ struct sh_mobile_sdhi_of_data {
unsigned long tmio_flags;
unsigned long capabilities;
unsigned long capabilities2;
+ enum dma_slave_buswidth dma_buswidth;
dma_addr_t dma_rx_offset;
};
@@ -60,6 +61,7 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE |
TMIO_MMC_CLK_ACTUAL,
.capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+ .dma_buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES,
.dma_rx_offset = 0x2000,
};
@@ -86,6 +88,31 @@ struct sh_mobile_sdhi {
struct tmio_mmc_dma dma_priv;
};
+static void rcar_sdhi_sdbuf_width(struct tmio_mmc_host *host, int width)
+{
+ u32 val;
+
+ /*
+ * see also
+ * sh_mobile_sdhi_of_data :: dma_buswidth
+ */
+ switch (sd_ctrl_read16(host, CTL_VERSION)) {
+ case 0x490C:
+ val = (width == 32) ? 0x0001 : 0x0000;
+ break;
+ case 0xCB0D:
+ val = (width == 32) ? 0x0000 : 0x0001;
+ break;
+ default:
+ /*
+ * SH-Mobile. nothing to do
+ */
+ return;
+ }
+
+ sd_ctrl_write16(host, EXT_ACC, val);
+}
+
static int sh_mobile_sdhi_clk_enable(struct platform_device *pdev, unsigned int *f)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
@@ -96,6 +123,10 @@ static int sh_mobile_sdhi_clk_enable(struct platform_device *pdev, unsigned int
return ret;
*f = clk_get_rate(priv->clk);
+
+ /* enable 16bit data access on SDBUF as default */
+ rcar_sdhi_sdbuf_width(host, 16);
+
return 0;
}
@@ -161,6 +192,9 @@ static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card,
static void sh_mobile_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
{
sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
+
+ /* enable 32bit access if DMA mode if possibile */
+ rcar_sdhi_sdbuf_width(host, enable ? 32 : 16);
}
static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
@@ -184,7 +218,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
int irq, ret, i = 0;
bool multiplexed_isr = true;
struct tmio_mmc_dma *dma_priv;
- u16 ver;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -276,6 +309,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data->flags |= of_data->tmio_flags;
mmc_data->capabilities |= of_data->capabilities;
mmc_data->capabilities2 |= of_data->capabilities2;
+ mmc_data->dma_buswidth = of_data->dma_buswidth;
dma_priv->dma_rx_offset = of_data->dma_rx_offset;
}
@@ -290,14 +324,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
goto eprobe;
/*
- * FIXME:
- * this Workaround can be more clever method
- */
- ver = sd_ctrl_read16(host, CTL_VERSION);
- if (ver == 0xCB0D)
- sd_ctrl_write16(host, EXT_ACC, 1);
-
- /*
* Allow one or more specific (named) ISRs or
* one or more multiplexed (un-named) ISRs.
*/
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 7/7] mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
` (5 preceding siblings ...)
2014-12-15 2:28 ` [PATCH 6/7] mmc: sh_mobile: enable 32bit DMA access Kuninori Morimoto
@ 2014-12-15 2:28 ` Kuninori Morimoto
6 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-15 2:28 UTC (permalink / raw)
To: Ulf Hansson, Chris Ball; +Cc: Simon, Linux-SH, linux-mmc
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
tmio_mmc_host has .enable_dma callback now.
We don't need TMIO_MMC_HAVE_CTL_DMA_REG anymore.
Let's remove it
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/mmc/host/sh_mobile_sdhi.c | 5 -----
drivers/mmc/host/tmio_mmc_dma.c | 3 ---
include/linux/mfd/tmio.h | 5 -----
3 files changed, 13 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 9d65fae..e2c520e 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -299,11 +299,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
*/
mmc_data->flags |= TMIO_MMC_SDIO_STATUS_QUIRK;
- /*
- * All SDHI have DMA control register
- */
- mmc_data->flags |= TMIO_MMC_HAVE_CTL_DMA_REG;
-
if (of_id && of_id->data) {
const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
mmc_data->flags |= of_data->tmio_flags;
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index be82257..c2226cc 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -28,9 +28,6 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
if (!host->chan_tx || !host->chan_rx)
return;
- if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
- sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
-
if (host->pdata->dma->enable)
host->pdata->dma->enable(host, enable);
}
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 85bd65b..ff2eb93 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -97,11 +97,6 @@
#define TMIO_MMC_SDIO_STATUS_QUIRK (1 << 8)
/*
- * Some controllers have DMA enable/disable register
- */
-#define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9)
-
-/*
* Some controllers allows to set SDx actual clock
*/
#define TMIO_MMC_CLK_ACTUAL (1 << 10)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] mmc: tmio: add .enable_dma
2014-12-15 2:27 ` [PATCH 1/7] mmc: tmio: add .enable_dma Kuninori Morimoto
@ 2014-12-19 11:52 ` Ulf Hansson
2014-12-24 1:19 ` Kuninori Morimoto
0 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2014-12-19 11:52 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Chris Ball, Simon, Linux-SH, linux-mmc
On 15 December 2014 at 03:27, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Some controllers need DMA special register/setting.
> This patch adds new .enable_dma callback for it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> drivers/mmc/host/tmio_mmc_dma.c | 3 +++
> include/linux/mfd/tmio.h | 4 ++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index 7d07738..f0bf6df 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -30,6 +30,9 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
>
> if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
> sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
> +
> + if (host->pdata->dma->enable)
> + host->pdata->dma->enable(host, enable);
> }
>
> void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 5738817..6788f9b 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
> void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>
> struct dma_chan;
> +struct tmio_mmc_host;
>
> struct tmio_mmc_dma {
> void *chan_priv_tx;
> @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
> int alignment_shift;
> dma_addr_t dma_rx_offset;
> bool (*filter)(struct dma_chan *chan, void *arg);
> + void (*enable)(struct tmio_mmc_host *host, bool enable);
Before we decide to add more callbacks to this struct, can we please
try to move the mmc specific parts into the mmc tmio specific header?
drivers/mmc/host/tmio_mmc.h.
For example the tmio_mmc_dma can be moved there.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] mmc: tmio: add .enable_dma
2014-12-19 11:52 ` Ulf Hansson
@ 2014-12-24 1:19 ` Kuninori Morimoto
2014-12-24 1:30 ` Kuninori Morimoto
0 siblings, 1 reply; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-24 1:19 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Chris Ball, Simon, Linux-SH, linux-mmc
Hi Ulf
> On 15 December 2014 at 03:27, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Some controllers need DMA special register/setting.
> > This patch adds new .enable_dma callback for it.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > drivers/mmc/host/tmio_mmc_dma.c | 3 +++
> > include/linux/mfd/tmio.h | 4 ++--
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index 7d07738..f0bf6df 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -30,6 +30,9 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
> >
> > if (host->pdata->flags & TMIO_MMC_HAVE_CTL_DMA_REG)
> > sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
> > +
> > + if (host->pdata->dma->enable)
> > + host->pdata->dma->enable(host, enable);
> > }
> >
> > void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 5738817..6788f9b 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
> > void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> >
> > struct dma_chan;
> > +struct tmio_mmc_host;
> >
> > struct tmio_mmc_dma {
> > void *chan_priv_tx;
> > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
> > int alignment_shift;
> > dma_addr_t dma_rx_offset;
> > bool (*filter)(struct dma_chan *chan, void *arg);
> > + void (*enable)(struct tmio_mmc_host *host, bool enable);
>
> Before we decide to add more callbacks to this struct, can we please
> try to move the mmc specific parts into the mmc tmio specific header?
> drivers/mmc/host/tmio_mmc.h.
>
> For example the tmio_mmc_dma can be moved there.
OK, I understand
Will do
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] mmc: tmio: add .enable_dma
2014-12-24 1:19 ` Kuninori Morimoto
@ 2014-12-24 1:30 ` Kuninori Morimoto
2014-12-30 12:12 ` Ulf Hansson
0 siblings, 1 reply; 12+ messages in thread
From: Kuninori Morimoto @ 2014-12-24 1:30 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Ulf Hansson, Chris Ball, Simon, Linux-SH, linux-mmc
Hi Ulf, again
> > > void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
> > > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > > index 5738817..6788f9b 100644
> > > --- a/include/linux/mfd/tmio.h
> > > +++ b/include/linux/mfd/tmio.h
> > > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
> > > void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> > >
> > > struct dma_chan;
> > > +struct tmio_mmc_host;
> > >
> > > struct tmio_mmc_dma {
> > > void *chan_priv_tx;
> > > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
> > > int alignment_shift;
> > > dma_addr_t dma_rx_offset;
> > > bool (*filter)(struct dma_chan *chan, void *arg);
> > > + void (*enable)(struct tmio_mmc_host *host, bool enable);
> >
> > Before we decide to add more callbacks to this struct, can we please
> > try to move the mmc specific parts into the mmc tmio specific header?
> > drivers/mmc/host/tmio_mmc.h.
> >
> > For example the tmio_mmc_dma can be moved there.
Hmm....
tmio_mmc_dma is used from tmio_mmc_data.
And, tmio_mmc_data is used from drivers/mfd/xxx.c
It seems impossible to move it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] mmc: tmio: add .enable_dma
2014-12-24 1:30 ` Kuninori Morimoto
@ 2014-12-30 12:12 ` Ulf Hansson
0 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2014-12-30 12:12 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Chris Ball, Simon, Linux-SH, linux-mmc
On 24 December 2014 at 02:30, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Ulf, again
>
>> > > void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
>> > > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
>> > > index 5738817..6788f9b 100644
>> > > --- a/include/linux/mfd/tmio.h
>> > > +++ b/include/linux/mfd/tmio.h
>> > > @@ -111,6 +111,7 @@ void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
>> > > void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>> > >
>> > > struct dma_chan;
>> > > +struct tmio_mmc_host;
>> > >
>> > > struct tmio_mmc_dma {
>> > > void *chan_priv_tx;
>> > > @@ -120,10 +121,9 @@ struct tmio_mmc_dma {
>> > > int alignment_shift;
>> > > dma_addr_t dma_rx_offset;
>> > > bool (*filter)(struct dma_chan *chan, void *arg);
>> > > + void (*enable)(struct tmio_mmc_host *host, bool enable);
>> >
>> > Before we decide to add more callbacks to this struct, can we please
>> > try to move the mmc specific parts into the mmc tmio specific header?
>> > drivers/mmc/host/tmio_mmc.h.
>> >
>> > For example the tmio_mmc_dma can be moved there.
>
> Hmm....
> tmio_mmc_dma is used from tmio_mmc_data.
> And, tmio_mmc_data is used from drivers/mfd/xxx.c
> It seems impossible to move it.
Doesn't a forward declaration of struct tmio_mmc_dma; in
linux/mfd/tmio.h solve that?
Moreover I did a git grep search for "tmio_mmc_data" to find out
what's being provided to the tmio mmc driver as platform data. Unless
my research was wrong, I only find the following being used:
.hclk
.set_pwr
.set_clk_div
So, we can clean up the struct tmio_mmc_data. That will in
linux/mfd/tmio.h remove the dependency to forward declare both struct
tmio_mmc_host and struct tmio_mmc_dma.
Kind regards
Uffe
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-12-30 12:12 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 2:27 [PATCH 0/7]: mmc: shmobile: DMA cleanup Kuninori Morimoto
2014-12-15 2:27 ` [PATCH 1/7] mmc: tmio: add .enable_dma Kuninori Morimoto
2014-12-19 11:52 ` Ulf Hansson
2014-12-24 1:19 ` Kuninori Morimoto
2014-12-24 1:30 ` Kuninori Morimoto
2014-12-30 12:12 ` Ulf Hansson
2014-12-15 2:28 ` [PATCH 2/7] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 3/7] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 4/7] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 5/7] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 6/7] mmc: sh_mobile: enable 32bit DMA access Kuninori Morimoto
2014-12-15 2:28 ` [PATCH 7/7] mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).