Skip to content

Commit f32a10d

Browse files
committed
Merge tag 'mmc-v4.8-rc6' of git://git.linaro.org/people/ulf.hansson/mmc
Pull MMC fixes from Ulf Hansson: "MMC host: - omap/omap_hsmmc: Initialize dma_slave_config to avoid random data - sdhci-st: Handle interconnect clock" * tag 'mmc-v4.8-rc6' of git://git.linaro.org/people/ulf.hansson/mmc: mmc: omap: Initialize dma_slave_config to avoid random data in it's fields mmc: omap_hsmmc: Initialize dma_slave_config to avoid random data mmc: sdhci-st: Handle interconnect clock dt-bindings: mmc: sdhci-st: Mention the discretionary "icn" clock
2 parents baf009f + df804d5 commit f32a10d

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

Documentation/devicetree/bindings/mmc/sdhci-st.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Required properties:
1010
subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
1111
family).
1212

13-
- clock-names: Should be "mmc".
13+
- clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory)
1414
See: Documentation/devicetree/bindings/resource-names.txt
1515
- clocks: Phandle to the clock.
1616
See: Documentation/devicetree/bindings/clock/clock-bindings.txt

drivers/mmc/host/omap.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,14 +1016,16 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
10161016

10171017
/* Only reconfigure if we have a different burst size */
10181018
if (*bp != burst) {
1019-
struct dma_slave_config cfg;
1020-
1021-
cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA);
1022-
cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA);
1023-
cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
1024-
cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
1025-
cfg.src_maxburst = burst;
1026-
cfg.dst_maxburst = burst;
1019+
struct dma_slave_config cfg = {
1020+
.src_addr = host->phys_base +
1021+
OMAP_MMC_REG(host, DATA),
1022+
.dst_addr = host->phys_base +
1023+
OMAP_MMC_REG(host, DATA),
1024+
.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
1025+
.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
1026+
.src_maxburst = burst,
1027+
.dst_maxburst = burst,
1028+
};
10271029

10281030
if (dmaengine_slave_config(c, &cfg))
10291031
goto use_pio;

drivers/mmc/host/omap_hsmmc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,11 +1409,18 @@ static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host,
14091409
static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
14101410
struct mmc_request *req)
14111411
{
1412-
struct dma_slave_config cfg;
14131412
struct dma_async_tx_descriptor *tx;
14141413
int ret = 0, i;
14151414
struct mmc_data *data = req->data;
14161415
struct dma_chan *chan;
1416+
struct dma_slave_config cfg = {
1417+
.src_addr = host->mapbase + OMAP_HSMMC_DATA,
1418+
.dst_addr = host->mapbase + OMAP_HSMMC_DATA,
1419+
.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
1420+
.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
1421+
.src_maxburst = data->blksz / 4,
1422+
.dst_maxburst = data->blksz / 4,
1423+
};
14171424

14181425
/* Sanity check: all the SG entries must be aligned by block size. */
14191426
for (i = 0; i < data->sg_len; i++) {
@@ -1433,13 +1440,6 @@ static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
14331440

14341441
chan = omap_hsmmc_get_dma_chan(host, data);
14351442

1436-
cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA;
1437-
cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA;
1438-
cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1439-
cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1440-
cfg.src_maxburst = data->blksz / 4;
1441-
cfg.dst_maxburst = data->blksz / 4;
1442-
14431443
ret = dmaengine_slave_config(chan, &cfg);
14441444
if (ret)
14451445
return ret;

drivers/mmc/host/sdhci-st.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
struct st_mmc_platform_data {
3030
struct reset_control *rstc;
31+
struct clk *icnclk;
3132
void __iomem *top_ioaddr;
3233
};
3334

@@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
353354
struct sdhci_host *host;
354355
struct st_mmc_platform_data *pdata;
355356
struct sdhci_pltfm_host *pltfm_host;
356-
struct clk *clk;
357+
struct clk *clk, *icnclk;
357358
int ret = 0;
358359
u16 host_version;
359360
struct resource *res;
@@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev)
365366
return PTR_ERR(clk);
366367
}
367368

369+
/* ICN clock isn't compulsory, but use it if it's provided. */
370+
icnclk = devm_clk_get(&pdev->dev, "icn");
371+
if (IS_ERR(icnclk))
372+
icnclk = NULL;
373+
368374
rstc = devm_reset_control_get(&pdev->dev, NULL);
369375
if (IS_ERR(rstc))
370376
rstc = NULL;
@@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
389395
}
390396

391397
clk_prepare_enable(clk);
398+
clk_prepare_enable(icnclk);
392399

393400
/* Configure the FlashSS Top registers for setting eMMC TX/RX delay */
394401
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
400407
}
401408

402409
pltfm_host->clk = clk;
410+
pdata->icnclk = icnclk;
403411

404412
/* Configure the Arasan HC inside the flashSS */
405413
st_mmcss_cconfig(np, host);
@@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
422430
return 0;
423431

424432
err_out:
433+
clk_disable_unprepare(icnclk);
425434
clk_disable_unprepare(clk);
426435
err_of:
427436
sdhci_pltfm_free(pdev);
@@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev)
442451

443452
ret = sdhci_pltfm_unregister(pdev);
444453

454+
clk_disable_unprepare(pdata->icnclk);
455+
445456
if (rstc)
446457
reset_control_assert(rstc);
447458

@@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev)
462473
if (pdata->rstc)
463474
reset_control_assert(pdata->rstc);
464475

476+
clk_disable_unprepare(pdata->icnclk);
465477
clk_disable_unprepare(pltfm_host->clk);
466478
out:
467479
return ret;
@@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev)
475487
struct device_node *np = dev->of_node;
476488

477489
clk_prepare_enable(pltfm_host->clk);
490+
clk_prepare_enable(pdata->icnclk);
478491

479492
if (pdata->rstc)
480493
reset_control_deassert(pdata->rstc);

0 commit comments

Comments
 (0)