aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-sdma.c
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@linaro.org>2012-01-12 22:09:57 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-01-30 22:33:16 -0500
commitc4b56857d17540e8085a04ea479b0239f4ee764c (patch)
tree9a0a5388f4c22be7beaf7e5096ab8c91b9ce9f18 /drivers/dma/imx-sdma.c
parentb9a591664a21a3d342b9e3b09b0aa2223ae7c469 (diff)
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: Richard Zhao <richard.zhao@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/imx-sdma.c')
-rw-r--r--drivers/dma/imx-sdma.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 46e334d48e8d..fd9ce77655bb 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -368,9 +368,9 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
368 if (event_override && mcu_override && dsp_override) 368 if (event_override && mcu_override && dsp_override)
369 return -EINVAL; 369 return -EINVAL;
370 370
371 evt = __raw_readl(sdma->regs + SDMA_H_EVTOVR); 371 evt = readl_relaxed(sdma->regs + SDMA_H_EVTOVR);
372 mcu = __raw_readl(sdma->regs + SDMA_H_HOSTOVR); 372 mcu = readl_relaxed(sdma->regs + SDMA_H_HOSTOVR);
373 dsp = __raw_readl(sdma->regs + SDMA_H_DSPOVR); 373 dsp = readl_relaxed(sdma->regs + SDMA_H_DSPOVR);
374 374
375 if (dsp_override) 375 if (dsp_override)
376 dsp &= ~(1 << channel); 376 dsp &= ~(1 << channel);
@@ -387,16 +387,16 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
387 else 387 else
388 mcu |= (1 << channel); 388 mcu |= (1 << channel);
389 389
390 __raw_writel(evt, sdma->regs + SDMA_H_EVTOVR); 390 writel_relaxed(evt, sdma->regs + SDMA_H_EVTOVR);
391 __raw_writel(mcu, sdma->regs + SDMA_H_HOSTOVR); 391 writel_relaxed(mcu, sdma->regs + SDMA_H_HOSTOVR);
392 __raw_writel(dsp, sdma->regs + SDMA_H_DSPOVR); 392 writel_relaxed(dsp, sdma->regs + SDMA_H_DSPOVR);
393 393
394 return 0; 394 return 0;
395} 395}
396 396
397static void sdma_enable_channel(struct sdma_engine *sdma, int channel) 397static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
398{ 398{
399 __raw_writel(1 << channel, sdma->regs + SDMA_H_START); 399 writel(1 << channel, sdma->regs + SDMA_H_START);
400} 400}
401 401
402/* 402/*
@@ -460,9 +460,9 @@ static void sdma_event_enable(struct sdma_channel *sdmac, unsigned int event)
460 u32 val; 460 u32 val;
461 u32 chnenbl = chnenbl_ofs(sdma, event); 461 u32 chnenbl = chnenbl_ofs(sdma, event);
462 462
463 val = __raw_readl(sdma->regs + chnenbl); 463 val = readl_relaxed(sdma->regs + chnenbl);
464 val |= (1 << channel); 464 val |= (1 << channel);
465 __raw_writel(val, sdma->regs + chnenbl); 465 writel_relaxed(val, sdma->regs + chnenbl);
466} 466}
467 467
468static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event) 468static 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 u32 chnenbl = chnenbl_ofs(sdma, event); 472 u32 chnenbl = chnenbl_ofs(sdma, event);
473 u32 val; 473 u32 val;
474 474
475 val = __raw_readl(sdma->regs + chnenbl); 475 val = readl_relaxed(sdma->regs + chnenbl);
476 val &= ~(1 << channel); 476 val &= ~(1 << channel);
477 __raw_writel(val, sdma->regs + chnenbl); 477 writel_relaxed(val, sdma->regs + chnenbl);
478} 478}
479 479
480static void sdma_handle_channel_loop(struct sdma_channel *sdmac) 480static 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 struct sdma_engine *sdma = dev_id; 552 struct sdma_engine *sdma = dev_id;
553 u32 stat; 553 u32 stat;
554 554
555 stat = __raw_readl(sdma->regs + SDMA_H_INTR); 555 stat = readl_relaxed(sdma->regs + SDMA_H_INTR);
556 __raw_writel(stat, sdma->regs + SDMA_H_INTR); 556 writel_relaxed(stat, sdma->regs + SDMA_H_INTR);
557 557
558 while (stat) { 558 while (stat) {
559 int channel = fls(stat) - 1; 559 int channel = fls(stat) - 1;
@@ -707,7 +707,7 @@ static void sdma_disable_channel(struct sdma_channel *sdmac)
707 struct sdma_engine *sdma = sdmac->sdma; 707 struct sdma_engine *sdma = sdmac->sdma;
708 int channel = sdmac->channel; 708 int channel = sdmac->channel;
709 709
710 __raw_writel(1 << channel, sdma->regs + SDMA_H_STATSTOP); 710 writel_relaxed(1 << channel, sdma->regs + SDMA_H_STATSTOP);
711 sdmac->status = DMA_ERROR; 711 sdmac->status = DMA_ERROR;
712} 712}
713 713
@@ -780,7 +780,7 @@ static int sdma_set_channel_priority(struct sdma_channel *sdmac,
780 return -EINVAL; 780 return -EINVAL;
781 } 781 }
782 782
783 __raw_writel(priority, sdma->regs + SDMA_CHNPRI_0 + 4 * channel); 783 writel_relaxed(priority, sdma->regs + SDMA_CHNPRI_0 + 4 * channel);
784 784
785 return 0; 785 return 0;
786} 786}
@@ -1228,7 +1228,7 @@ static int __init sdma_init(struct sdma_engine *sdma)
1228 clk_enable(sdma->clk); 1228 clk_enable(sdma->clk);
1229 1229
1230 /* Be sure SDMA has not started yet */ 1230 /* Be sure SDMA has not started yet */
1231 __raw_writel(0, sdma->regs + SDMA_H_C0PTR); 1231 writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);
1232 1232
1233 sdma->channel_control = dma_alloc_coherent(NULL, 1233 sdma->channel_control = dma_alloc_coherent(NULL,
1234 MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control) + 1234 MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control) +
@@ -1251,11 +1251,11 @@ static int __init sdma_init(struct sdma_engine *sdma)
1251 1251
1252 /* disable all channels */ 1252 /* disable all channels */
1253 for (i = 0; i < sdma->num_events; i++) 1253 for (i = 0; i < sdma->num_events; i++)
1254 __raw_writel(0, sdma->regs + chnenbl_ofs(sdma, i)); 1254 writel_relaxed(0, sdma->regs + chnenbl_ofs(sdma, i));
1255 1255
1256 /* All channels have priority 0 */ 1256 /* All channels have priority 0 */
1257 for (i = 0; i < MAX_DMA_CHANNELS; i++) 1257 for (i = 0; i < MAX_DMA_CHANNELS; i++)
1258 __raw_writel(0, sdma->regs + SDMA_CHNPRI_0 + i * 4); 1258 writel_relaxed(0, sdma->regs + SDMA_CHNPRI_0 + i * 4);
1259 1259
1260 ret = sdma_request_channel(&sdma->channel[0]); 1260 ret = sdma_request_channel(&sdma->channel[0]);
1261 if (ret) 1261 if (ret)
@@ -1264,16 +1264,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
1264 sdma_config_ownership(&sdma->channel[0], false, true, false); 1264 sdma_config_ownership(&sdma->channel[0], false, true, false);
1265 1265
1266 /* Set Command Channel (Channel Zero) */ 1266 /* Set Command Channel (Channel Zero) */
1267 __raw_writel(0x4050, sdma->regs + SDMA_CHN0ADDR); 1267 writel_relaxed(0x4050, sdma->regs + SDMA_CHN0ADDR);
1268 1268
1269 /* Set bits of CONFIG register but with static context switching */ 1269 /* Set bits of CONFIG register but with static context switching */
1270 /* FIXME: Check whether to set ACR bit depending on clock ratios */ 1270 /* FIXME: Check whether to set ACR bit depending on clock ratios */
1271 __raw_writel(0, sdma->regs + SDMA_H_CONFIG); 1271 writel_relaxed(0, sdma->regs + SDMA_H_CONFIG);
1272 1272
1273 __raw_writel(ccb_phys, sdma->regs + SDMA_H_C0PTR); 1273 writel_relaxed(ccb_phys, sdma->regs + SDMA_H_C0PTR);
1274 1274
1275 /* Set bits of CONFIG register with given context switching mode */ 1275 /* Set bits of CONFIG register with given context switching mode */
1276 __raw_writel(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG); 1276 writel_relaxed(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
1277 1277
1278 /* Initializes channel's priorities */ 1278 /* Initializes channel's priorities */
1279 sdma_set_channel_priority(&sdma->channel[0], 7); 1279 sdma_set_channel_priority(&sdma->channel[0], 7);