Skip to content

Commit 714c4a6

Browse files
lyakhcjb
authored andcommitted
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>
1 parent 6771632 commit 714c4a6

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎drivers/mmc/host/sh_mmcif.c‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ struct sh_mmcif_host {
165165
struct mmc_host *mmc;
166166
struct mmc_data *data;
167167
struct platform_device *pd;
168+
struct sh_dmae_slave dma_slave_tx;
169+
struct sh_dmae_slave dma_slave_rx;
168170
struct clk *hclk;
169171
unsigned int clk;
170172
int bus_width;
@@ -323,25 +325,35 @@ static bool sh_mmcif_filter(struct dma_chan *chan, void *arg)
323325
static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
324326
struct sh_mmcif_plat_data *pdata)
325327
{
328+
struct sh_dmae_slave *tx, *rx;
326329
host->dma_active = false;
327330

328331
/* We can only either use DMA for both Tx and Rx or not use it at all */
329332
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) {
330344
dma_cap_mask_t mask;
331345

332346
dma_cap_zero(mask);
333347
dma_cap_set(DMA_SLAVE, mask);
334348

335-
host->chan_tx = dma_request_channel(mask, sh_mmcif_filter,
336-
&pdata->dma->chan_priv_tx);
349+
host->chan_tx = dma_request_channel(mask, sh_mmcif_filter, tx);
337350
dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__,
338351
host->chan_tx);
339352

340353
if (!host->chan_tx)
341354
return;
342355

343-
host->chan_rx = dma_request_channel(mask, sh_mmcif_filter,
344-
&pdata->dma->chan_priv_rx);
356+
host->chan_rx = dma_request_channel(mask, sh_mmcif_filter, rx);
345357
dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__,
346358
host->chan_rx);
347359

‎include/linux/mmc/sh_mmcif.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ struct sh_mmcif_plat_data {
4141
void (*set_pwr)(struct platform_device *pdev, int state);
4242
void (*down_pwr)(struct platform_device *pdev);
4343
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;
4547
u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
4648
unsigned long caps;
4749
u32 ocr;

0 commit comments

Comments
 (0)