Skip to content

Commit

Permalink
Merge tag 'mmc-v4.8-rc6' of git://git.linaro.org/people/ulf.hansson/mmc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed Sep 17, 2016
2 parents baf009f + df804d5 commit f32a10d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/mmc/sdhci-st.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Required properties:
subsystem (mmcss) inside the FlashSS (available in STiH407 SoC
family).

- clock-names: Should be "mmc".
- clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory)
See: Documentation/devicetree/bindings/resource-names.txt
- clocks: Phandle to the clock.
See: Documentation/devicetree/bindings/clock/clock-bindings.txt
Expand Down
18 changes: 10 additions & 8 deletions drivers/mmc/host/omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,14 +1016,16 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)

/* Only reconfigure if we have a different burst size */
if (*bp != burst) {
struct dma_slave_config cfg;

cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA);
cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA);
cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
cfg.src_maxburst = burst;
cfg.dst_maxburst = burst;
struct dma_slave_config cfg = {
.src_addr = host->phys_base +
OMAP_MMC_REG(host, DATA),
.dst_addr = host->phys_base +
OMAP_MMC_REG(host, DATA),
.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES,
.src_maxburst = burst,
.dst_maxburst = burst,
};

if (dmaengine_slave_config(c, &cfg))
goto use_pio;
Expand Down
16 changes: 8 additions & 8 deletions drivers/mmc/host/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,11 +1409,18 @@ static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host,
static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
struct mmc_request *req)
{
struct dma_slave_config cfg;
struct dma_async_tx_descriptor *tx;
int ret = 0, i;
struct mmc_data *data = req->data;
struct dma_chan *chan;
struct dma_slave_config cfg = {
.src_addr = host->mapbase + OMAP_HSMMC_DATA,
.dst_addr = host->mapbase + OMAP_HSMMC_DATA,
.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
.src_maxburst = data->blksz / 4,
.dst_maxburst = data->blksz / 4,
};

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

chan = omap_hsmmc_get_dma_chan(host, data);

cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA;
cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA;
cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
cfg.src_maxburst = data->blksz / 4;
cfg.dst_maxburst = data->blksz / 4;

ret = dmaengine_slave_config(chan, &cfg);
if (ret)
return ret;
Expand Down
15 changes: 14 additions & 1 deletion drivers/mmc/host/sdhci-st.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

struct st_mmc_platform_data {
struct reset_control *rstc;
struct clk *icnclk;
void __iomem *top_ioaddr;
};

Expand Down Expand Up @@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
struct sdhci_host *host;
struct st_mmc_platform_data *pdata;
struct sdhci_pltfm_host *pltfm_host;
struct clk *clk;
struct clk *clk, *icnclk;
int ret = 0;
u16 host_version;
struct resource *res;
Expand All @@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev)
return PTR_ERR(clk);
}

/* ICN clock isn't compulsory, but use it if it's provided. */
icnclk = devm_clk_get(&pdev->dev, "icn");
if (IS_ERR(icnclk))
icnclk = NULL;

rstc = devm_reset_control_get(&pdev->dev, NULL);
if (IS_ERR(rstc))
rstc = NULL;
Expand All @@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
}

clk_prepare_enable(clk);
clk_prepare_enable(icnclk);

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

pltfm_host->clk = clk;
pdata->icnclk = icnclk;

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

err_out:
clk_disable_unprepare(icnclk);
clk_disable_unprepare(clk);
err_of:
sdhci_pltfm_free(pdev);
Expand All @@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev)

ret = sdhci_pltfm_unregister(pdev);

clk_disable_unprepare(pdata->icnclk);

if (rstc)
reset_control_assert(rstc);

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

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

clk_prepare_enable(pltfm_host->clk);
clk_prepare_enable(pdata->icnclk);

if (pdata->rstc)
reset_control_deassert(pdata->rstc);
Expand Down

0 comments on commit f32a10d

Please sign in to comment.