提交 c4b56857 编写于 作者: R Richard Zhao 提交者: Vinod Koul

dma/imx-sdma: use readl_relaxed/writel_relaxed and use writel when necessary

use readl_relaxed/writel_relaxed in most places, and use writel when
enable channel, because it needs memory barrier.
Signed-off-by: NRichard Zhao <richard.zhao@linaro.org>
Signed-off-by: NVinod Koul <vinod.koul@linux.intel.com>
上级 b9a59166
...@@ -368,9 +368,9 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, ...@@ -368,9 +368,9 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
if (event_override && mcu_override && dsp_override) if (event_override && mcu_override && dsp_override)
return -EINVAL; return -EINVAL;
evt = __raw_readl(sdma->regs + SDMA_H_EVTOVR); evt = readl_relaxed(sdma->regs + SDMA_H_EVTOVR);
mcu = __raw_readl(sdma->regs + SDMA_H_HOSTOVR); mcu = readl_relaxed(sdma->regs + SDMA_H_HOSTOVR);
dsp = __raw_readl(sdma->regs + SDMA_H_DSPOVR); dsp = readl_relaxed(sdma->regs + SDMA_H_DSPOVR);
if (dsp_override) if (dsp_override)
dsp &= ~(1 << channel); dsp &= ~(1 << channel);
...@@ -387,16 +387,16 @@ static int sdma_config_ownership(struct sdma_channel *sdmac, ...@@ -387,16 +387,16 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
else else
mcu |= (1 << channel); mcu |= (1 << channel);
__raw_writel(evt, sdma->regs + SDMA_H_EVTOVR); writel_relaxed(evt, sdma->regs + SDMA_H_EVTOVR);
__raw_writel(mcu, sdma->regs + SDMA_H_HOSTOVR); writel_relaxed(mcu, sdma->regs + SDMA_H_HOSTOVR);
__raw_writel(dsp, sdma->regs + SDMA_H_DSPOVR); writel_relaxed(dsp, sdma->regs + SDMA_H_DSPOVR);
return 0; return 0;
} }
static void sdma_enable_channel(struct sdma_engine *sdma, int channel) static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
{ {
__raw_writel(1 << channel, sdma->regs + SDMA_H_START); writel(1 << channel, sdma->regs + SDMA_H_START);
} }
/* /*
...@@ -460,9 +460,9 @@ static void sdma_event_enable(struct sdma_channel *sdmac, unsigned int event) ...@@ -460,9 +460,9 @@ static void sdma_event_enable(struct sdma_channel *sdmac, unsigned int event)
u32 val; u32 val;
u32 chnenbl = chnenbl_ofs(sdma, event); u32 chnenbl = chnenbl_ofs(sdma, event);
val = __raw_readl(sdma->regs + chnenbl); val = readl_relaxed(sdma->regs + chnenbl);
val |= (1 << channel); val |= (1 << channel);
__raw_writel(val, sdma->regs + chnenbl); writel_relaxed(val, sdma->regs + chnenbl);
} }
static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event) static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event)
...@@ -472,9 +472,9 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event) ...@@ -472,9 +472,9 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event)
u32 chnenbl = chnenbl_ofs(sdma, event); u32 chnenbl = chnenbl_ofs(sdma, event);
u32 val; u32 val;
val = __raw_readl(sdma->regs + chnenbl); val = readl_relaxed(sdma->regs + chnenbl);
val &= ~(1 << channel); val &= ~(1 << channel);
__raw_writel(val, sdma->regs + chnenbl); writel_relaxed(val, sdma->regs + chnenbl);
} }
static void sdma_handle_channel_loop(struct sdma_channel *sdmac) static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
...@@ -552,8 +552,8 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id) ...@@ -552,8 +552,8 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
struct sdma_engine *sdma = dev_id; struct sdma_engine *sdma = dev_id;
u32 stat; u32 stat;
stat = __raw_readl(sdma->regs + SDMA_H_INTR); stat = readl_relaxed(sdma->regs + SDMA_H_INTR);
__raw_writel(stat, sdma->regs + SDMA_H_INTR); writel_relaxed(stat, sdma->regs + SDMA_H_INTR);
while (stat) { while (stat) {
int channel = fls(stat) - 1; int channel = fls(stat) - 1;
...@@ -707,7 +707,7 @@ static void sdma_disable_channel(struct sdma_channel *sdmac) ...@@ -707,7 +707,7 @@ static void sdma_disable_channel(struct sdma_channel *sdmac)
struct sdma_engine *sdma = sdmac->sdma; struct sdma_engine *sdma = sdmac->sdma;
int channel = sdmac->channel; int channel = sdmac->channel;
__raw_writel(1 << channel, sdma->regs + SDMA_H_STATSTOP); writel_relaxed(1 << channel, sdma->regs + SDMA_H_STATSTOP);
sdmac->status = DMA_ERROR; sdmac->status = DMA_ERROR;
} }
...@@ -780,7 +780,7 @@ static int sdma_set_channel_priority(struct sdma_channel *sdmac, ...@@ -780,7 +780,7 @@ static int sdma_set_channel_priority(struct sdma_channel *sdmac,
return -EINVAL; return -EINVAL;
} }
__raw_writel(priority, sdma->regs + SDMA_CHNPRI_0 + 4 * channel); writel_relaxed(priority, sdma->regs + SDMA_CHNPRI_0 + 4 * channel);
return 0; return 0;
} }
...@@ -1228,7 +1228,7 @@ static int __init sdma_init(struct sdma_engine *sdma) ...@@ -1228,7 +1228,7 @@ static int __init sdma_init(struct sdma_engine *sdma)
clk_enable(sdma->clk); clk_enable(sdma->clk);
/* Be sure SDMA has not started yet */ /* Be sure SDMA has not started yet */
__raw_writel(0, sdma->regs + SDMA_H_C0PTR); writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);
sdma->channel_control = dma_alloc_coherent(NULL, sdma->channel_control = dma_alloc_coherent(NULL,
MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control) + MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control) +
...@@ -1251,11 +1251,11 @@ static int __init sdma_init(struct sdma_engine *sdma) ...@@ -1251,11 +1251,11 @@ static int __init sdma_init(struct sdma_engine *sdma)
/* disable all channels */ /* disable all channels */
for (i = 0; i < sdma->num_events; i++) for (i = 0; i < sdma->num_events; i++)
__raw_writel(0, sdma->regs + chnenbl_ofs(sdma, i)); writel_relaxed(0, sdma->regs + chnenbl_ofs(sdma, i));
/* All channels have priority 0 */ /* All channels have priority 0 */
for (i = 0; i < MAX_DMA_CHANNELS; i++) for (i = 0; i < MAX_DMA_CHANNELS; i++)
__raw_writel(0, sdma->regs + SDMA_CHNPRI_0 + i * 4); writel_relaxed(0, sdma->regs + SDMA_CHNPRI_0 + i * 4);
ret = sdma_request_channel(&sdma->channel[0]); ret = sdma_request_channel(&sdma->channel[0]);
if (ret) if (ret)
...@@ -1264,16 +1264,16 @@ static int __init sdma_init(struct sdma_engine *sdma) ...@@ -1264,16 +1264,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
sdma_config_ownership(&sdma->channel[0], false, true, false); sdma_config_ownership(&sdma->channel[0], false, true, false);
/* Set Command Channel (Channel Zero) */ /* Set Command Channel (Channel Zero) */
__raw_writel(0x4050, sdma->regs + SDMA_CHN0ADDR); writel_relaxed(0x4050, sdma->regs + SDMA_CHN0ADDR);
/* Set bits of CONFIG register but with static context switching */ /* Set bits of CONFIG register but with static context switching */
/* FIXME: Check whether to set ACR bit depending on clock ratios */ /* FIXME: Check whether to set ACR bit depending on clock ratios */
__raw_writel(0, sdma->regs + SDMA_H_CONFIG); writel_relaxed(0, sdma->regs + SDMA_H_CONFIG);
__raw_writel(ccb_phys, sdma->regs + SDMA_H_C0PTR); writel_relaxed(ccb_phys, sdma->regs + SDMA_H_C0PTR);
/* Set bits of CONFIG register with given context switching mode */ /* Set bits of CONFIG register with given context switching mode */
__raw_writel(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG); writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
/* Initializes channel's priorities */ /* Initializes channel's priorities */
sdma_set_channel_priority(&sdma->channel[0], 7); sdma_set_channel_priority(&sdma->channel[0], 7);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册