diff options
author | Robin Gong <yibin.gong@nxp.com> | 2017-11-16 17:23:40 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 540f932c039bd8362b1231502df71198bee0181c (patch) | |
tree | 2d99503b63f9d1cb0e20da1bc4be5a34d42af164 | |
parent | 09c1aa79cd1767b5264e2384a732cfa7bf70dd52 (diff) |
MLK-16841-1: dma: imx-sdma: add clock ration 1:1 check
On i.mx8 mscale B0 chip, AHB/SDMA clock ratio 2:1 can't be supportted,
since SDMA clock ration has to be increased to 250Mhz, AHB can't reach
to 500Mhz, so use 1:1 instead.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
-rw-r--r-- | Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt | 1 | ||||
-rw-r--r-- | drivers/dma/imx-sdma.c | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt index 0839b70f0261..81b8cad86d17 100644 --- a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt @@ -69,6 +69,7 @@ Optional properties: reg is the GPR register offset. shift is the bit position inside the GPR register. val is the value of the bit (0 or 1). +- fsl,ratio-1-1: AHB/SDMA core clock ration 1:1, 2:1 without this. Examples: diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 17355ffb235b..73af02f51853 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -426,6 +426,8 @@ struct sdma_engine { struct sdma_buffer_descriptor *bd0; bool suspend_off; int idx; + /* clock ration for AHB:SDMA core. 1:1 is 1, 2:1 is 0*/ + bool clk_ratio; }; static struct sdma_driver_data sdma_imx31 = { @@ -2100,7 +2102,10 @@ static int sdma_init(struct sdma_engine *sdma) /* Set bits of CONFIG register but with static context switching */ /* FIXME: Check whether to set ACR bit depending on clock ratios */ - writel_relaxed(0, sdma->regs + SDMA_H_CONFIG); + if (sdma->clk_ratio) + writel_relaxed(SDMA_H_CONFIG_ACR, sdma->regs + SDMA_H_CONFIG); + else + writel_relaxed(0, sdma->regs + SDMA_H_CONFIG); writel_relaxed(ccb_phys, sdma->regs + SDMA_H_C0PTR); @@ -2193,6 +2198,8 @@ static int sdma_probe(struct platform_device *pdev) if (!sdma) return -ENOMEM; + sdma->clk_ratio = of_property_read_bool(np, "fsl,ratio-1-1"); + spin_lock_init(&sdma->channel_0_lock); sdma->dev = &pdev->dev; |