aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-04-26 11:47:18 -0400
committerChris Ball <cjb@laptop.org>2013-05-26 14:23:20 -0400
commiteec95ee22611f2207bd991d63a07884de28e6f56 (patch)
tree69b9f7cfe54987a2f24b19ed627abdf3a1151d26 /drivers/mmc
parent03a0675b2a112038a8a5078d8815e3f7356c7064 (diff)
mmc: sdhi/tmio: switch to using dmaengine_slave_config()
This removes the deprecated use of the .private member of struct dma_chan and switches the sdhi / tmio mmc driver to using the dmaengine_slave_config() channel configuration method. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sh_mobile_sdhi.c33
-rw-r--r--drivers/mmc/host/tmio_mmc_dma.c25
2 files changed, 41 insertions, 17 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index e0088d7f5f85..7f45f62808d4 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/dmaengine.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <linux/mod_devicetable.h> 24#include <linux/mod_devicetable.h>
26#include <linux/module.h> 25#include <linux/module.h>
@@ -47,8 +46,6 @@ static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
47struct sh_mobile_sdhi { 46struct sh_mobile_sdhi {
48 struct clk *clk; 47 struct clk *clk;
49 struct tmio_mmc_data mmc_data; 48 struct tmio_mmc_data mmc_data;
50 struct sh_dmae_slave param_tx;
51 struct sh_dmae_slave param_rx;
52 struct tmio_mmc_dma dma_priv; 49 struct tmio_mmc_dma dma_priv;
53}; 50};
54 51
@@ -125,13 +122,6 @@ static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
125 mmc_detect_change(dev_get_drvdata(&pdev->dev), msecs_to_jiffies(100)); 122 mmc_detect_change(dev_get_drvdata(&pdev->dev), msecs_to_jiffies(100));
126} 123}
127 124
128static bool sh_mobile_sdhi_filter(struct dma_chan *chan, void *arg)
129{
130 dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg);
131 chan->private = arg;
132 return true;
133}
134
135static const struct sh_mobile_sdhi_ops sdhi_ops = { 125static const struct sh_mobile_sdhi_ops sdhi_ops = {
136 .cd_wakeup = sh_mobile_sdhi_cd_wakeup, 126 .cd_wakeup = sh_mobile_sdhi_cd_wakeup,
137}; 127};
@@ -194,13 +184,22 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
194 mmc_data->get_cd = sh_mobile_sdhi_get_cd; 184 mmc_data->get_cd = sh_mobile_sdhi_get_cd;
195 185
196 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) { 186 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) {
197 priv->param_tx.shdma_slave.slave_id = p->dma_slave_tx; 187 struct tmio_mmc_dma *dma_priv = &priv->dma_priv;
198 priv->param_rx.shdma_slave.slave_id = p->dma_slave_rx; 188
199 priv->dma_priv.chan_priv_tx = &priv->param_tx.shdma_slave; 189 /*
200 priv->dma_priv.chan_priv_rx = &priv->param_rx.shdma_slave; 190 * Yes, we have to provide slave IDs twice to TMIO:
201 priv->dma_priv.alignment_shift = 1; /* 2-byte alignment */ 191 * once as a filter parameter and once for channel
202 priv->dma_priv.filter = sh_mobile_sdhi_filter; 192 * configuration as an explicit slave ID
203 mmc_data->dma = &priv->dma_priv; 193 */
194 dma_priv->chan_priv_tx = (void *)p->dma_slave_tx;
195 dma_priv->chan_priv_rx = (void *)p->dma_slave_rx;
196 dma_priv->slave_id_tx = p->dma_slave_tx;
197 dma_priv->slave_id_rx = p->dma_slave_rx;
198
199 dma_priv->alignment_shift = 1; /* 2-byte alignment */
200 dma_priv->filter = shdma_chan_filter;
201
202 mmc_data->dma = dma_priv;
204 } 203 }
205 } 204 }
206 205
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index dc4b10b9c72a..5fcf14f21d20 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -268,7 +268,14 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
268 return; 268 return;
269 269
270 if (!host->chan_tx && !host->chan_rx) { 270 if (!host->chan_tx && !host->chan_rx) {
271 struct resource *res = platform_get_resource(host->pdev,
272 IORESOURCE_MEM, 0);
273 struct dma_slave_config cfg = {};
271 dma_cap_mask_t mask; 274 dma_cap_mask_t mask;
275 int ret;
276
277 if (!res)
278 return;
272 279
273 dma_cap_zero(mask); 280 dma_cap_zero(mask);
274 dma_cap_set(DMA_SLAVE, mask); 281 dma_cap_set(DMA_SLAVE, mask);
@@ -281,6 +288,14 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
281 if (!host->chan_tx) 288 if (!host->chan_tx)
282 return; 289 return;
283 290
291 cfg.slave_id = pdata->dma->slave_id_tx;
292 cfg.direction = DMA_MEM_TO_DEV;
293 cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
294 cfg.src_addr = 0;
295 ret = dmaengine_slave_config(host->chan_tx, &cfg);
296 if (ret < 0)
297 goto ecfgtx;
298
284 host->chan_rx = dma_request_channel(mask, pdata->dma->filter, 299 host->chan_rx = dma_request_channel(mask, pdata->dma->filter,
285 pdata->dma->chan_priv_rx); 300 pdata->dma->chan_priv_rx);
286 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, 301 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
@@ -289,6 +304,14 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
289 if (!host->chan_rx) 304 if (!host->chan_rx)
290 goto ereqrx; 305 goto ereqrx;
291 306
307 cfg.slave_id = pdata->dma->slave_id_rx;
308 cfg.direction = DMA_DEV_TO_MEM;
309 cfg.src_addr = cfg.dst_addr;
310 cfg.dst_addr = 0;
311 ret = dmaengine_slave_config(host->chan_rx, &cfg);
312 if (ret < 0)
313 goto ecfgrx;
314
292 host->bounce_buf = (u8 *)__get_free_page(GFP_KERNEL | GFP_DMA); 315 host->bounce_buf = (u8 *)__get_free_page(GFP_KERNEL | GFP_DMA);
293 if (!host->bounce_buf) 316 if (!host->bounce_buf)
294 goto ebouncebuf; 317 goto ebouncebuf;
@@ -302,9 +325,11 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
302 return; 325 return;
303 326
304ebouncebuf: 327ebouncebuf:
328ecfgrx:
305 dma_release_channel(host->chan_rx); 329 dma_release_channel(host->chan_rx);
306 host->chan_rx = NULL; 330 host->chan_rx = NULL;
307ereqrx: 331ereqrx:
332ecfgtx:
308 dma_release_channel(host->chan_tx); 333 dma_release_channel(host->chan_tx);
309 host->chan_tx = NULL; 334 host->chan_tx = NULL;
310} 335}