linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup
@ 2015-01-13  4:56 ` Kuninori Morimoto
  2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
                     ` (19 more replies)
  0 siblings, 20 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:56 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc


Hi Ulf

These are v2 of tmio mmc / sh_mobile_sdhi cleanup patches.
v1 patch and in its discuss, we need 3 type of patch-set
 1. header cleanup
 2. sh_mobile_sdhi DMA
 3. DMAEngine cleanup

These are including 1. header cleanup, and one part of 2. sh_mobile_sdhi DMA.
If these are accepted, I will send 3. DMAEngine cleanup patch to DMAEngine ML,
and, left of 2. sh_mobile_sdhi DMA to MMC ML again.

 1) -  9) are header cleanup
10) - 17) are one part of sh_mobile_sdhi DMA

Kuninori Morimoto (17):
       1) mmc: tmio: add tmio_mmc_host_alloc/free()
       2) mmc: tmio: tmio_mmc_host has .dma
       3) mmc: tmio: tmio_mmc_host has .write16_hook
       4) mmc: tmio: tmio_mmc_host has .clk_enable
       5) mmc: tmio: tmio_mmc_host has .clk_disable
       6) mmc: tmio: tmio_mmc_host has .multi_io_quirk
       7) mmc: tmio: tmio_mmc_host has .bus_shift
       8) mmc: tmio: tmio_mmc_data has .alignment_shift
       9) mmc: tmio: tmio_mmc_data has .dma_rx_offset
      10) mmc: tmio: add .enable_dma on tmio_mmc_data
      11) mmc: tmio: enable SoC specific DMA buswidth settings
      12) mmc: sh_mobile_sdhi: remove .init/.cleanup
      13) mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
      14) mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
      15) mmc: sh_mobile_sdhi: use .enable_dma
      16) mmc: sh_mobile_sdhi: enable 32bit DMA access
      17) mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag

 drivers/mmc/host/sh_mobile_sdhi.c  |  117 ++++++++++++++++++++----------------
 drivers/mmc/host/tmio_mmc.c        |   15 +++--
 drivers/mmc/host/tmio_mmc.h        |   43 +++++++++----
 drivers/mmc/host/tmio_mmc_dma.c    |   38 ++++++------
 drivers/mmc/host/tmio_mmc_pio.c    |   59 ++++++++++--------
 include/linux/mfd/tmio.h           |   28 +--------
 include/linux/mmc/sh_mobile_sdhi.h |   15 -----
 7 files changed, 164 insertions(+), 151 deletions(-)


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free()
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
@ 2015-01-13  4:57   ` Kuninori Morimoto
  2015-01-20  9:10     ` Ulf Hansson
  2015-01-13  4:57   ` [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
                     ` (18 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:57 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current tmio_mmc driver is using tmio_mmc_data for driver/platform
specific data/callback, and it is needed for tmio_mmc_host_probe()
function. Because of this style, include/linux/mfd/tmio.h header has
tmio driver/framework specific data which is not needed from platform.

This patch adds new tmio_mmc_host_alloc/free() as cleanup preparation.
tmio driver specific data/callback will be implemented in tmio_mmc_host,
and platform specific data/callback will be implemented in tmio_mmc_data
in this cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   14 +++++++++---
 drivers/mmc/host/tmio_mmc.c       |   10 +++++++--
 drivers/mmc/host/tmio_mmc.h       |    5 +++--
 drivers/mmc/host/tmio_mmc_pio.c   |   43 +++++++++++++++++++++++--------------
 include/linux/mfd/tmio.h          |    1 -
 5 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 00c8ebd..cf062c4 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -113,7 +113,7 @@ static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
 		udelay(1);
 
 	if (!timeout) {
-		dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
+		dev_warn(&host->pdev->dev, "timeout waiting for SD bus idle\n");
 		return -EBUSY;
 	}
 
@@ -207,6 +207,12 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eclkget;
 	}
 
+	host = tmio_mmc_host_alloc(pdev);
+	if (!host) {
+		ret = -ENOMEM;
+		goto eprobe;
+	}
+
 	mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
 	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
@@ -274,9 +280,9 @@ 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;
 
-	ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
+	ret = tmio_mmc_host_probe(host, mmc_data);
 	if (ret < 0)
-		goto eprobe;
+		goto efree;
 
 	/*
 	 * FIXME:
@@ -351,6 +357,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 
 eirq:
 	tmio_mmc_host_remove(host);
+efree:
+	tmio_mmc_host_free(host);
 eprobe:
 eclkget:
 	if (p && p->cleanup)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 2616fdf..f47ae08 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -92,10 +92,14 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 	pdata->bus_shift = resource_size(res) >> 10;
 	pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
 
-	ret = tmio_mmc_host_probe(&host, pdev, pdata);
-	if (ret)
+	host = tmio_mmc_host_alloc(pdev);
+	if (!host)
 		goto cell_disable;
 
+	ret = tmio_mmc_host_probe(host, pdata);
+	if (ret)
+		goto host_free;
+
 	ret = request_irq(irq, tmio_mmc_irq, IRQF_TRIGGER_FALLING,
 				dev_name(&pdev->dev), host);
 	if (ret)
@@ -108,6 +112,8 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 
 host_remove:
 	tmio_mmc_host_remove(host);
+host_free:
+	tmio_mmc_host_free(host);
 cell_disable:
 	if (cell->disable)
 		cell->disable(pdev);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index a34ecbe..60d6747 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -85,8 +85,9 @@ struct tmio_mmc_host {
 	bool			sdio_irq_enabled;
 };
 
-int tmio_mmc_host_probe(struct tmio_mmc_host **host,
-			struct platform_device *pdev,
+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);
 void tmio_mmc_host_remove(struct tmio_mmc_host *host);
 void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 250bf8c..1a9a13f 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1054,12 +1054,35 @@ static void tmio_mmc_of_parse(struct platform_device *pdev,
 		pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE;
 }
 
-int tmio_mmc_host_probe(struct tmio_mmc_host **host,
-				  struct platform_device *pdev,
-				  struct tmio_mmc_data *pdata)
+struct tmio_mmc_host*
+tmio_mmc_host_alloc(struct platform_device *pdev)
 {
-	struct tmio_mmc_host *_host;
+	struct tmio_mmc_host *host;
 	struct mmc_host *mmc;
+
+	mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
+	if (!mmc)
+		return NULL;
+
+	host = mmc_priv(mmc);
+	host->mmc = mmc;
+	host->pdev = pdev;
+
+	return host;
+}
+
+void tmio_mmc_host_free(struct tmio_mmc_host *host)
+{
+	mmc_free_host(host->mmc);
+
+	host->mmc = NULL;
+}
+
+int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
+			struct tmio_mmc_data *pdata)
+{
+	struct platform_device *pdev = _host->pdev;
+	struct mmc_host *mmc = _host->mmc;
 	struct resource *res_ctl;
 	int ret;
 	u32 irq_mask = TMIO_MASK_CMD;
@@ -1073,19 +1096,11 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 	if (!res_ctl)
 		return -EINVAL;
 
-	mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
-	if (!mmc)
-		return -ENOMEM;
-
 	ret = mmc_of_parse(mmc);
 	if (ret < 0)
 		goto host_free;
 
-	pdata->dev = &pdev->dev;
-	_host = mmc_priv(mmc);
 	_host->pdata = pdata;
-	_host->mmc = mmc;
-	_host->pdev = pdev;
 	platform_set_drvdata(pdev, mmc);
 
 	_host->set_pwr = pdata->set_pwr;
@@ -1192,12 +1207,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
 		mmc_gpiod_request_cd_irq(mmc);
 	}
 
-	*host = _host;
-
 	return 0;
 
 host_free:
-	mmc_free_host(mmc);
 
 	return ret;
 }
@@ -1222,7 +1234,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 	pm_runtime_disable(&pdev->dev);
 
 	iounmap(host->ctl);
-	mmc_free_host(mmc);
 }
 EXPORT_SYMBOL(tmio_mmc_host_remove);
 
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 5738817..c7d9af0 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -135,7 +135,6 @@ struct tmio_mmc_data {
 	unsigned long			bus_shift;
 	u32				ocr_mask;	/* available voltages */
 	struct tmio_mmc_dma		*dma;
-	struct device			*dev;
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
  2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
@ 2015-01-13  4:57   ` Kuninori Morimoto
  2015-01-20  9:10     ` Ulf Hansson
  2015-01-13  4:57   ` [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
                     ` (17 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:57 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .dma is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
 drivers/mmc/host/tmio_mmc.h       |   11 +++++++++++
 drivers/mmc/host/tmio_mmc_dma.c   |   24 +++++++++++-------------
 include/linux/mfd/tmio.h          |   11 -----------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index cf062c4..288e78d 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -213,6 +213,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eprobe;
 	}
 
+	host->dma		= dma_priv;
+
 	mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
 	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
@@ -241,8 +243,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	dma_priv->alignment_shift = 1; /* 2-byte alignment */
 	dma_priv->filter = shdma_chan_filter;
 
-	mmc_data->dma = dma_priv;
-
 	/*
 	 * All SDHI blocks support 2-byte and larger block sizes in 4-bit
 	 * bus width mode.
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 60d6747..49a2559 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -40,6 +40,16 @@
 
 struct tmio_mmc_data;
 
+struct tmio_mmc_dma {
+	void *chan_priv_tx;
+	void *chan_priv_rx;
+	int slave_id_tx;
+	int slave_id_rx;
+	int alignment_shift;
+	dma_addr_t dma_rx_offset;
+	bool (*filter)(struct dma_chan *chan, void *arg);
+};
+
 struct tmio_mmc_host {
 	void __iomem *ctl;
 	struct mmc_command      *cmd;
@@ -59,6 +69,7 @@ struct tmio_mmc_host {
 
 	struct platform_device *pdev;
 	struct tmio_mmc_data *pdata;
+	struct tmio_mmc_dma	*dma;
 
 	/* DMA support */
 	bool			force_pio;
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 7d07738..6c214d6 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -49,11 +49,10 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
 	struct scatterlist *sg = host->sg_ptr, *sg_tmp;
 	struct dma_async_tx_descriptor *desc = NULL;
 	struct dma_chan *chan = host->chan_rx;
-	struct tmio_mmc_data *pdata = host->pdata;
 	dma_cookie_t cookie;
 	int ret, i;
 	bool aligned = true, multiple = true;
-	unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
+	unsigned int align = (1 << host->dma->alignment_shift) - 1;
 
 	for_each_sg(sg, sg_tmp, host->sg_len, i) {
 		if (sg_tmp->offset & align)
@@ -126,11 +125,10 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
 	struct scatterlist *sg = host->sg_ptr, *sg_tmp;
 	struct dma_async_tx_descriptor *desc = NULL;
 	struct dma_chan *chan = host->chan_tx;
-	struct tmio_mmc_data *pdata = host->pdata;
 	dma_cookie_t cookie;
 	int ret, i;
 	bool aligned = true, multiple = true;
-	unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
+	unsigned int align = (1 << host->dma->alignment_shift) - 1;
 
 	for_each_sg(sg, sg_tmp, host->sg_len, i) {
 		if (sg_tmp->offset & align)
@@ -262,8 +260,8 @@ out:
 void tmio_mmc_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 (!pdata->dma || (!host->pdev->dev.of_node &&
-		(!pdata->dma->chan_priv_tx || !pdata->dma->chan_priv_rx)))
+	if (!host->dma || (!host->pdev->dev.of_node &&
+		(!host->dma->chan_priv_tx || !host->dma->chan_priv_rx)))
 		return;
 
 	if (!host->chan_tx && !host->chan_rx) {
@@ -280,7 +278,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		dma_cap_set(DMA_SLAVE, mask);
 
 		host->chan_tx = dma_request_slave_channel_compat(mask,
-					pdata->dma->filter, pdata->dma->chan_priv_tx,
+					host->dma->filter, host->dma->chan_priv_tx,
 					&host->pdev->dev, "tx");
 		dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
 			host->chan_tx);
@@ -288,8 +286,8 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (!host->chan_tx)
 			return;
 
-		if (pdata->dma->chan_priv_tx)
-			cfg.slave_id = pdata->dma->slave_id_tx;
+		if (host->dma->chan_priv_tx)
+			cfg.slave_id = host->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;
@@ -299,7 +297,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 			goto ecfgtx;
 
 		host->chan_rx = dma_request_slave_channel_compat(mask,
-					pdata->dma->filter, pdata->dma->chan_priv_rx,
+					host->dma->filter, host->dma->chan_priv_rx,
 					&host->pdev->dev, "rx");
 		dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
 			host->chan_rx);
@@ -307,10 +305,10 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (!host->chan_rx)
 			goto ereqrx;
 
-		if (pdata->dma->chan_priv_rx)
-			cfg.slave_id = pdata->dma->slave_id_rx;
+		if (host->dma->chan_priv_rx)
+			cfg.slave_id = host->dma->slave_id_rx;
 		cfg.direction = DMA_DEV_TO_MEM;
-		cfg.src_addr = cfg.dst_addr + pdata->dma->dma_rx_offset;
+		cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
 		cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 		cfg.dst_addr = 0;
 		ret = dmaengine_slave_config(host->chan_rx, &cfg);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index c7d9af0..8d708c7 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -112,16 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
 
 struct dma_chan;
 
-struct tmio_mmc_dma {
-	void *chan_priv_tx;
-	void *chan_priv_rx;
-	int slave_id_tx;
-	int slave_id_rx;
-	int alignment_shift;
-	dma_addr_t dma_rx_offset;
-	bool (*filter)(struct dma_chan *chan, void *arg);
-};
-
 struct tmio_mmc_host;
 
 /*
@@ -134,7 +124,6 @@ struct tmio_mmc_data {
 	unsigned long			flags;
 	unsigned long			bus_shift;
 	u32				ocr_mask;	/* available voltages */
-	struct tmio_mmc_dma		*dma;
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
  2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
  2015-01-13  4:57   ` [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
@ 2015-01-13  4:57   ` Kuninori Morimoto
  2015-01-20  9:11     ` Ulf Hansson
  2015-01-13  4:57   ` [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
                     ` (16 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:57 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .write16_hook is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.h       |    4 +++-
 drivers/mmc/host/tmio_mmc_pio.c   |    2 +-
 include/linux/mfd/tmio.h          |    3 ---
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 288e78d..77ff062 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -214,11 +214,11 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	}
 
 	host->dma		= dma_priv;
+	host->write16_hook	= sh_mobile_sdhi_write16_hook;
 
 	mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
 	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
-	mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
 	mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
 	if (p) {
 		mmc_data->flags = p->tmio_flags;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 49a2559..3fa96b1 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -94,6 +94,8 @@ struct tmio_mmc_host {
 	struct mutex		ios_lock;	/* protect set_ios() context */
 	bool			native_hotplug;
 	bool			sdio_irq_enabled;
+
+	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
 };
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
@@ -183,7 +185,7 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
 	/* If there is a hook and it returns non-zero then there
 	 * is an error and the write should be skipped
 	 */
-	if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr))
+	if (host->write16_hook && host->write16_hook(host, addr))
 		return;
 	writew(val, host->ctl + (addr << host->pdata->bus_shift));
 }
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 1a9a13f..fe434cc 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1090,7 +1090,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 	tmio_mmc_of_parse(pdev, pdata);
 
 	if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
-		pdata->write16_hook = NULL;
+		_host->write16_hook = NULL;
 
 	res_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res_ctl)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 8d708c7..0872ca1 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -112,8 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
 
 struct dma_chan;
 
-struct tmio_mmc_host;
-
 /*
  * data for the MMC controller
  */
@@ -127,7 +125,6 @@ struct tmio_mmc_data {
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
-	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
 	/* clock management callbacks */
 	int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
 	void (*clk_disable)(struct platform_device *pdev);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (2 preceding siblings ...)
  2015-01-13  4:57   ` [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
@ 2015-01-13  4:57   ` Kuninori Morimoto
  2015-01-20  9:11     ` Ulf Hansson
  2015-01-13  4:58   ` [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
                     ` (15 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:57 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .clk_enable is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.h       |    1 +
 drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
 include/linux/mfd/tmio.h          |    1 -
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 77ff062..87af77d 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -215,8 +215,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 
 	host->dma		= dma_priv;
 	host->write16_hook	= sh_mobile_sdhi_write16_hook;
+	host->clk_enable	= sh_mobile_sdhi_clk_enable;
 
-	mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
 	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
 	mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 3fa96b1..5cd2986 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -96,6 +96,7 @@ struct tmio_mmc_host {
 	bool			sdio_irq_enabled;
 
 	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
+	int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
 };
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index fe434cc..1528c88 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -835,13 +835,12 @@ fail:
 static int tmio_mmc_clk_update(struct tmio_mmc_host *host)
 {
 	struct mmc_host *mmc = host->mmc;
-	struct tmio_mmc_data *pdata = host->pdata;
 	int ret;
 
-	if (!pdata->clk_enable)
+	if (!host->clk_enable)
 		return -ENOTSUPP;
 
-	ret = pdata->clk_enable(host->pdev, &mmc->f_max);
+	ret = host->clk_enable(host->pdev, &mmc->f_max);
 	if (!ret)
 		mmc->f_min = mmc->f_max / 512;
 
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 0872ca1..472587a 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -126,7 +126,6 @@ struct tmio_mmc_data {
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 	/* clock management callbacks */
-	int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
 	void (*clk_disable)(struct platform_device *pdev);
 	int (*multi_io_quirk)(struct mmc_card *card,
 			      unsigned int direction, int blk_size);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (3 preceding siblings ...)
  2015-01-13  4:57   ` [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
@ 2015-01-13  4:58   ` Kuninori Morimoto
  2015-01-20  9:11     ` Ulf Hansson
  2015-01-13  4:58   ` [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
                     ` (14 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .clk_disable is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.h       |    1 +
 drivers/mmc/host/tmio_mmc_pio.c   |    4 ++--
 include/linux/mfd/tmio.h          |    3 +--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 87af77d..5e02a6a 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -216,8 +216,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	host->dma		= dma_priv;
 	host->write16_hook	= sh_mobile_sdhi_write16_hook;
 	host->clk_enable	= sh_mobile_sdhi_clk_enable;
+	host->clk_disable	= sh_mobile_sdhi_clk_disable;
 
-	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
 	mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
 	if (p) {
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 5cd2986..28234ec 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -97,6 +97,7 @@ struct tmio_mmc_host {
 
 	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
 	int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
+	void (*clk_disable)(struct platform_device *pdev);
 };
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 1528c88..94fbf4a 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1247,8 +1247,8 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
 	if (host->clk_cache)
 		tmio_mmc_clk_stop(host);
 
-	if (host->pdata->clk_disable)
-		host->pdata->clk_disable(host->pdev);
+	if (host->clk_disable)
+		host->clk_disable(host->pdev);
 
 	return 0;
 }
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 472587a..a3f78da 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -125,8 +125,7 @@ struct tmio_mmc_data {
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
-	/* clock management callbacks */
-	void (*clk_disable)(struct platform_device *pdev);
+
 	int (*multi_io_quirk)(struct mmc_card *card,
 			      unsigned int direction, int blk_size);
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (4 preceding siblings ...)
  2015-01-13  4:58   ` [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
@ 2015-01-13  4:58   ` Kuninori Morimoto
  2015-01-20  9:12     ` Ulf Hansson
  2015-01-13  4:58   ` [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
                     ` (13 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .multi_io_quirk is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.h       |    2 ++
 drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
 include/linux/mfd/tmio.h          |    3 ---
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 5e02a6a..c92efe5 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -217,9 +217,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	host->write16_hook	= sh_mobile_sdhi_write16_hook;
 	host->clk_enable	= sh_mobile_sdhi_clk_enable;
 	host->clk_disable	= sh_mobile_sdhi_clk_disable;
+	host->multi_io_quirk	= sh_mobile_sdhi_multi_io_quirk;
 
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
-	mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
 	if (p) {
 		mmc_data->flags = p->tmio_flags;
 		mmc_data->ocr_mask = p->tmio_ocr_mask;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 28234ec..263256c 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -98,6 +98,8 @@ struct tmio_mmc_host {
 	int (*write16_hook)(struct tmio_mmc_host *host, int addr);
 	int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
 	void (*clk_disable)(struct platform_device *pdev);
+	int (*multi_io_quirk)(struct mmc_card *card,
+			      unsigned int direction, int blk_size);
 };
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 94fbf4a..67c8182 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -1004,10 +1004,9 @@ static int tmio_multi_io_quirk(struct mmc_card *card,
 			       unsigned int direction, int blk_size)
 {
 	struct tmio_mmc_host *host = mmc_priv(card->host);
-	struct tmio_mmc_data *pdata = host->pdata;
 
-	if (pdata->multi_io_quirk)
-		return pdata->multi_io_quirk(card, direction, blk_size);
+	if (host->multi_io_quirk)
+		return host->multi_io_quirk(card, direction, blk_size);
 
 	return blk_size;
 }
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index a3f78da..3edaa17 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -125,9 +125,6 @@ struct tmio_mmc_data {
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
-
-	int (*multi_io_quirk)(struct mmc_card *card,
-			      unsigned int direction, int blk_size);
 };
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (5 preceding siblings ...)
  2015-01-13  4:58   ` [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
@ 2015-01-13  4:58   ` Kuninori Morimoto
  2015-01-20  9:12     ` Ulf Hansson
  2015-01-13  4:58   ` [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift Kuninori Morimoto
                     ` (12 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .bus_shift is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    5 ++---
 drivers/mmc/host/tmio_mmc.c       |    5 +++--
 drivers/mmc/host/tmio_mmc.h       |   17 +++++++++--------
 drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
 include/linux/mfd/tmio.h          |    1 -
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index c92efe5..0db2a0a 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -218,6 +218,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	host->clk_enable	= sh_mobile_sdhi_clk_enable;
 	host->clk_disable	= sh_mobile_sdhi_clk_disable;
 	host->multi_io_quirk	= sh_mobile_sdhi_multi_io_quirk;
+	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
+	host->bus_shift		= resource_size(res) >> 9;
 
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
 	if (p) {
@@ -277,9 +279,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		dma_priv->dma_rx_offset = of_data->dma_rx_offset;
 	}
 
-	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-	mmc_data->bus_shift = resource_size(res) >> 9;
-
 	ret = tmio_mmc_host_probe(host, mmc_data);
 	if (ret < 0)
 		goto efree;
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index f47ae08..9e8723d 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -88,14 +88,15 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
-	pdata->bus_shift = resource_size(res) >> 10;
 	pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
 
 	host = tmio_mmc_host_alloc(pdev);
 	if (!host)
 		goto cell_disable;
 
+	/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
+	host->bus_shift = resource_size(res) >> 10;
+
 	ret = tmio_mmc_host_probe(host, pdata);
 	if (ret)
 		goto host_free;
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 263256c..a5d30bf 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -66,6 +66,7 @@ struct tmio_mmc_host {
 	struct scatterlist      *sg_orig;
 	unsigned int            sg_len;
 	unsigned int            sg_off;
+	unsigned long		bus_shift;
 
 	struct platform_device *pdev;
 	struct tmio_mmc_data *pdata;
@@ -169,19 +170,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev);
 
 static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->pdata->bus_shift));
+	return readw(host->ctl + (addr << host->bus_shift));
 }
 
 static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
+	readsw(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
 {
-	return readw(host->ctl + (addr << host->pdata->bus_shift)) |
-	       readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16;
+	return readw(host->ctl + (addr << host->bus_shift)) |
+	       readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
 }
 
 static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
@@ -191,19 +192,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
 	 */
 	if (host->write16_hook && host->write16_hook(host, addr))
 		return;
-	writew(val, host->ctl + (addr << host->pdata->bus_shift));
+	writew(val, host->ctl + (addr << host->bus_shift));
 }
 
 static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
 		u16 *buf, int count)
 {
-	writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
+	writesw(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
 static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
 {
-	writew(val, host->ctl + (addr << host->pdata->bus_shift));
-	writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift));
+	writew(val, host->ctl + (addr << host->bus_shift));
+	writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
 }
 
 
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 6c214d6..ee0131e 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -289,7 +289,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (host->dma->chan_priv_tx)
 			cfg.slave_id = host->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 = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
 		cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 		cfg.src_addr = 0;
 		ret = dmaengine_slave_config(host->chan_tx, &cfg);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 3edaa17..7a5c279 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -120,7 +120,6 @@ struct tmio_mmc_data {
 	unsigned long			capabilities;
 	unsigned long			capabilities2;
 	unsigned long			flags;
-	unsigned long			bus_shift;
 	u32				ocr_mask;	/* available voltages */
 	unsigned int			cd_gpio;
 	void (*set_pwr)(struct platform_device *host, int state);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (6 preceding siblings ...)
  2015-01-13  4:58   ` [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
@ 2015-01-13  4:58   ` Kuninori Morimoto
  2015-01-20  9:13     ` Ulf Hansson
  2015-01-13  4:58   ` [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset Kuninori Morimoto
                     ` (11 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .alignment_shift is implemented under tmio_mmc_dma.
It goes to tmio_mmc_data by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
 drivers/mmc/host/tmio_mmc.h       |    1 -
 drivers/mmc/host/tmio_mmc_dma.c   |    4 ++--
 include/linux/mfd/tmio.h          |    1 +
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 0db2a0a..782d8cf 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -241,10 +241,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 			dma_priv->slave_id_rx = p->dma_slave_rx;
 		}
 	}
-
-	dma_priv->alignment_shift = 1; /* 2-byte alignment */
 	dma_priv->filter = shdma_chan_filter;
 
+	mmc_data->alignment_shift = 1; /* 2-byte alignment */
+
 	/*
 	 * All SDHI blocks support 2-byte and larger block sizes in 4-bit
 	 * bus width mode.
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index a5d30bf..9482abc 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -45,7 +45,6 @@ struct tmio_mmc_dma {
 	void *chan_priv_rx;
 	int slave_id_tx;
 	int slave_id_rx;
-	int alignment_shift;
 	dma_addr_t dma_rx_offset;
 	bool (*filter)(struct dma_chan *chan, void *arg);
 };
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index ee0131e..d2b02de 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -52,7 +52,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
 	dma_cookie_t cookie;
 	int ret, i;
 	bool aligned = true, multiple = true;
-	unsigned int align = (1 << host->dma->alignment_shift) - 1;
+	unsigned int align = (1 << host->pdata->alignment_shift) - 1;
 
 	for_each_sg(sg, sg_tmp, host->sg_len, i) {
 		if (sg_tmp->offset & align)
@@ -128,7 +128,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
 	dma_cookie_t cookie;
 	int ret, i;
 	bool aligned = true, multiple = true;
-	unsigned int align = (1 << host->dma->alignment_shift) - 1;
+	unsigned int align = (1 << host->pdata->alignment_shift) - 1;
 
 	for_each_sg(sg, sg_tmp, host->sg_len, i) {
 		if (sg_tmp->offset & align)
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 7a5c279..28a12d1 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -122,6 +122,7 @@ struct tmio_mmc_data {
 	unsigned long			flags;
 	u32				ocr_mask;	/* available voltages */
 	unsigned int			cd_gpio;
+	int				alignment_shift;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (7 preceding siblings ...)
  2015-01-13  4:58   ` [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift Kuninori Morimoto
@ 2015-01-13  4:58   ` Kuninori Morimoto
  2015-01-20  9:13     ` Ulf Hansson
  2015-01-13  4:59   ` [PATCH 10/17] mmc: tmio: add .enable_dma on tmio_mmc_data Kuninori Morimoto
                     ` (10 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:58 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current .dma_rx_offset is implemented under tmio_mmc_dma.
It goes to tmio_mmc_data by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.h       |    1 -
 drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
 include/linux/mfd/tmio.h          |    1 +
 4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 782d8cf..c06e93b 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -276,7 +276,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;
-		dma_priv->dma_rx_offset = of_data->dma_rx_offset;
+		mmc_data->dma_rx_offset = of_data->dma_rx_offset;
 	}
 
 	ret = tmio_mmc_host_probe(host, mmc_data);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9482abc..c9a8469 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -45,7 +45,6 @@ struct tmio_mmc_dma {
 	void *chan_priv_rx;
 	int slave_id_tx;
 	int slave_id_rx;
-	dma_addr_t dma_rx_offset;
 	bool (*filter)(struct dma_chan *chan, void *arg);
 };
 
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index d2b02de..634b2700c 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -308,7 +308,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (host->dma->chan_priv_rx)
 			cfg.slave_id = host->dma->slave_id_rx;
 		cfg.direction = DMA_DEV_TO_MEM;
-		cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
+		cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
 		cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
 		cfg.dst_addr = 0;
 		ret = dmaengine_slave_config(host->chan_rx, &cfg);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 28a12d1..807ecfb 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -123,6 +123,7 @@ struct tmio_mmc_data {
 	u32				ocr_mask;	/* available voltages */
 	unsigned int			cd_gpio;
 	int				alignment_shift;
+	dma_addr_t			dma_rx_offset;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 10/17] mmc: tmio: add .enable_dma on tmio_mmc_data
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (8 preceding siblings ...)
  2015-01-13  4:58   ` [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  4:59   ` [PATCH 11/17] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
                     ` (9 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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.h     |    2 ++
 drivers/mmc/host/tmio_mmc_dma.c |    3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index c9a8469..0699edb 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -39,6 +39,7 @@
 #define TMIO_MASK_IRQ     (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)
 
 struct tmio_mmc_data;
+struct tmio_mmc_host;
 
 struct tmio_mmc_dma {
 	void *chan_priv_tx;
@@ -46,6 +47,7 @@ struct tmio_mmc_dma {
 	int slave_id_tx;
 	int slave_id_rx;
 	bool (*filter)(struct dma_chan *chan, void *arg);
+	void (*enable)(struct tmio_mmc_host *host, bool enable);
 };
 
 struct tmio_mmc_host {
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 634b2700c..eb6b45c 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->dma->enable)
+		host->dma->enable(host, enable);
 }
 
 void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 11/17] mmc: tmio: enable SoC specific DMA buswidth settings
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (9 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 10/17] mmc: tmio: add .enable_dma on tmio_mmc_data Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  4:59   ` [PATCH 12/17] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
                     ` (8 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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.h     |    2 ++
 drivers/mmc/host/tmio_mmc_dma.c |    8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 0699edb..fc3805e 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -16,6 +16,7 @@
 #ifndef TMIO_MMC_H
 #define TMIO_MMC_H
 
+#include <linux/dmaengine.h>
 #include <linux/highmem.h>
 #include <linux/mmc/tmio.h>
 #include <linux/mutex.h>
@@ -46,6 +47,7 @@ struct tmio_mmc_dma {
 	void *chan_priv_rx;
 	int slave_id_tx;
 	int slave_id_rx;
+	enum dma_slave_buswidth dma_buswidth;
 	bool (*filter)(struct dma_chan *chan, void *arg);
 	void (*enable)(struct tmio_mmc_host *host, bool enable);
 };
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index eb6b45c..aa5f4b6 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -293,7 +293,9 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 			cfg.slave_id = host->dma->slave_id_tx;
 		cfg.direction = DMA_MEM_TO_DEV;
 		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
-		cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+		cfg.dst_addr_width = host->dma->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)
@@ -312,7 +314,9 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 			cfg.slave_id = host->dma->slave_id_rx;
 		cfg.direction = DMA_DEV_TO_MEM;
 		cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
-		cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+		cfg.src_addr_width = host->dma->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)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 12/17] mmc: sh_mobile_sdhi: remove .init/.cleanup
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (10 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 11/17] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  4:59   ` [PATCH 13/17] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
                     ` (7 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

No one is using .init/.cleanup callback function.
Let's remove these.
sdhi_ops and .cd_wakeup are also removed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c  |   26 +-------------------------
 include/linux/mmc/sh_mobile_sdhi.h |   15 ---------------
 2 files changed, 1 insertion(+), 40 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index c06e93b..48a3be8 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -156,15 +156,6 @@ static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card,
 	return blk_size;
 }
 
-static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
-{
-	mmc_detect_change(platform_get_drvdata(pdev), msecs_to_jiffies(100));
-}
-
-static const struct sh_mobile_sdhi_ops sdhi_ops = {
-	.cd_wakeup = sh_mobile_sdhi_cd_wakeup,
-};
-
 static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *of_id =
@@ -192,19 +183,11 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	mmc_data = &priv->mmc_data;
 	dma_priv = &priv->dma_priv;
 
-	if (p) {
-		if (p->init) {
-			ret = p->init(pdev, &sdhi_ops);
-			if (ret)
-				return ret;
-		}
-	}
-
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		ret = PTR_ERR(priv->clk);
 		dev_err(&pdev->dev, "cannot get clock: %d\n", ret);
-		goto eclkget;
+		goto eprobe;
 	}
 
 	host = tmio_mmc_host_alloc(pdev);
@@ -359,9 +342,6 @@ eirq:
 efree:
 	tmio_mmc_host_free(host);
 eprobe:
-eclkget:
-	if (p && p->cleanup)
-		p->cleanup(pdev);
 	return ret;
 }
 
@@ -369,13 +349,9 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
 {
 	struct mmc_host *mmc = platform_get_drvdata(pdev);
 	struct tmio_mmc_host *host = mmc_priv(mmc);
-	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 
 	tmio_mmc_host_remove(host);
 
-	if (p && p->cleanup)
-		p->cleanup(pdev);
-
 	return 0;
 }
 
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index 68927ae..da77e5e20 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -3,20 +3,10 @@
 
 #include <linux/types.h>
 
-struct platform_device;
-
 #define SH_MOBILE_SDHI_IRQ_CARD_DETECT	"card_detect"
 #define SH_MOBILE_SDHI_IRQ_SDCARD	"sdcard"
 #define SH_MOBILE_SDHI_IRQ_SDIO		"sdio"
 
-/**
- * struct sh_mobile_sdhi_ops - SDHI driver callbacks
- * @cd_wakeup:		trigger a card-detection run
- */
-struct sh_mobile_sdhi_ops {
-	void (*cd_wakeup)(const struct platform_device *pdev);
-};
-
 struct sh_mobile_sdhi_info {
 	int dma_slave_tx;
 	int dma_slave_rx;
@@ -25,11 +15,6 @@ struct sh_mobile_sdhi_info {
 	unsigned long tmio_caps2;
 	u32 tmio_ocr_mask;	/* available MMC voltages */
 	unsigned int cd_gpio;
-
-	/* callbacks for board specific setup code */
-	int (*init)(struct platform_device *pdev,
-		    const struct sh_mobile_sdhi_ops *ops);
-	void (*cleanup)(struct platform_device *pdev);
 };
 
 #endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 13/17] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (11 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 12/17] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  4:59   ` [PATCH 14/17] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
                     ` (6 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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 48a3be8..26eeeb6 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -202,7 +202,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	host->clk_disable	= sh_mobile_sdhi_clk_disable;
 	host->multi_io_quirk	= sh_mobile_sdhi_multi_io_quirk;
 	/* SD control register space size is 0x100, 0x200 for bus_shift=1 */
-	host->bus_shift		= resource_size(res) >> 9;
+	if (resource_size(res) > 0x100)
+		host->bus_shift = 1;
+	else
+		host->bus_shift = 0;
 
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
 	if (p) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 14/17] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (12 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 13/17] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  4:59   ` [PATCH 15/17] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
                     ` (5 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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 26eeeb6..bcdadb9 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] 43+ messages in thread

* [PATCH 15/17] mmc: sh_mobile_sdhi: use .enable_dma
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (13 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 14/17] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
@ 2015-01-13  4:59   ` Kuninori Morimoto
  2015-01-13  5:00   ` [PATCH 16/17] mmc: sh_mobile_sdhi: enable 32bit DMA access Kuninori Morimoto
                     ` (4 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  4:59 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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 bcdadb9..4091329 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 int sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *of_id =
@@ -230,6 +235,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		}
 	}
 	dma_priv->filter = shdma_chan_filter;
+	dma_priv->enable = sh_mobile_sdhi_enable_dma;
 
 	mmc_data->alignment_shift = 1; /* 2-byte alignment */
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 16/17] mmc: sh_mobile_sdhi: enable 32bit DMA access
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (14 preceding siblings ...)
  2015-01-13  4:59   ` [PATCH 15/17] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
@ 2015-01-13  5:00   ` Kuninori Morimoto
  2015-01-13  5:00   ` [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
                     ` (3 subsequent siblings)
  19 siblings, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  5:00 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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 |   42 +++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 4091329..7dbcb57 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,29 @@ struct sh_mobile_sdhi {
 	struct tmio_mmc_dma dma_priv;
 };
 
+static void sh_mobile_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:
+		/* 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 +121,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 */
+	sh_mobile_sdhi_sdbuf_width(host, 16);
+
 	return 0;
 }
 
@@ -161,6 +190,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 */
+	sh_mobile_sdhi_sdbuf_width(host, enable ? 32 : 16);
 }
 
 static int sh_mobile_sdhi_probe(struct platform_device *pdev)
@@ -175,7 +207,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)
@@ -271,6 +302,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		mmc_data->capabilities |= of_data->capabilities;
 		mmc_data->capabilities2 |= of_data->capabilities2;
 		mmc_data->dma_rx_offset = of_data->dma_rx_offset;
+		dma_priv->dma_buswidth = of_data->dma_buswidth;
 	}
 
 	ret = tmio_mmc_host_probe(host, mmc_data);
@@ -278,14 +310,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto efree;
 
 	/*
-	 * 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] 43+ messages in thread

* [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (15 preceding siblings ...)
  2015-01-13  5:00   ` [PATCH 16/17] mmc: sh_mobile_sdhi: enable 32bit DMA access Kuninori Morimoto
@ 2015-01-13  5:00   ` Kuninori Morimoto
  2015-01-20  9:14     ` Ulf Hansson
  2015-01-13  9:35   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
                     ` (2 subsequent siblings)
  19 siblings, 1 reply; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-13  5:00 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Arnd Bergmann, Chris Ball, 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 7dbcb57..6906a90 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -291,11 +291,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 aa5f4b6..331bb61 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->dma->enable)
 		host->dma->enable(host, enable);
 }
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 807ecfb..6058128 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -96,11 +96,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] 43+ messages in thread

* Re: [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (16 preceding siblings ...)
  2015-01-13  5:00   ` [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
@ 2015-01-13  9:35   ` Ulf Hansson
  2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
  2015-01-20  9:09   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
  19 siblings, 0 replies; 43+ messages in thread
From: Ulf Hansson @ 2015-01-13  9:35 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Arnd Bergmann, Chris Ball, Simon, Linux-SH, linux-mmc

On 13 January 2015 at 05:56, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Ulf
>
> These are v2 of tmio mmc / sh_mobile_sdhi cleanup patches.
> v1 patch and in its discuss, we need 3 type of patch-set
>  1. header cleanup
>  2. sh_mobile_sdhi DMA
>  3. DMAEngine cleanup
>
> These are including 1. header cleanup, and one part of 2. sh_mobile_sdhi DMA.
> If these are accepted, I will send 3. DMAEngine cleanup patch to DMAEngine ML,
> and, left of 2. sh_mobile_sdhi DMA to MMC ML again.
>
>  1) -  9) are header cleanup
> 10) - 17) are one part of sh_mobile_sdhi DMA
>
> Kuninori Morimoto (17):
>        1) mmc: tmio: add tmio_mmc_host_alloc/free()
>        2) mmc: tmio: tmio_mmc_host has .dma
>        3) mmc: tmio: tmio_mmc_host has .write16_hook
>        4) mmc: tmio: tmio_mmc_host has .clk_enable
>        5) mmc: tmio: tmio_mmc_host has .clk_disable
>        6) mmc: tmio: tmio_mmc_host has .multi_io_quirk
>        7) mmc: tmio: tmio_mmc_host has .bus_shift
>        8) mmc: tmio: tmio_mmc_data has .alignment_shift
>        9) mmc: tmio: tmio_mmc_data has .dma_rx_offset
>       10) mmc: tmio: add .enable_dma on tmio_mmc_data
>       11) mmc: tmio: enable SoC specific DMA buswidth settings
>       12) mmc: sh_mobile_sdhi: remove .init/.cleanup
>       13) mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
>       14) mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
>       15) mmc: sh_mobile_sdhi: use .enable_dma
>       16) mmc: sh_mobile_sdhi: enable 32bit DMA access
>       17) mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
>
>  drivers/mmc/host/sh_mobile_sdhi.c  |  117 ++++++++++++++++++++----------------
>  drivers/mmc/host/tmio_mmc.c        |   15 +++--
>  drivers/mmc/host/tmio_mmc.h        |   43 +++++++++----
>  drivers/mmc/host/tmio_mmc_dma.c    |   38 ++++++------
>  drivers/mmc/host/tmio_mmc_pio.c    |   59 ++++++++++--------
>  include/linux/mfd/tmio.h           |   28 +--------
>  include/linux/mmc/sh_mobile_sdhi.h |   15 -----
>  7 files changed, 164 insertions(+), 151 deletions(-)

Thanks!

I have applied this on a local branch called "tmio". That branch is
merged into my next branch, to get some testing of these patches.
Unless we encounter some issues, I will publish the tmio branch as an
immutable branch in a few days.

Also, I updated the commit message header of patch 10 and the commit
message of patch 15.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (17 preceding siblings ...)
  2015-01-13  9:35   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
@ 2015-01-14  8:30   ` Ulf Hansson
  2015-01-14  8:57     ` Kuninori Morimoto
  2015-01-20  9:15     ` Ulf Hansson
  2015-01-20  9:09   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
  19 siblings, 2 replies; 43+ messages in thread
From: Ulf Hansson @ 2015-01-14  8:30 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Chris Ball, Simon, Linux-SH, linux-mmc, kbuild-all@01.org

On 14 January 2015 at 03:21, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> tmio_mmc_host_alloc/free were added on tmio_mmc_pio.c,
> but, it is missing EXPORT_SYMBOL for it.
> Compile will be failed without this patch
>
>  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/tmio_mmc.ko] undefined!
>  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/tmio_mmc.ko] undefined!
>  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
>  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thanks!

I decided to squashed this change into patch "mmc: tmio: add
tmio_mmc_host_alloc/free()", which was the one adding the related
functions.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free
  2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
@ 2015-01-14  8:57     ` Kuninori Morimoto
  2015-01-20  9:15     ` Ulf Hansson
  1 sibling, 0 replies; 43+ messages in thread
From: Kuninori Morimoto @ 2015-01-14  8:57 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Chris Ball, Simon, Linux-SH, linux-mmc, kbuild-all@01.org


Hi Ulf

> > tmio_mmc_host_alloc/free were added on tmio_mmc_pio.c,
> > but, it is missing EXPORT_SYMBOL for it.
> > Compile will be failed without this patch
> >
> >  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/tmio_mmc.ko] undefined!
> >  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/tmio_mmc.ko] undefined!
> >  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
> >  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Thanks!
> 
> I decided to squashed this change into patch "mmc: tmio: add
> tmio_mmc_host_alloc/free()", which was the one adding the related
> functions.

Thank you
good idea :)

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup
  2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
                     ` (18 preceding siblings ...)
  2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
@ 2015-01-20  9:09   ` Ulf Hansson
  19 siblings, 0 replies; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:56, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Ulf
>
> These are v2 of tmio mmc / sh_mobile_sdhi cleanup patches.
> v1 patch and in its discuss, we need 3 type of patch-set
>  1. header cleanup
>  2. sh_mobile_sdhi DMA
>  3. DMAEngine cleanup
>
> These are including 1. header cleanup, and one part of 2. sh_mobile_sdhi DMA.
> If these are accepted, I will send 3. DMAEngine cleanup patch to DMAEngine ML,
> and, left of 2. sh_mobile_sdhi DMA to MMC ML again.
>
>  1) -  9) are header cleanup
> 10) - 17) are one part of sh_mobile_sdhi DMA
>
> Kuninori Morimoto (17):
>        1) mmc: tmio: add tmio_mmc_host_alloc/free()
>        2) mmc: tmio: tmio_mmc_host has .dma
>        3) mmc: tmio: tmio_mmc_host has .write16_hook
>        4) mmc: tmio: tmio_mmc_host has .clk_enable
>        5) mmc: tmio: tmio_mmc_host has .clk_disable
>        6) mmc: tmio: tmio_mmc_host has .multi_io_quirk
>        7) mmc: tmio: tmio_mmc_host has .bus_shift
>        8) mmc: tmio: tmio_mmc_data has .alignment_shift
>        9) mmc: tmio: tmio_mmc_data has .dma_rx_offset
>       10) mmc: tmio: add .enable_dma on tmio_mmc_data
>       11) mmc: tmio: enable SoC specific DMA buswidth settings
>       12) mmc: sh_mobile_sdhi: remove .init/.cleanup
>       13) mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
>       14) mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
>       15) mmc: sh_mobile_sdhi: use .enable_dma
>       16) mmc: sh_mobile_sdhi: enable 32bit DMA access
>       17) mmc: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
>
>  drivers/mmc/host/sh_mobile_sdhi.c  |  117 ++++++++++++++++++++----------------
>  drivers/mmc/host/tmio_mmc.c        |   15 +++--
>  drivers/mmc/host/tmio_mmc.h        |   43 +++++++++----
>  drivers/mmc/host/tmio_mmc_dma.c    |   38 ++++++------
>  drivers/mmc/host/tmio_mmc_pio.c    |   59 ++++++++++--------
>  include/linux/mfd/tmio.h           |   28 +--------
>  include/linux/mmc/sh_mobile_sdhi.h |   15 -----
>  7 files changed, 164 insertions(+), 151 deletions(-)
>
>
> Best regards
> ---
> Kuninori Morimoto

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free()
  2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
@ 2015-01-20  9:10     ` Ulf Hansson
  2015-01-20  9:38       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:10 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:57, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current tmio_mmc driver is using tmio_mmc_data for driver/platform
> specific data/callback, and it is needed for tmio_mmc_host_probe()
> function. Because of this style, include/linux/mfd/tmio.h header has
> tmio driver/framework specific data which is not needed from platform.
>
> This patch adds new tmio_mmc_host_alloc/free() as cleanup preparation.
> tmio driver specific data/callback will be implemented in tmio_mmc_host,
> and platform specific data/callback will be implemented in tmio_mmc_data
> in this cleanup.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |   14 +++++++++---
>  drivers/mmc/host/tmio_mmc.c       |   10 +++++++--
>  drivers/mmc/host/tmio_mmc.h       |    5 +++--
>  drivers/mmc/host/tmio_mmc_pio.c   |   43 +++++++++++++++++++++++--------------
>  include/linux/mfd/tmio.h          |    1 -
>  5 files changed, 49 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 00c8ebd..cf062c4 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -113,7 +113,7 @@ static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
>                 udelay(1);
>
>         if (!timeout) {
> -               dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
> +               dev_warn(&host->pdev->dev, "timeout waiting for SD bus idle\n");
>                 return -EBUSY;
>         }
>
> @@ -207,6 +207,12 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>                 goto eclkget;
>         }
>
> +       host = tmio_mmc_host_alloc(pdev);
> +       if (!host) {
> +               ret = -ENOMEM;
> +               goto eprobe;
> +       }
> +
>         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
>         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> @@ -274,9 +280,9 @@ 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;
>
> -       ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
> +       ret = tmio_mmc_host_probe(host, mmc_data);
>         if (ret < 0)
> -               goto eprobe;
> +               goto efree;
>
>         /*
>          * FIXME:
> @@ -351,6 +357,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>
>  eirq:
>         tmio_mmc_host_remove(host);
> +efree:
> +       tmio_mmc_host_free(host);
>  eprobe:
>  eclkget:
>         if (p && p->cleanup)
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index 2616fdf..f47ae08 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -92,10 +92,14 @@ static int tmio_mmc_probe(struct platform_device *pdev)
>         pdata->bus_shift = resource_size(res) >> 10;
>         pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
>
> -       ret = tmio_mmc_host_probe(&host, pdev, pdata);
> -       if (ret)
> +       host = tmio_mmc_host_alloc(pdev);
> +       if (!host)
>                 goto cell_disable;
>
> +       ret = tmio_mmc_host_probe(host, pdata);
> +       if (ret)
> +               goto host_free;
> +
>         ret = request_irq(irq, tmio_mmc_irq, IRQF_TRIGGER_FALLING,
>                                 dev_name(&pdev->dev), host);
>         if (ret)
> @@ -108,6 +112,8 @@ static int tmio_mmc_probe(struct platform_device *pdev)
>
>  host_remove:
>         tmio_mmc_host_remove(host);
> +host_free:
> +       tmio_mmc_host_free(host);
>  cell_disable:
>         if (cell->disable)
>                 cell->disable(pdev);
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index a34ecbe..60d6747 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -85,8 +85,9 @@ struct tmio_mmc_host {
>         bool                    sdio_irq_enabled;
>  };
>
> -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> -                       struct platform_device *pdev,
> +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);
>  void tmio_mmc_host_remove(struct tmio_mmc_host *host);
>  void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 250bf8c..1a9a13f 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1054,12 +1054,35 @@ static void tmio_mmc_of_parse(struct platform_device *pdev,
>                 pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE;
>  }
>
> -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> -                                 struct platform_device *pdev,
> -                                 struct tmio_mmc_data *pdata)
> +struct tmio_mmc_host*
> +tmio_mmc_host_alloc(struct platform_device *pdev)
>  {
> -       struct tmio_mmc_host *_host;
> +       struct tmio_mmc_host *host;
>         struct mmc_host *mmc;
> +
> +       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> +       if (!mmc)
> +               return NULL;
> +
> +       host = mmc_priv(mmc);
> +       host->mmc = mmc;
> +       host->pdev = pdev;
> +
> +       return host;
> +}
> +
> +void tmio_mmc_host_free(struct tmio_mmc_host *host)
> +{
> +       mmc_free_host(host->mmc);
> +
> +       host->mmc = NULL;
> +}
> +
> +int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
> +                       struct tmio_mmc_data *pdata)
> +{
> +       struct platform_device *pdev = _host->pdev;
> +       struct mmc_host *mmc = _host->mmc;
>         struct resource *res_ctl;
>         int ret;
>         u32 irq_mask = TMIO_MASK_CMD;
> @@ -1073,19 +1096,11 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
>         if (!res_ctl)
>                 return -EINVAL;
>
> -       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> -       if (!mmc)
> -               return -ENOMEM;
> -
>         ret = mmc_of_parse(mmc);
>         if (ret < 0)
>                 goto host_free;
>
> -       pdata->dev = &pdev->dev;
> -       _host = mmc_priv(mmc);
>         _host->pdata = pdata;
> -       _host->mmc = mmc;
> -       _host->pdev = pdev;
>         platform_set_drvdata(pdev, mmc);
>
>         _host->set_pwr = pdata->set_pwr;
> @@ -1192,12 +1207,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
>                 mmc_gpiod_request_cd_irq(mmc);
>         }
>
> -       *host = _host;
> -
>         return 0;
>
>  host_free:
> -       mmc_free_host(mmc);
>
>         return ret;
>  }
> @@ -1222,7 +1234,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
>         pm_runtime_disable(&pdev->dev);
>
>         iounmap(host->ctl);
> -       mmc_free_host(mmc);
>  }
>  EXPORT_SYMBOL(tmio_mmc_host_remove);
>
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 5738817..c7d9af0 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -135,7 +135,6 @@ struct tmio_mmc_data {
>         unsigned long                   bus_shift;
>         u32                             ocr_mask;       /* available voltages */
>         struct tmio_mmc_dma             *dma;
> -       struct device                   *dev;
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma
  2015-01-13  4:57   ` [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
@ 2015-01-20  9:10     ` Ulf Hansson
  2015-01-20  9:37       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:10 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:57, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .dma is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
>  drivers/mmc/host/tmio_mmc.h       |   11 +++++++++++
>  drivers/mmc/host/tmio_mmc_dma.c   |   24 +++++++++++-------------
>  include/linux/mfd/tmio.h          |   11 -----------
>  4 files changed, 24 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index cf062c4..288e78d 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -213,6 +213,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>                 goto eprobe;
>         }
>
> +       host->dma               = dma_priv;
> +
>         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
>         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> @@ -241,8 +243,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         dma_priv->alignment_shift = 1; /* 2-byte alignment */
>         dma_priv->filter = shdma_chan_filter;
>
> -       mmc_data->dma = dma_priv;
> -
>         /*
>          * All SDHI blocks support 2-byte and larger block sizes in 4-bit
>          * bus width mode.
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 60d6747..49a2559 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -40,6 +40,16 @@
>
>  struct tmio_mmc_data;
>
> +struct tmio_mmc_dma {
> +       void *chan_priv_tx;
> +       void *chan_priv_rx;
> +       int slave_id_tx;
> +       int slave_id_rx;
> +       int alignment_shift;
> +       dma_addr_t dma_rx_offset;
> +       bool (*filter)(struct dma_chan *chan, void *arg);
> +};
> +
>  struct tmio_mmc_host {
>         void __iomem *ctl;
>         struct mmc_command      *cmd;
> @@ -59,6 +69,7 @@ struct tmio_mmc_host {
>
>         struct platform_device *pdev;
>         struct tmio_mmc_data *pdata;
> +       struct tmio_mmc_dma     *dma;
>
>         /* DMA support */
>         bool                    force_pio;
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index 7d07738..6c214d6 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -49,11 +49,10 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
>         struct scatterlist *sg = host->sg_ptr, *sg_tmp;
>         struct dma_async_tx_descriptor *desc = NULL;
>         struct dma_chan *chan = host->chan_rx;
> -       struct tmio_mmc_data *pdata = host->pdata;
>         dma_cookie_t cookie;
>         int ret, i;
>         bool aligned = true, multiple = true;
> -       unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
> +       unsigned int align = (1 << host->dma->alignment_shift) - 1;
>
>         for_each_sg(sg, sg_tmp, host->sg_len, i) {
>                 if (sg_tmp->offset & align)
> @@ -126,11 +125,10 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
>         struct scatterlist *sg = host->sg_ptr, *sg_tmp;
>         struct dma_async_tx_descriptor *desc = NULL;
>         struct dma_chan *chan = host->chan_tx;
> -       struct tmio_mmc_data *pdata = host->pdata;
>         dma_cookie_t cookie;
>         int ret, i;
>         bool aligned = true, multiple = true;
> -       unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
> +       unsigned int align = (1 << host->dma->alignment_shift) - 1;
>
>         for_each_sg(sg, sg_tmp, host->sg_len, i) {
>                 if (sg_tmp->offset & align)
> @@ -262,8 +260,8 @@ out:
>  void tmio_mmc_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 (!pdata->dma || (!host->pdev->dev.of_node &&
> -               (!pdata->dma->chan_priv_tx || !pdata->dma->chan_priv_rx)))
> +       if (!host->dma || (!host->pdev->dev.of_node &&
> +               (!host->dma->chan_priv_tx || !host->dma->chan_priv_rx)))
>                 return;
>
>         if (!host->chan_tx && !host->chan_rx) {
> @@ -280,7 +278,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                 dma_cap_set(DMA_SLAVE, mask);
>
>                 host->chan_tx = dma_request_slave_channel_compat(mask,
> -                                       pdata->dma->filter, pdata->dma->chan_priv_tx,
> +                                       host->dma->filter, host->dma->chan_priv_tx,
>                                         &host->pdev->dev, "tx");
>                 dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
>                         host->chan_tx);
> @@ -288,8 +286,8 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                 if (!host->chan_tx)
>                         return;
>
> -               if (pdata->dma->chan_priv_tx)
> -                       cfg.slave_id = pdata->dma->slave_id_tx;
> +               if (host->dma->chan_priv_tx)
> +                       cfg.slave_id = host->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;
> @@ -299,7 +297,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                         goto ecfgtx;
>
>                 host->chan_rx = dma_request_slave_channel_compat(mask,
> -                                       pdata->dma->filter, pdata->dma->chan_priv_rx,
> +                                       host->dma->filter, host->dma->chan_priv_rx,
>                                         &host->pdev->dev, "rx");
>                 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
>                         host->chan_rx);
> @@ -307,10 +305,10 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                 if (!host->chan_rx)
>                         goto ereqrx;
>
> -               if (pdata->dma->chan_priv_rx)
> -                       cfg.slave_id = pdata->dma->slave_id_rx;
> +               if (host->dma->chan_priv_rx)
> +                       cfg.slave_id = host->dma->slave_id_rx;
>                 cfg.direction = DMA_DEV_TO_MEM;
> -               cfg.src_addr = cfg.dst_addr + pdata->dma->dma_rx_offset;
> +               cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
>                 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
>                 cfg.dst_addr = 0;
>                 ret = dmaengine_slave_config(host->chan_rx, &cfg);
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index c7d9af0..8d708c7 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -112,16 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>
>  struct dma_chan;
>
> -struct tmio_mmc_dma {
> -       void *chan_priv_tx;
> -       void *chan_priv_rx;
> -       int slave_id_tx;
> -       int slave_id_rx;
> -       int alignment_shift;
> -       dma_addr_t dma_rx_offset;
> -       bool (*filter)(struct dma_chan *chan, void *arg);
> -};
> -
>  struct tmio_mmc_host;
>
>  /*
> @@ -134,7 +124,6 @@ struct tmio_mmc_data {
>         unsigned long                   flags;
>         unsigned long                   bus_shift;
>         u32                             ocr_mask;       /* available voltages */
> -       struct tmio_mmc_dma             *dma;
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook
  2015-01-13  4:57   ` [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
@ 2015-01-20  9:11     ` Ulf Hansson
  2015-01-20  9:37       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:11 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:57, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .write16_hook is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
>  drivers/mmc/host/tmio_mmc.h       |    4 +++-
>  drivers/mmc/host/tmio_mmc_pio.c   |    2 +-
>  include/linux/mfd/tmio.h          |    3 ---
>  4 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 288e78d..77ff062 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -214,11 +214,11 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         }
>
>         host->dma               = dma_priv;
> +       host->write16_hook      = sh_mobile_sdhi_write16_hook;
>
>         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
>         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> -       mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
>         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
>         if (p) {
>                 mmc_data->flags = p->tmio_flags;
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 49a2559..3fa96b1 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -94,6 +94,8 @@ struct tmio_mmc_host {
>         struct mutex            ios_lock;       /* protect set_ios() context */
>         bool                    native_hotplug;
>         bool                    sdio_irq_enabled;
> +
> +       int (*write16_hook)(struct tmio_mmc_host *host, int addr);
>  };
>
>  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> @@ -183,7 +185,7 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
>         /* If there is a hook and it returns non-zero then there
>          * is an error and the write should be skipped
>          */
> -       if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr))
> +       if (host->write16_hook && host->write16_hook(host, addr))
>                 return;
>         writew(val, host->ctl + (addr << host->pdata->bus_shift));
>  }
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 1a9a13f..fe434cc 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1090,7 +1090,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
>         tmio_mmc_of_parse(pdev, pdata);
>
>         if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> -               pdata->write16_hook = NULL;
> +               _host->write16_hook = NULL;
>
>         res_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (!res_ctl)
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 8d708c7..0872ca1 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -112,8 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
>
>  struct dma_chan;
>
> -struct tmio_mmc_host;
> -
>  /*
>   * data for the MMC controller
>   */
> @@ -127,7 +125,6 @@ struct tmio_mmc_data {
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
> -       int (*write16_hook)(struct tmio_mmc_host *host, int addr);
>         /* clock management callbacks */
>         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
>         void (*clk_disable)(struct platform_device *pdev);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable
  2015-01-13  4:57   ` [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
@ 2015-01-20  9:11     ` Ulf Hansson
  2015-01-20  9:36       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:11 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:57, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .clk_enable is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
>  drivers/mmc/host/tmio_mmc.h       |    1 +
>  drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
>  include/linux/mfd/tmio.h          |    1 -
>  4 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 77ff062..87af77d 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -215,8 +215,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>
>         host->dma               = dma_priv;
>         host->write16_hook      = sh_mobile_sdhi_write16_hook;
> +       host->clk_enable        = sh_mobile_sdhi_clk_enable;
>
> -       mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
>         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
>         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 3fa96b1..5cd2986 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -96,6 +96,7 @@ struct tmio_mmc_host {
>         bool                    sdio_irq_enabled;
>
>         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> +       int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
>  };
>
>  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index fe434cc..1528c88 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -835,13 +835,12 @@ fail:
>  static int tmio_mmc_clk_update(struct tmio_mmc_host *host)
>  {
>         struct mmc_host *mmc = host->mmc;
> -       struct tmio_mmc_data *pdata = host->pdata;
>         int ret;
>
> -       if (!pdata->clk_enable)
> +       if (!host->clk_enable)
>                 return -ENOTSUPP;
>
> -       ret = pdata->clk_enable(host->pdev, &mmc->f_max);
> +       ret = host->clk_enable(host->pdev, &mmc->f_max);
>         if (!ret)
>                 mmc->f_min = mmc->f_max / 512;
>
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 0872ca1..472587a 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -126,7 +126,6 @@ struct tmio_mmc_data {
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
>         /* clock management callbacks */
> -       int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
>         void (*clk_disable)(struct platform_device *pdev);
>         int (*multi_io_quirk)(struct mmc_card *card,
>                               unsigned int direction, int blk_size);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable
  2015-01-13  4:58   ` [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
@ 2015-01-20  9:11     ` Ulf Hansson
  2015-01-20  9:36       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:11 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:58, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .clk_disable is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
>  drivers/mmc/host/tmio_mmc.h       |    1 +
>  drivers/mmc/host/tmio_mmc_pio.c   |    4 ++--
>  include/linux/mfd/tmio.h          |    3 +--
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 87af77d..5e02a6a 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -216,8 +216,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         host->dma               = dma_priv;
>         host->write16_hook      = sh_mobile_sdhi_write16_hook;
>         host->clk_enable        = sh_mobile_sdhi_clk_enable;
> +       host->clk_disable       = sh_mobile_sdhi_clk_disable;
>
> -       mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
>         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
>         if (p) {
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 5cd2986..28234ec 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -97,6 +97,7 @@ struct tmio_mmc_host {
>
>         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
>         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> +       void (*clk_disable)(struct platform_device *pdev);
>  };
>
>  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 1528c88..94fbf4a 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1247,8 +1247,8 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
>         if (host->clk_cache)
>                 tmio_mmc_clk_stop(host);
>
> -       if (host->pdata->clk_disable)
> -               host->pdata->clk_disable(host->pdev);
> +       if (host->clk_disable)
> +               host->clk_disable(host->pdev);
>
>         return 0;
>  }
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 472587a..a3f78da 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -125,8 +125,7 @@ struct tmio_mmc_data {
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
> -       /* clock management callbacks */
> -       void (*clk_disable)(struct platform_device *pdev);
> +
>         int (*multi_io_quirk)(struct mmc_card *card,
>                               unsigned int direction, int blk_size);
>  };
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk
  2015-01-13  4:58   ` [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
@ 2015-01-20  9:12     ` Ulf Hansson
  2015-01-20  9:35       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:12 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:58, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .multi_io_quirk is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
>  drivers/mmc/host/tmio_mmc.h       |    2 ++
>  drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
>  include/linux/mfd/tmio.h          |    3 ---
>  4 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 5e02a6a..c92efe5 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -217,9 +217,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         host->write16_hook      = sh_mobile_sdhi_write16_hook;
>         host->clk_enable        = sh_mobile_sdhi_clk_enable;
>         host->clk_disable       = sh_mobile_sdhi_clk_disable;
> +       host->multi_io_quirk    = sh_mobile_sdhi_multi_io_quirk;
>
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> -       mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
>         if (p) {
>                 mmc_data->flags = p->tmio_flags;
>                 mmc_data->ocr_mask = p->tmio_ocr_mask;
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 28234ec..263256c 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -98,6 +98,8 @@ struct tmio_mmc_host {
>         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
>         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
>         void (*clk_disable)(struct platform_device *pdev);
> +       int (*multi_io_quirk)(struct mmc_card *card,
> +                             unsigned int direction, int blk_size);
>  };
>
>  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 94fbf4a..67c8182 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -1004,10 +1004,9 @@ static int tmio_multi_io_quirk(struct mmc_card *card,
>                                unsigned int direction, int blk_size)
>  {
>         struct tmio_mmc_host *host = mmc_priv(card->host);
> -       struct tmio_mmc_data *pdata = host->pdata;
>
> -       if (pdata->multi_io_quirk)
> -               return pdata->multi_io_quirk(card, direction, blk_size);
> +       if (host->multi_io_quirk)
> +               return host->multi_io_quirk(card, direction, blk_size);
>
>         return blk_size;
>  }
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index a3f78da..3edaa17 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -125,9 +125,6 @@ struct tmio_mmc_data {
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
> -
> -       int (*multi_io_quirk)(struct mmc_card *card,
> -                             unsigned int direction, int blk_size);
>  };
>
>  /*
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift
  2015-01-13  4:58   ` [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
@ 2015-01-20  9:12     ` Ulf Hansson
  2015-01-20  9:35       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:12 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:58, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .bus_shift is implemented under tmio_mmc_data.
> It goes to tmio_mmc_host by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    5 ++---
>  drivers/mmc/host/tmio_mmc.c       |    5 +++--
>  drivers/mmc/host/tmio_mmc.h       |   17 +++++++++--------
>  drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
>  include/linux/mfd/tmio.h          |    1 -
>  5 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index c92efe5..0db2a0a 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -218,6 +218,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         host->clk_enable        = sh_mobile_sdhi_clk_enable;
>         host->clk_disable       = sh_mobile_sdhi_clk_disable;
>         host->multi_io_quirk    = sh_mobile_sdhi_multi_io_quirk;
> +       /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
> +       host->bus_shift         = resource_size(res) >> 9;
>
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
>         if (p) {
> @@ -277,9 +279,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>                 dma_priv->dma_rx_offset = of_data->dma_rx_offset;
>         }
>
> -       /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
> -       mmc_data->bus_shift = resource_size(res) >> 9;
> -
>         ret = tmio_mmc_host_probe(host, mmc_data);
>         if (ret < 0)
>                 goto efree;
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index f47ae08..9e8723d 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -88,14 +88,15 @@ static int tmio_mmc_probe(struct platform_device *pdev)
>         if (!res)
>                 return -EINVAL;
>
> -       /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
> -       pdata->bus_shift = resource_size(res) >> 10;
>         pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
>
>         host = tmio_mmc_host_alloc(pdev);
>         if (!host)
>                 goto cell_disable;
>
> +       /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
> +       host->bus_shift = resource_size(res) >> 10;
> +
>         ret = tmio_mmc_host_probe(host, pdata);
>         if (ret)
>                 goto host_free;
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 263256c..a5d30bf 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -66,6 +66,7 @@ struct tmio_mmc_host {
>         struct scatterlist      *sg_orig;
>         unsigned int            sg_len;
>         unsigned int            sg_off;
> +       unsigned long           bus_shift;
>
>         struct platform_device *pdev;
>         struct tmio_mmc_data *pdata;
> @@ -169,19 +170,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev);
>
>  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
>  {
> -       return readw(host->ctl + (addr << host->pdata->bus_shift));
> +       return readw(host->ctl + (addr << host->bus_shift));
>  }
>
>  static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
>                 u16 *buf, int count)
>  {
> -       readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
> +       readsw(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>
>  static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
>  {
> -       return readw(host->ctl + (addr << host->pdata->bus_shift)) |
> -              readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16;
> +       return readw(host->ctl + (addr << host->bus_shift)) |
> +              readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
>  }
>
>  static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
> @@ -191,19 +192,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
>          */
>         if (host->write16_hook && host->write16_hook(host, addr))
>                 return;
> -       writew(val, host->ctl + (addr << host->pdata->bus_shift));
> +       writew(val, host->ctl + (addr << host->bus_shift));
>  }
>
>  static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
>                 u16 *buf, int count)
>  {
> -       writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
> +       writesw(host->ctl + (addr << host->bus_shift), buf, count);
>  }
>
>  static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
>  {
> -       writew(val, host->ctl + (addr << host->pdata->bus_shift));
> -       writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift));
> +       writew(val, host->ctl + (addr << host->bus_shift));
> +       writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
>  }
>
>
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index 6c214d6..ee0131e 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -289,7 +289,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                 if (host->dma->chan_priv_tx)
>                         cfg.slave_id = host->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 = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
>                 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
>                 cfg.src_addr = 0;
>                 ret = dmaengine_slave_config(host->chan_tx, &cfg);
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 3edaa17..7a5c279 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -120,7 +120,6 @@ struct tmio_mmc_data {
>         unsigned long                   capabilities;
>         unsigned long                   capabilities2;
>         unsigned long                   flags;
> -       unsigned long                   bus_shift;
>         u32                             ocr_mask;       /* available voltages */
>         unsigned int                    cd_gpio;
>         void (*set_pwr)(struct platform_device *host, int state);
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift
  2015-01-13  4:58   ` [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift Kuninori Morimoto
@ 2015-01-20  9:13     ` Ulf Hansson
  2015-01-20  9:34       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:13 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:58, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .alignment_shift is implemented under tmio_mmc_dma.
> It goes to tmio_mmc_data by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
>  drivers/mmc/host/tmio_mmc.h       |    1 -
>  drivers/mmc/host/tmio_mmc_dma.c   |    4 ++--
>  include/linux/mfd/tmio.h          |    1 +
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 0db2a0a..782d8cf 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -241,10 +241,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>                         dma_priv->slave_id_rx = p->dma_slave_rx;
>                 }
>         }
> -
> -       dma_priv->alignment_shift = 1; /* 2-byte alignment */
>         dma_priv->filter = shdma_chan_filter;
>
> +       mmc_data->alignment_shift = 1; /* 2-byte alignment */
> +
>         /*
>          * All SDHI blocks support 2-byte and larger block sizes in 4-bit
>          * bus width mode.
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index a5d30bf..9482abc 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -45,7 +45,6 @@ struct tmio_mmc_dma {
>         void *chan_priv_rx;
>         int slave_id_tx;
>         int slave_id_rx;
> -       int alignment_shift;
>         dma_addr_t dma_rx_offset;
>         bool (*filter)(struct dma_chan *chan, void *arg);
>  };
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index ee0131e..d2b02de 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -52,7 +52,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
>         dma_cookie_t cookie;
>         int ret, i;
>         bool aligned = true, multiple = true;
> -       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> +       unsigned int align = (1 << host->pdata->alignment_shift) - 1;
>
>         for_each_sg(sg, sg_tmp, host->sg_len, i) {
>                 if (sg_tmp->offset & align)
> @@ -128,7 +128,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
>         dma_cookie_t cookie;
>         int ret, i;
>         bool aligned = true, multiple = true;
> -       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> +       unsigned int align = (1 << host->pdata->alignment_shift) - 1;
>
>         for_each_sg(sg, sg_tmp, host->sg_len, i) {
>                 if (sg_tmp->offset & align)
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 7a5c279..28a12d1 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -122,6 +122,7 @@ struct tmio_mmc_data {
>         unsigned long                   flags;
>         u32                             ocr_mask;       /* available voltages */
>         unsigned int                    cd_gpio;
> +       int                             alignment_shift;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
>  };
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset
  2015-01-13  4:58   ` [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset Kuninori Morimoto
@ 2015-01-20  9:13     ` Ulf Hansson
  2015-01-20  9:34       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:13 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 05:58, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current .dma_rx_offset is implemented under tmio_mmc_dma.
> It goes to tmio_mmc_data by this patch.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
>  drivers/mmc/host/tmio_mmc.h       |    1 -
>  drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
>  include/linux/mfd/tmio.h          |    1 +
>  4 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 782d8cf..c06e93b 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -276,7 +276,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;
> -               dma_priv->dma_rx_offset = of_data->dma_rx_offset;
> +               mmc_data->dma_rx_offset = of_data->dma_rx_offset;
>         }
>
>         ret = tmio_mmc_host_probe(host, mmc_data);
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 9482abc..c9a8469 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -45,7 +45,6 @@ struct tmio_mmc_dma {
>         void *chan_priv_rx;
>         int slave_id_tx;
>         int slave_id_rx;
> -       dma_addr_t dma_rx_offset;
>         bool (*filter)(struct dma_chan *chan, void *arg);
>  };
>
> diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> index d2b02de..634b2700c 100644
> --- a/drivers/mmc/host/tmio_mmc_dma.c
> +++ b/drivers/mmc/host/tmio_mmc_dma.c
> @@ -308,7 +308,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
>                 if (host->dma->chan_priv_rx)
>                         cfg.slave_id = host->dma->slave_id_rx;
>                 cfg.direction = DMA_DEV_TO_MEM;
> -               cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
> +               cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
>                 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
>                 cfg.dst_addr = 0;
>                 ret = dmaengine_slave_config(host->chan_rx, &cfg);
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 28a12d1..807ecfb 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -123,6 +123,7 @@ struct tmio_mmc_data {
>         u32                             ocr_mask;       /* available voltages */
>         unsigned int                    cd_gpio;
>         int                             alignment_shift;
> +       dma_addr_t                      dma_rx_offset;
>         void (*set_pwr)(struct platform_device *host, int state);
>         void (*set_clk_div)(struct platform_device *host, int state);
>  };
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
  2015-01-13  5:00   ` [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
@ 2015-01-20  9:14     ` Ulf Hansson
  2015-01-20  9:33       ` Lee Jones
  0 siblings, 1 reply; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:14 UTC (permalink / raw)
  To: Lee Jones
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

+ MFD maintainer

On 13 January 2015 at 06:00, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> 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 7dbcb57..6906a90 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -291,11 +291,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 aa5f4b6..331bb61 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->dma->enable)
>                 host->dma->enable(host, enable);
>  }
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 807ecfb..6058128 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -96,11 +96,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	[flat|nested] 43+ messages in thread

* Re: [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free
  2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
  2015-01-14  8:57     ` Kuninori Morimoto
@ 2015-01-20  9:15     ` Ulf Hansson
  1 sibling, 0 replies; 43+ messages in thread
From: Ulf Hansson @ 2015-01-20  9:15 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chris Ball, Kuninori Morimoto, Simon, Linux-SH, linux-mmc,
	kbuild-all@01.org

+ MFD maintainer

On 14 January 2015 at 09:30, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 14 January 2015 at 03:21, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
>> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>
>> tmio_mmc_host_alloc/free were added on tmio_mmc_pio.c,
>> but, it is missing EXPORT_SYMBOL for it.
>> Compile will be failed without this patch
>>
>>  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/tmio_mmc.ko] undefined!
>>  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/tmio_mmc.ko] undefined!
>>  ERROR: "tmio_mmc_host_free" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
>>  ERROR: "tmio_mmc_host_alloc" [drivers/mmc/host/sh_mobile_sdhi.ko] undefined!
>>
>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Thanks!
>
> I decided to squashed this change into patch "mmc: tmio: add
> tmio_mmc_host_alloc/free()", which was the one adding the related
> functions.
>
> Kind regards
> Uffe

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
  2015-01-20  9:14     ` Ulf Hansson
@ 2015-01-20  9:33       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:33 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 06:00, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > 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(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 7dbcb57..6906a90 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -291,11 +291,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 aa5f4b6..331bb61 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->dma->enable)
> >                 host->dma->enable(host, enable);
> >  }
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 807ecfb..6058128 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -96,11 +96,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)
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset
  2015-01-20  9:13     ` Ulf Hansson
@ 2015-01-20  9:34       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:34 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:58, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .dma_rx_offset is implemented under tmio_mmc_dma.
> > It goes to tmio_mmc_data by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
> >  drivers/mmc/host/tmio_mmc.h       |    1 -
> >  drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
> >  include/linux/mfd/tmio.h          |    1 +
> >  4 files changed, 3 insertions(+), 3 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 782d8cf..c06e93b 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -276,7 +276,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;
> > -               dma_priv->dma_rx_offset = of_data->dma_rx_offset;
> > +               mmc_data->dma_rx_offset = of_data->dma_rx_offset;
> >         }
> >
> >         ret = tmio_mmc_host_probe(host, mmc_data);
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 9482abc..c9a8469 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -45,7 +45,6 @@ struct tmio_mmc_dma {
> >         void *chan_priv_rx;
> >         int slave_id_tx;
> >         int slave_id_rx;
> > -       dma_addr_t dma_rx_offset;
> >         bool (*filter)(struct dma_chan *chan, void *arg);
> >  };
> >
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index d2b02de..634b2700c 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -308,7 +308,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                 if (host->dma->chan_priv_rx)
> >                         cfg.slave_id = host->dma->slave_id_rx;
> >                 cfg.direction = DMA_DEV_TO_MEM;
> > -               cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
> > +               cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
> >                 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
> >                 cfg.dst_addr = 0;
> >                 ret = dmaengine_slave_config(host->chan_rx, &cfg);
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 28a12d1..807ecfb 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -123,6 +123,7 @@ struct tmio_mmc_data {
> >         u32                             ocr_mask;       /* available voltages */
> >         unsigned int                    cd_gpio;
> >         int                             alignment_shift;
> > +       dma_addr_t                      dma_rx_offset;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >  };
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift
  2015-01-20  9:13     ` Ulf Hansson
@ 2015-01-20  9:34       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:34 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:58, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .alignment_shift is implemented under tmio_mmc_dma.
> > It goes to tmio_mmc_data by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
> >  drivers/mmc/host/tmio_mmc.h       |    1 -
> >  drivers/mmc/host/tmio_mmc_dma.c   |    4 ++--
> >  include/linux/mfd/tmio.h          |    1 +

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 0db2a0a..782d8cf 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -241,10 +241,10 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >                         dma_priv->slave_id_rx = p->dma_slave_rx;
> >                 }
> >         }
> > -
> > -       dma_priv->alignment_shift = 1; /* 2-byte alignment */
> >         dma_priv->filter = shdma_chan_filter;
> >
> > +       mmc_data->alignment_shift = 1; /* 2-byte alignment */
> > +
> >         /*
> >          * All SDHI blocks support 2-byte and larger block sizes in 4-bit
> >          * bus width mode.
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index a5d30bf..9482abc 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -45,7 +45,6 @@ struct tmio_mmc_dma {
> >         void *chan_priv_rx;
> >         int slave_id_tx;
> >         int slave_id_rx;
> > -       int alignment_shift;
> >         dma_addr_t dma_rx_offset;
> >         bool (*filter)(struct dma_chan *chan, void *arg);
> >  };
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index ee0131e..d2b02de 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -52,7 +52,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
> >         dma_cookie_t cookie;
> >         int ret, i;
> >         bool aligned = true, multiple = true;
> > -       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> > +       unsigned int align = (1 << host->pdata->alignment_shift) - 1;
> >
> >         for_each_sg(sg, sg_tmp, host->sg_len, i) {
> >                 if (sg_tmp->offset & align)
> > @@ -128,7 +128,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
> >         dma_cookie_t cookie;
> >         int ret, i;
> >         bool aligned = true, multiple = true;
> > -       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> > +       unsigned int align = (1 << host->pdata->alignment_shift) - 1;
> >
> >         for_each_sg(sg, sg_tmp, host->sg_len, i) {
> >                 if (sg_tmp->offset & align)
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 7a5c279..28a12d1 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -122,6 +122,7 @@ struct tmio_mmc_data {
> >         unsigned long                   flags;
> >         u32                             ocr_mask;       /* available voltages */
> >         unsigned int                    cd_gpio;
> > +       int                             alignment_shift;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >  };
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift
  2015-01-20  9:12     ` Ulf Hansson
@ 2015-01-20  9:35       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:35 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:58, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .bus_shift is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    5 ++---
> >  drivers/mmc/host/tmio_mmc.c       |    5 +++--
> >  drivers/mmc/host/tmio_mmc.h       |   17 +++++++++--------
> >  drivers/mmc/host/tmio_mmc_dma.c   |    2 +-
> >  include/linux/mfd/tmio.h          |    1 -

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  5 files changed, 15 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index c92efe5..0db2a0a 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -218,6 +218,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         host->clk_enable        = sh_mobile_sdhi_clk_enable;
> >         host->clk_disable       = sh_mobile_sdhi_clk_disable;
> >         host->multi_io_quirk    = sh_mobile_sdhi_multi_io_quirk;
> > +       /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
> > +       host->bus_shift         = resource_size(res) >> 9;
> >
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> >         if (p) {
> > @@ -277,9 +279,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >                 dma_priv->dma_rx_offset = of_data->dma_rx_offset;
> >         }
> >
> > -       /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
> > -       mmc_data->bus_shift = resource_size(res) >> 9;
> > -
> >         ret = tmio_mmc_host_probe(host, mmc_data);
> >         if (ret < 0)
> >                 goto efree;
> > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> > index f47ae08..9e8723d 100644
> > --- a/drivers/mmc/host/tmio_mmc.c
> > +++ b/drivers/mmc/host/tmio_mmc.c
> > @@ -88,14 +88,15 @@ static int tmio_mmc_probe(struct platform_device *pdev)
> >         if (!res)
> >                 return -EINVAL;
> >
> > -       /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
> > -       pdata->bus_shift = resource_size(res) >> 10;
> >         pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
> >
> >         host = tmio_mmc_host_alloc(pdev);
> >         if (!host)
> >                 goto cell_disable;
> >
> > +       /* SD control register space size is 0x200, 0x400 for bus_shift=1 */
> > +       host->bus_shift = resource_size(res) >> 10;
> > +
> >         ret = tmio_mmc_host_probe(host, pdata);
> >         if (ret)
> >                 goto host_free;
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 263256c..a5d30bf 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -66,6 +66,7 @@ struct tmio_mmc_host {
> >         struct scatterlist      *sg_orig;
> >         unsigned int            sg_len;
> >         unsigned int            sg_off;
> > +       unsigned long           bus_shift;
> >
> >         struct platform_device *pdev;
> >         struct tmio_mmc_data *pdata;
> > @@ -169,19 +170,19 @@ int tmio_mmc_host_runtime_resume(struct device *dev);
> >
> >  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
> >  {
> > -       return readw(host->ctl + (addr << host->pdata->bus_shift));
> > +       return readw(host->ctl + (addr << host->bus_shift));
> >  }
> >
> >  static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
> >                 u16 *buf, int count)
> >  {
> > -       readsw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
> > +       readsw(host->ctl + (addr << host->bus_shift), buf, count);
> >  }
> >
> >  static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
> >  {
> > -       return readw(host->ctl + (addr << host->pdata->bus_shift)) |
> > -              readw(host->ctl + ((addr + 2) << host->pdata->bus_shift)) << 16;
> > +       return readw(host->ctl + (addr << host->bus_shift)) |
> > +              readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
> >  }
> >
> >  static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
> > @@ -191,19 +192,19 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
> >          */
> >         if (host->write16_hook && host->write16_hook(host, addr))
> >                 return;
> > -       writew(val, host->ctl + (addr << host->pdata->bus_shift));
> > +       writew(val, host->ctl + (addr << host->bus_shift));
> >  }
> >
> >  static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
> >                 u16 *buf, int count)
> >  {
> > -       writesw(host->ctl + (addr << host->pdata->bus_shift), buf, count);
> > +       writesw(host->ctl + (addr << host->bus_shift), buf, count);
> >  }
> >
> >  static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
> >  {
> > -       writew(val, host->ctl + (addr << host->pdata->bus_shift));
> > -       writew(val >> 16, host->ctl + ((addr + 2) << host->pdata->bus_shift));
> > +       writew(val, host->ctl + (addr << host->bus_shift));
> > +       writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
> >  }
> >
> >
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index 6c214d6..ee0131e 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -289,7 +289,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                 if (host->dma->chan_priv_tx)
> >                         cfg.slave_id = host->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 = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
> >                 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
> >                 cfg.src_addr = 0;
> >                 ret = dmaengine_slave_config(host->chan_tx, &cfg);
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 3edaa17..7a5c279 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -120,7 +120,6 @@ struct tmio_mmc_data {
> >         unsigned long                   capabilities;
> >         unsigned long                   capabilities2;
> >         unsigned long                   flags;
> > -       unsigned long                   bus_shift;
> >         u32                             ocr_mask;       /* available voltages */
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk
  2015-01-20  9:12     ` Ulf Hansson
@ 2015-01-20  9:35       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:35 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:58, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .multi_io_quirk is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
> >  drivers/mmc/host/tmio_mmc.h       |    2 ++
> >  drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
> >  include/linux/mfd/tmio.h          |    3 ---

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 5e02a6a..c92efe5 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -217,9 +217,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         host->write16_hook      = sh_mobile_sdhi_write16_hook;
> >         host->clk_enable        = sh_mobile_sdhi_clk_enable;
> >         host->clk_disable       = sh_mobile_sdhi_clk_disable;
> > +       host->multi_io_quirk    = sh_mobile_sdhi_multi_io_quirk;
> >
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > -       mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
> >         if (p) {
> >                 mmc_data->flags = p->tmio_flags;
> >                 mmc_data->ocr_mask = p->tmio_ocr_mask;
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 28234ec..263256c 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -98,6 +98,8 @@ struct tmio_mmc_host {
> >         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> >         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> >         void (*clk_disable)(struct platform_device *pdev);
> > +       int (*multi_io_quirk)(struct mmc_card *card,
> > +                             unsigned int direction, int blk_size);
> >  };
> >
> >  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 94fbf4a..67c8182 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -1004,10 +1004,9 @@ static int tmio_multi_io_quirk(struct mmc_card *card,
> >                                unsigned int direction, int blk_size)
> >  {
> >         struct tmio_mmc_host *host = mmc_priv(card->host);
> > -       struct tmio_mmc_data *pdata = host->pdata;
> >
> > -       if (pdata->multi_io_quirk)
> > -               return pdata->multi_io_quirk(card, direction, blk_size);
> > +       if (host->multi_io_quirk)
> > +               return host->multi_io_quirk(card, direction, blk_size);
> >
> >         return blk_size;
> >  }
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index a3f78da..3edaa17 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -125,9 +125,6 @@ struct tmio_mmc_data {
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> > -
> > -       int (*multi_io_quirk)(struct mmc_card *card,
> > -                             unsigned int direction, int blk_size);
> >  };
> >
> >  /*
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable
  2015-01-20  9:11     ` Ulf Hansson
@ 2015-01-20  9:36       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:36 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:58, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .clk_disable is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
> >  drivers/mmc/host/tmio_mmc.h       |    1 +
> >  drivers/mmc/host/tmio_mmc_pio.c   |    4 ++--
> >  include/linux/mfd/tmio.h          |    3 +--

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 87af77d..5e02a6a 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -216,8 +216,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         host->dma               = dma_priv;
> >         host->write16_hook      = sh_mobile_sdhi_write16_hook;
> >         host->clk_enable        = sh_mobile_sdhi_clk_enable;
> > +       host->clk_disable       = sh_mobile_sdhi_clk_disable;
> >
> > -       mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> >         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
> >         if (p) {
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 5cd2986..28234ec 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -97,6 +97,7 @@ struct tmio_mmc_host {
> >
> >         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> >         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> > +       void (*clk_disable)(struct platform_device *pdev);
> >  };
> >
> >  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 1528c88..94fbf4a 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -1247,8 +1247,8 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
> >         if (host->clk_cache)
> >                 tmio_mmc_clk_stop(host);
> >
> > -       if (host->pdata->clk_disable)
> > -               host->pdata->clk_disable(host->pdev);
> > +       if (host->clk_disable)
> > +               host->clk_disable(host->pdev);
> >
> >         return 0;
> >  }
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 472587a..a3f78da 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -125,8 +125,7 @@ struct tmio_mmc_data {
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> > -       /* clock management callbacks */
> > -       void (*clk_disable)(struct platform_device *pdev);
> > +
> >         int (*multi_io_quirk)(struct mmc_card *card,
> >                               unsigned int direction, int blk_size);
> >  };
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable
  2015-01-20  9:11     ` Ulf Hansson
@ 2015-01-20  9:36       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:36 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:57, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .clk_enable is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
> >  drivers/mmc/host/tmio_mmc.h       |    1 +
> >  drivers/mmc/host/tmio_mmc_pio.c   |    5 ++---
> >  include/linux/mfd/tmio.h          |    1 -

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 77ff062..87af77d 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -215,8 +215,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >
> >         host->dma               = dma_priv;
> >         host->write16_hook      = sh_mobile_sdhi_write16_hook;
> > +       host->clk_enable        = sh_mobile_sdhi_clk_enable;
> >
> > -       mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
> >         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> >         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 3fa96b1..5cd2986 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -96,6 +96,7 @@ struct tmio_mmc_host {
> >         bool                    sdio_irq_enabled;
> >
> >         int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> > +       int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> >  };
> >
> >  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index fe434cc..1528c88 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -835,13 +835,12 @@ fail:
> >  static int tmio_mmc_clk_update(struct tmio_mmc_host *host)
> >  {
> >         struct mmc_host *mmc = host->mmc;
> > -       struct tmio_mmc_data *pdata = host->pdata;
> >         int ret;
> >
> > -       if (!pdata->clk_enable)
> > +       if (!host->clk_enable)
> >                 return -ENOTSUPP;
> >
> > -       ret = pdata->clk_enable(host->pdev, &mmc->f_max);
> > +       ret = host->clk_enable(host->pdev, &mmc->f_max);
> >         if (!ret)
> >                 mmc->f_min = mmc->f_max / 512;
> >
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 0872ca1..472587a 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -126,7 +126,6 @@ struct tmio_mmc_data {
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >         /* clock management callbacks */
> > -       int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> >         void (*clk_disable)(struct platform_device *pdev);
> >         int (*multi_io_quirk)(struct mmc_card *card,
> >                               unsigned int direction, int blk_size);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook
  2015-01-20  9:11     ` Ulf Hansson
@ 2015-01-20  9:37       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:37 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:57, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .write16_hook is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
> >  drivers/mmc/host/tmio_mmc.h       |    4 +++-
> >  drivers/mmc/host/tmio_mmc_pio.c   |    2 +-
> >  include/linux/mfd/tmio.h          |    3 ---

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 288e78d..77ff062 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -214,11 +214,11 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         }
> >
> >         host->dma               = dma_priv;
> > +       host->write16_hook      = sh_mobile_sdhi_write16_hook;
> >
> >         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
> >         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > -       mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
> >         mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
> >         if (p) {
> >                 mmc_data->flags = p->tmio_flags;
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 49a2559..3fa96b1 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -94,6 +94,8 @@ struct tmio_mmc_host {
> >         struct mutex            ios_lock;       /* protect set_ios() context */
> >         bool                    native_hotplug;
> >         bool                    sdio_irq_enabled;
> > +
> > +       int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> >  };
> >
> >  struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> > @@ -183,7 +185,7 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
> >         /* If there is a hook and it returns non-zero then there
> >          * is an error and the write should be skipped
> >          */
> > -       if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr))
> > +       if (host->write16_hook && host->write16_hook(host, addr))
> >                 return;
> >         writew(val, host->ctl + (addr << host->pdata->bus_shift));
> >  }
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 1a9a13f..fe434cc 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -1090,7 +1090,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
> >         tmio_mmc_of_parse(pdev, pdata);
> >
> >         if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> > -               pdata->write16_hook = NULL;
> > +               _host->write16_hook = NULL;
> >
> >         res_ctl = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >         if (!res_ctl)
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 8d708c7..0872ca1 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -112,8 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> >
> >  struct dma_chan;
> >
> > -struct tmio_mmc_host;
> > -
> >  /*
> >   * data for the MMC controller
> >   */
> > @@ -127,7 +125,6 @@ struct tmio_mmc_data {
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> > -       int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> >         /* clock management callbacks */
> >         int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
> >         void (*clk_disable)(struct platform_device *pdev);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma
  2015-01-20  9:10     ` Ulf Hansson
@ 2015-01-20  9:37       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:37 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:57, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current .dma is implemented under tmio_mmc_data.
> > It goes to tmio_mmc_host by this patch.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |    4 ++--
> >  drivers/mmc/host/tmio_mmc.h       |   11 +++++++++++
> >  drivers/mmc/host/tmio_mmc_dma.c   |   24 +++++++++++-------------
> >  include/linux/mfd/tmio.h          |   11 -----------

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  4 files changed, 24 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index cf062c4..288e78d 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -213,6 +213,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >                 goto eprobe;
> >         }
> >
> > +       host->dma               = dma_priv;
> > +
> >         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
> >         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > @@ -241,8 +243,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         dma_priv->alignment_shift = 1; /* 2-byte alignment */
> >         dma_priv->filter = shdma_chan_filter;
> >
> > -       mmc_data->dma = dma_priv;
> > -
> >         /*
> >          * All SDHI blocks support 2-byte and larger block sizes in 4-bit
> >          * bus width mode.
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 60d6747..49a2559 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -40,6 +40,16 @@
> >
> >  struct tmio_mmc_data;
> >
> > +struct tmio_mmc_dma {
> > +       void *chan_priv_tx;
> > +       void *chan_priv_rx;
> > +       int slave_id_tx;
> > +       int slave_id_rx;
> > +       int alignment_shift;
> > +       dma_addr_t dma_rx_offset;
> > +       bool (*filter)(struct dma_chan *chan, void *arg);
> > +};
> > +
> >  struct tmio_mmc_host {
> >         void __iomem *ctl;
> >         struct mmc_command      *cmd;
> > @@ -59,6 +69,7 @@ struct tmio_mmc_host {
> >
> >         struct platform_device *pdev;
> >         struct tmio_mmc_data *pdata;
> > +       struct tmio_mmc_dma     *dma;
> >
> >         /* DMA support */
> >         bool                    force_pio;
> > diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
> > index 7d07738..6c214d6 100644
> > --- a/drivers/mmc/host/tmio_mmc_dma.c
> > +++ b/drivers/mmc/host/tmio_mmc_dma.c
> > @@ -49,11 +49,10 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
> >         struct scatterlist *sg = host->sg_ptr, *sg_tmp;
> >         struct dma_async_tx_descriptor *desc = NULL;
> >         struct dma_chan *chan = host->chan_rx;
> > -       struct tmio_mmc_data *pdata = host->pdata;
> >         dma_cookie_t cookie;
> >         int ret, i;
> >         bool aligned = true, multiple = true;
> > -       unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
> > +       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> >
> >         for_each_sg(sg, sg_tmp, host->sg_len, i) {
> >                 if (sg_tmp->offset & align)
> > @@ -126,11 +125,10 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host)
> >         struct scatterlist *sg = host->sg_ptr, *sg_tmp;
> >         struct dma_async_tx_descriptor *desc = NULL;
> >         struct dma_chan *chan = host->chan_tx;
> > -       struct tmio_mmc_data *pdata = host->pdata;
> >         dma_cookie_t cookie;
> >         int ret, i;
> >         bool aligned = true, multiple = true;
> > -       unsigned int align = (1 << pdata->dma->alignment_shift) - 1;
> > +       unsigned int align = (1 << host->dma->alignment_shift) - 1;
> >
> >         for_each_sg(sg, sg_tmp, host->sg_len, i) {
> >                 if (sg_tmp->offset & align)
> > @@ -262,8 +260,8 @@ out:
> >  void tmio_mmc_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 (!pdata->dma || (!host->pdev->dev.of_node &&
> > -               (!pdata->dma->chan_priv_tx || !pdata->dma->chan_priv_rx)))
> > +       if (!host->dma || (!host->pdev->dev.of_node &&
> > +               (!host->dma->chan_priv_tx || !host->dma->chan_priv_rx)))
> >                 return;
> >
> >         if (!host->chan_tx && !host->chan_rx) {
> > @@ -280,7 +278,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                 dma_cap_set(DMA_SLAVE, mask);
> >
> >                 host->chan_tx = dma_request_slave_channel_compat(mask,
> > -                                       pdata->dma->filter, pdata->dma->chan_priv_tx,
> > +                                       host->dma->filter, host->dma->chan_priv_tx,
> >                                         &host->pdev->dev, "tx");
> >                 dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
> >                         host->chan_tx);
> > @@ -288,8 +286,8 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                 if (!host->chan_tx)
> >                         return;
> >
> > -               if (pdata->dma->chan_priv_tx)
> > -                       cfg.slave_id = pdata->dma->slave_id_tx;
> > +               if (host->dma->chan_priv_tx)
> > +                       cfg.slave_id = host->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;
> > @@ -299,7 +297,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                         goto ecfgtx;
> >
> >                 host->chan_rx = dma_request_slave_channel_compat(mask,
> > -                                       pdata->dma->filter, pdata->dma->chan_priv_rx,
> > +                                       host->dma->filter, host->dma->chan_priv_rx,
> >                                         &host->pdev->dev, "rx");
> >                 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
> >                         host->chan_rx);
> > @@ -307,10 +305,10 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
> >                 if (!host->chan_rx)
> >                         goto ereqrx;
> >
> > -               if (pdata->dma->chan_priv_rx)
> > -                       cfg.slave_id = pdata->dma->slave_id_rx;
> > +               if (host->dma->chan_priv_rx)
> > +                       cfg.slave_id = host->dma->slave_id_rx;
> >                 cfg.direction = DMA_DEV_TO_MEM;
> > -               cfg.src_addr = cfg.dst_addr + pdata->dma->dma_rx_offset;
> > +               cfg.src_addr = cfg.dst_addr + host->dma->dma_rx_offset;
> >                 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
> >                 cfg.dst_addr = 0;
> >                 ret = dmaengine_slave_config(host->chan_rx, &cfg);
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index c7d9af0..8d708c7 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -112,16 +112,6 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
> >
> >  struct dma_chan;
> >
> > -struct tmio_mmc_dma {
> > -       void *chan_priv_tx;
> > -       void *chan_priv_rx;
> > -       int slave_id_tx;
> > -       int slave_id_rx;
> > -       int alignment_shift;
> > -       dma_addr_t dma_rx_offset;
> > -       bool (*filter)(struct dma_chan *chan, void *arg);
> > -};
> > -
> >  struct tmio_mmc_host;
> >
> >  /*
> > @@ -134,7 +124,6 @@ struct tmio_mmc_data {
> >         unsigned long                   flags;
> >         unsigned long                   bus_shift;
> >         u32                             ocr_mask;       /* available voltages */
> > -       struct tmio_mmc_dma             *dma;
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free()
  2015-01-20  9:10     ` Ulf Hansson
@ 2015-01-20  9:38       ` Lee Jones
  0 siblings, 0 replies; 43+ messages in thread
From: Lee Jones @ 2015-01-20  9:38 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Arnd Bergmann, Kuninori Morimoto, Chris Ball, Simon, Linux-SH,
	linux-mmc

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:57, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current tmio_mmc driver is using tmio_mmc_data for driver/platform
> > specific data/callback, and it is needed for tmio_mmc_host_probe()
> > function. Because of this style, include/linux/mfd/tmio.h header has
> > tmio driver/framework specific data which is not needed from platform.
> >
> > This patch adds new tmio_mmc_host_alloc/free() as cleanup preparation.
> > tmio driver specific data/callback will be implemented in tmio_mmc_host,
> > and platform specific data/callback will be implemented in tmio_mmc_data
> > in this cleanup.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |   14 +++++++++---
> >  drivers/mmc/host/tmio_mmc.c       |   10 +++++++--
> >  drivers/mmc/host/tmio_mmc.h       |    5 +++--
> >  drivers/mmc/host/tmio_mmc_pio.c   |   43 +++++++++++++++++++++++--------------
> >  include/linux/mfd/tmio.h          |    1 -

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  5 files changed, 49 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 00c8ebd..cf062c4 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -113,7 +113,7 @@ static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
> >                 udelay(1);
> >
> >         if (!timeout) {
> > -               dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
> > +               dev_warn(&host->pdev->dev, "timeout waiting for SD bus idle\n");
> >                 return -EBUSY;
> >         }
> >
> > @@ -207,6 +207,12 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >                 goto eclkget;
> >         }
> >
> > +       host = tmio_mmc_host_alloc(pdev);
> > +       if (!host) {
> > +               ret = -ENOMEM;
> > +               goto eprobe;
> > +       }
> > +
> >         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
> >         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > @@ -274,9 +280,9 @@ 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;
> >
> > -       ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
> > +       ret = tmio_mmc_host_probe(host, mmc_data);
> >         if (ret < 0)
> > -               goto eprobe;
> > +               goto efree;
> >
> >         /*
> >          * FIXME:
> > @@ -351,6 +357,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >
> >  eirq:
> >         tmio_mmc_host_remove(host);
> > +efree:
> > +       tmio_mmc_host_free(host);
> >  eprobe:
> >  eclkget:
> >         if (p && p->cleanup)
> > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> > index 2616fdf..f47ae08 100644
> > --- a/drivers/mmc/host/tmio_mmc.c
> > +++ b/drivers/mmc/host/tmio_mmc.c
> > @@ -92,10 +92,14 @@ static int tmio_mmc_probe(struct platform_device *pdev)
> >         pdata->bus_shift = resource_size(res) >> 10;
> >         pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
> >
> > -       ret = tmio_mmc_host_probe(&host, pdev, pdata);
> > -       if (ret)
> > +       host = tmio_mmc_host_alloc(pdev);
> > +       if (!host)
> >                 goto cell_disable;
> >
> > +       ret = tmio_mmc_host_probe(host, pdata);
> > +       if (ret)
> > +               goto host_free;
> > +
> >         ret = request_irq(irq, tmio_mmc_irq, IRQF_TRIGGER_FALLING,
> >                                 dev_name(&pdev->dev), host);
> >         if (ret)
> > @@ -108,6 +112,8 @@ static int tmio_mmc_probe(struct platform_device *pdev)
> >
> >  host_remove:
> >         tmio_mmc_host_remove(host);
> > +host_free:
> > +       tmio_mmc_host_free(host);
> >  cell_disable:
> >         if (cell->disable)
> >                 cell->disable(pdev);
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index a34ecbe..60d6747 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -85,8 +85,9 @@ struct tmio_mmc_host {
> >         bool                    sdio_irq_enabled;
> >  };
> >
> > -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> > -                       struct platform_device *pdev,
> > +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);
> >  void tmio_mmc_host_remove(struct tmio_mmc_host *host);
> >  void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 250bf8c..1a9a13f 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -1054,12 +1054,35 @@ static void tmio_mmc_of_parse(struct platform_device *pdev,
> >                 pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE;
> >  }
> >
> > -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> > -                                 struct platform_device *pdev,
> > -                                 struct tmio_mmc_data *pdata)
> > +struct tmio_mmc_host*
> > +tmio_mmc_host_alloc(struct platform_device *pdev)
> >  {
> > -       struct tmio_mmc_host *_host;
> > +       struct tmio_mmc_host *host;
> >         struct mmc_host *mmc;
> > +
> > +       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> > +       if (!mmc)
> > +               return NULL;
> > +
> > +       host = mmc_priv(mmc);
> > +       host->mmc = mmc;
> > +       host->pdev = pdev;
> > +
> > +       return host;
> > +}
> > +
> > +void tmio_mmc_host_free(struct tmio_mmc_host *host)
> > +{
> > +       mmc_free_host(host->mmc);
> > +
> > +       host->mmc = NULL;
> > +}
> > +
> > +int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
> > +                       struct tmio_mmc_data *pdata)
> > +{
> > +       struct platform_device *pdev = _host->pdev;
> > +       struct mmc_host *mmc = _host->mmc;
> >         struct resource *res_ctl;
> >         int ret;
> >         u32 irq_mask = TMIO_MASK_CMD;
> > @@ -1073,19 +1096,11 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> >         if (!res_ctl)
> >                 return -EINVAL;
> >
> > -       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> > -       if (!mmc)
> > -               return -ENOMEM;
> > -
> >         ret = mmc_of_parse(mmc);
> >         if (ret < 0)
> >                 goto host_free;
> >
> > -       pdata->dev = &pdev->dev;
> > -       _host = mmc_priv(mmc);
> >         _host->pdata = pdata;
> > -       _host->mmc = mmc;
> > -       _host->pdev = pdev;
> >         platform_set_drvdata(pdev, mmc);
> >
> >         _host->set_pwr = pdata->set_pwr;
> > @@ -1192,12 +1207,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> >                 mmc_gpiod_request_cd_irq(mmc);
> >         }
> >
> > -       *host = _host;
> > -
> >         return 0;
> >
> >  host_free:
> > -       mmc_free_host(mmc);
> >
> >         return ret;
> >  }
> > @@ -1222,7 +1234,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
> >         pm_runtime_disable(&pdev->dev);
> >
> >         iounmap(host->ctl);
> > -       mmc_free_host(mmc);
> >  }
> >  EXPORT_SYMBOL(tmio_mmc_host_remove);
> >
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 5738817..c7d9af0 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -135,7 +135,6 @@ struct tmio_mmc_data {
> >         unsigned long                   bus_shift;
> >         u32                             ocr_mask;       /* available voltages */
> >         struct tmio_mmc_dma             *dma;
> > -       struct device                   *dev;
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2015-01-20  9:38 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201501131902.WqokttpY%fengguang.wu@intel.com>
2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
2015-01-20  9:10     ` Ulf Hansson
2015-01-20  9:38       ` Lee Jones
2015-01-13  4:57   ` [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
2015-01-20  9:10     ` Ulf Hansson
2015-01-20  9:37       ` Lee Jones
2015-01-13  4:57   ` [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:37       ` Lee Jones
2015-01-13  4:57   ` [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:36       ` Lee Jones
2015-01-13  4:58   ` [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:36       ` Lee Jones
2015-01-13  4:58   ` [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
2015-01-20  9:12     ` Ulf Hansson
2015-01-20  9:35       ` Lee Jones
2015-01-13  4:58   ` [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
2015-01-20  9:12     ` Ulf Hansson
2015-01-20  9:35       ` Lee Jones
2015-01-13  4:58   ` [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift Kuninori Morimoto
2015-01-20  9:13     ` Ulf Hansson
2015-01-20  9:34       ` Lee Jones
2015-01-13  4:58   ` [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset Kuninori Morimoto
2015-01-20  9:13     ` Ulf Hansson
2015-01-20  9:34       ` Lee Jones
2015-01-13  4:59   ` [PATCH 10/17] mmc: tmio: add .enable_dma on tmio_mmc_data Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 11/17] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 12/17] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 13/17] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 14/17] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 15/17] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
2015-01-13  5:00   ` [PATCH 16/17] mmc: sh_mobile_sdhi: enable 32bit DMA access Kuninori Morimoto
2015-01-13  5:00   ` [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
2015-01-20  9:14     ` Ulf Hansson
2015-01-20  9:33       ` Lee Jones
2015-01-13  9:35   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
2015-01-14  8:57     ` Kuninori Morimoto
2015-01-20  9:15     ` Ulf Hansson
2015-01-20  9:09   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson

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).