aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-08-30 12:26:39 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:09 -0400
commit714c4a6e3a0f730834ec8a8bc83b2a6da33f54dc (patch)
tree1e2a581b44fab2b92d21fc52d134719dde003c45
parent67716327eec7e9d573e7cb2d806545d6f7c1a38d (diff)
mmc: sh_mmcif: simplify platform data
Provide platforms with a simplified way to specify MMCIF DMA slave IDs in a way, similar to SDHI and other sh_dma clients. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sh_mmcif.c20
-rw-r--r--include/linux/mmc/sh_mmcif.h4
2 files changed, 19 insertions, 5 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 557886bee9ce..bd91c94ea18e 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -165,6 +165,8 @@ struct sh_mmcif_host {
165 struct mmc_host *mmc; 165 struct mmc_host *mmc;
166 struct mmc_data *data; 166 struct mmc_data *data;
167 struct platform_device *pd; 167 struct platform_device *pd;
168 struct sh_dmae_slave dma_slave_tx;
169 struct sh_dmae_slave dma_slave_rx;
168 struct clk *hclk; 170 struct clk *hclk;
169 unsigned int clk; 171 unsigned int clk;
170 int bus_width; 172 int bus_width;
@@ -323,25 +325,35 @@ static bool sh_mmcif_filter(struct dma_chan *chan, void *arg)
323static void sh_mmcif_request_dma(struct sh_mmcif_host *host, 325static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
324 struct sh_mmcif_plat_data *pdata) 326 struct sh_mmcif_plat_data *pdata)
325{ 327{
328 struct sh_dmae_slave *tx, *rx;
326 host->dma_active = false; 329 host->dma_active = false;
327 330
328 /* We can only either use DMA for both Tx and Rx or not use it at all */ 331 /* We can only either use DMA for both Tx and Rx or not use it at all */
329 if (pdata->dma) { 332 if (pdata->dma) {
333 dev_warn(&host->pd->dev,
334 "Update your platform to use embedded DMA slave IDs\n");
335 tx = &pdata->dma->chan_priv_tx;
336 rx = &pdata->dma->chan_priv_rx;
337 } else {
338 tx = &host->dma_slave_tx;
339 tx->slave_id = pdata->slave_id_tx;
340 rx = &host->dma_slave_rx;
341 rx->slave_id = pdata->slave_id_rx;
342 }
343 if (tx->slave_id > 0 && rx->slave_id > 0) {
330 dma_cap_mask_t mask; 344 dma_cap_mask_t mask;
331 345
332 dma_cap_zero(mask); 346 dma_cap_zero(mask);
333 dma_cap_set(DMA_SLAVE, mask); 347 dma_cap_set(DMA_SLAVE, mask);
334 348
335 host->chan_tx = dma_request_channel(mask, sh_mmcif_filter, 349 host->chan_tx = dma_request_channel(mask, sh_mmcif_filter, tx);
336 &pdata->dma->chan_priv_tx);
337 dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, 350 dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
338 host->chan_tx); 351 host->chan_tx);
339 352
340 if (!host->chan_tx) 353 if (!host->chan_tx)
341 return; 354 return;
342 355
343 host->chan_rx = dma_request_channel(mask, sh_mmcif_filter, 356 host->chan_rx = dma_request_channel(mask, sh_mmcif_filter, rx);
344 &pdata->dma->chan_priv_rx);
345 dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, 357 dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
346 host->chan_rx); 358 host->chan_rx);
347 359
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 0222cd8ebe76..04ff452bf5c3 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -41,7 +41,9 @@ struct sh_mmcif_plat_data {
41 void (*set_pwr)(struct platform_device *pdev, int state); 41 void (*set_pwr)(struct platform_device *pdev, int state);
42 void (*down_pwr)(struct platform_device *pdev); 42 void (*down_pwr)(struct platform_device *pdev);
43 int (*get_cd)(struct platform_device *pdef); 43 int (*get_cd)(struct platform_device *pdef);
44 struct sh_mmcif_dma *dma; 44 struct sh_mmcif_dma *dma; /* Deprecated. Instead */
45 unsigned int slave_id_tx; /* use embedded slave_id_[tr]x */
46 unsigned int slave_id_rx;
45 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 47 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
46 unsigned long caps; 48 unsigned long caps;
47 u32 ocr; 49 u32 ocr;