aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-17 13:37:05 -0500
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-02-24 04:07:06 -0500
commite9f49d4183759e4d8469ac86189ef8bc4374cccc (patch)
tree408412cd2499eb0e8761263b6f55968295a59d68
parent8e3a6e7fa739d021324d813cd6fdd1c5c7998774 (diff)
arm/imx/dma-v1: don't use deprecated symbols DMA_BASE and MXC_INT_DMACH0
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--arch/arm/plat-mxc/Makefile1
-rw-r--r--arch/arm/plat-mxc/dma-mx1-mx2.c160
2 files changed, 90 insertions, 71 deletions
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index f9c604adf5a7..4074c1847b43 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -8,7 +8,6 @@ obj-y := irq.o clock.o gpio.o time.o devices.o cpu.o system.o
8obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o 8obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o 9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
10CFLAGS_iomux-mx1-mx2.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS 10CFLAGS_iomux-mx1-mx2.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
11CFLAGS_dma-mx1-mx2.o = -DIMX_NEEDS_DEPRECATED_SYMBOLS
12obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o 11obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
13obj-$(CONFIG_MXC_PWM) += pwm.o 12obj-$(CONFIG_MXC_PWM) += pwm.o
14obj-$(CONFIG_USB_EHCI_MXC) += ehci.o 13obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
diff --git a/arch/arm/plat-mxc/dma-mx1-mx2.c b/arch/arm/plat-mxc/dma-mx1-mx2.c
index 9c1b3f9c4f4d..eddc96594ec6 100644
--- a/arch/arm/plat-mxc/dma-mx1-mx2.c
+++ b/arch/arm/plat-mxc/dma-mx1-mx2.c
@@ -128,6 +128,18 @@ struct imx_dma_channel {
128 int hw_chaining; 128 int hw_chaining;
129}; 129};
130 130
131static void __iomem *imx_dmav1_baseaddr;
132
133static void imx_dmav1_writel(unsigned val, unsigned offset)
134{
135 __raw_writel(val, imx_dmav1_baseaddr + offset);
136}
137
138static unsigned imx_dmav1_readl(unsigned offset)
139{
140 return __raw_readl(imx_dmav1_baseaddr + offset);
141}
142
131static struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; 143static struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
132 144
133static struct clk *dma_clk; 145static struct clk *dma_clk;
@@ -140,7 +152,6 @@ static int imx_dma_hw_chain(struct imx_dma_channel *imxdma)
140 return 0; 152 return 0;
141} 153}
142 154
143
144/* 155/*
145 * imx_dma_sg_next - prepare next chunk for scatter-gather DMA emulation 156 * imx_dma_sg_next - prepare next chunk for scatter-gather DMA emulation
146 */ 157 */
@@ -160,17 +171,17 @@ static inline int imx_dma_sg_next(int channel, struct scatterlist *sg)
160 imxdma->resbytes -= now; 171 imxdma->resbytes -= now;
161 172
162 if ((imxdma->dma_mode & DMA_MODE_MASK) == DMA_MODE_READ) 173 if ((imxdma->dma_mode & DMA_MODE_MASK) == DMA_MODE_READ)
163 __raw_writel(sg->dma_address, DMA_BASE + DMA_DAR(channel)); 174 imx_dmav1_writel(sg->dma_address, DMA_DAR(channel));
164 else 175 else
165 __raw_writel(sg->dma_address, DMA_BASE + DMA_SAR(channel)); 176 imx_dmav1_writel(sg->dma_address, DMA_SAR(channel));
166 177
167 __raw_writel(now, DMA_BASE + DMA_CNTR(channel)); 178 imx_dmav1_writel(now, DMA_CNTR(channel));
168 179
169 pr_debug("imxdma%d: next sg chunk dst 0x%08x, src 0x%08x, " 180 pr_debug("imxdma%d: next sg chunk dst 0x%08x, src 0x%08x, "
170 "size 0x%08x\n", channel, 181 "size 0x%08x\n", channel,
171 __raw_readl(DMA_BASE + DMA_DAR(channel)), 182 imx_dmav1_readl(DMA_DAR(channel)),
172 __raw_readl(DMA_BASE + DMA_SAR(channel)), 183 imx_dmav1_readl(DMA_SAR(channel)),
173 __raw_readl(DMA_BASE + DMA_CNTR(channel))); 184 imx_dmav1_readl(DMA_CNTR(channel)));
174 185
175 return now; 186 return now;
176} 187}
@@ -218,27 +229,26 @@ imx_dma_setup_single(int channel, dma_addr_t dma_address,
218 channel, __func__, (unsigned int)dma_address, 229 channel, __func__, (unsigned int)dma_address,
219 dma_length, dev_addr); 230 dma_length, dev_addr);
220 231
221 __raw_writel(dev_addr, DMA_BASE + DMA_SAR(channel)); 232 imx_dmav1_writel(dev_addr, DMA_SAR(channel));
222 __raw_writel(dma_address, DMA_BASE + DMA_DAR(channel)); 233 imx_dmav1_writel(dma_address, DMA_DAR(channel));
223 __raw_writel(imxdma->ccr_from_device, 234 imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel));
224 DMA_BASE + DMA_CCR(channel));
225 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) { 235 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
226 pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d " 236 pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d "
227 "dev_addr=0x%08x for write\n", 237 "dev_addr=0x%08x for write\n",
228 channel, __func__, (unsigned int)dma_address, 238 channel, __func__, (unsigned int)dma_address,
229 dma_length, dev_addr); 239 dma_length, dev_addr);
230 240
231 __raw_writel(dma_address, DMA_BASE + DMA_SAR(channel)); 241 imx_dmav1_writel(dma_address, DMA_SAR(channel));
232 __raw_writel(dev_addr, DMA_BASE + DMA_DAR(channel)); 242 imx_dmav1_writel(dev_addr, DMA_DAR(channel));
233 __raw_writel(imxdma->ccr_to_device, 243 imx_dmav1_writel(imxdma->ccr_to_device,
234 DMA_BASE + DMA_CCR(channel)); 244 DMA_CCR(channel));
235 } else { 245 } else {
236 printk(KERN_ERR "imxdma%d: imx_dma_setup_single bad dmamode\n", 246 printk(KERN_ERR "imxdma%d: imx_dma_setup_single bad dmamode\n",
237 channel); 247 channel);
238 return -EINVAL; 248 return -EINVAL;
239 } 249 }
240 250
241 __raw_writel(dma_length, DMA_BASE + DMA_CNTR(channel)); 251 imx_dmav1_writel(dma_length, DMA_CNTR(channel));
242 252
243 return 0; 253 return 0;
244} 254}
@@ -316,17 +326,15 @@ imx_dma_setup_sg(int channel,
316 "dev_addr=0x%08x for read\n", 326 "dev_addr=0x%08x for read\n",
317 channel, __func__, sg, sgcount, dma_length, dev_addr); 327 channel, __func__, sg, sgcount, dma_length, dev_addr);
318 328
319 __raw_writel(dev_addr, DMA_BASE + DMA_SAR(channel)); 329 imx_dmav1_writel(dev_addr, DMA_SAR(channel));
320 __raw_writel(imxdma->ccr_from_device, 330 imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel));
321 DMA_BASE + DMA_CCR(channel));
322 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) { 331 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
323 pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d " 332 pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d "
324 "dev_addr=0x%08x for write\n", 333 "dev_addr=0x%08x for write\n",
325 channel, __func__, sg, sgcount, dma_length, dev_addr); 334 channel, __func__, sg, sgcount, dma_length, dev_addr);
326 335
327 __raw_writel(dev_addr, DMA_BASE + DMA_DAR(channel)); 336 imx_dmav1_writel(dev_addr, DMA_DAR(channel));
328 __raw_writel(imxdma->ccr_to_device, 337 imx_dmav1_writel(imxdma->ccr_to_device, DMA_CCR(channel));
329 DMA_BASE + DMA_CCR(channel));
330 } else { 338 } else {
331 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg bad dmamode\n", 339 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg bad dmamode\n",
332 channel); 340 channel);
@@ -360,7 +368,7 @@ imx_dma_config_channel(int channel, unsigned int config_port,
360 imxdma->ccr_from_device = config_port | (config_mem << 2) | dreq; 368 imxdma->ccr_from_device = config_port | (config_mem << 2) | dreq;
361 imxdma->ccr_to_device = config_mem | (config_port << 2) | dreq; 369 imxdma->ccr_to_device = config_mem | (config_port << 2) | dreq;
362 370
363 __raw_writel(dmareq, DMA_BASE + DMA_RSSR(channel)); 371 imx_dmav1_writel(dmareq, DMA_RSSR(channel));
364 372
365 return 0; 373 return 0;
366} 374}
@@ -368,7 +376,7 @@ EXPORT_SYMBOL(imx_dma_config_channel);
368 376
369void imx_dma_config_burstlen(int channel, unsigned int burstlen) 377void imx_dma_config_burstlen(int channel, unsigned int burstlen)
370{ 378{
371 __raw_writel(burstlen, DMA_BASE + DMA_BLR(channel)); 379 imx_dmav1_writel(burstlen, DMA_BLR(channel));
372} 380}
373EXPORT_SYMBOL(imx_dma_config_burstlen); 381EXPORT_SYMBOL(imx_dma_config_burstlen);
374 382
@@ -398,7 +406,7 @@ imx_dma_setup_handlers(int channel,
398 } 406 }
399 407
400 local_irq_save(flags); 408 local_irq_save(flags);
401 __raw_writel(1 << channel, DMA_BASE + DMA_DISR); 409 imx_dmav1_writel(1 << channel, DMA_DISR);
402 imxdma->irq_handler = irq_handler; 410 imxdma->irq_handler = irq_handler;
403 imxdma->err_handler = err_handler; 411 imxdma->err_handler = err_handler;
404 imxdma->data = data; 412 imxdma->data = data;
@@ -462,12 +470,10 @@ void imx_dma_enable(int channel)
462 470
463 local_irq_save(flags); 471 local_irq_save(flags);
464 472
465 __raw_writel(1 << channel, DMA_BASE + DMA_DISR); 473 imx_dmav1_writel(1 << channel, DMA_DISR);
466 __raw_writel(__raw_readl(DMA_BASE + DMA_DIMR) & ~(1 << channel), 474 imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) & ~(1 << channel), DMA_DIMR);
467 DMA_BASE + DMA_DIMR); 475 imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) | CCR_CEN |
468 __raw_writel(__raw_readl(DMA_BASE + DMA_CCR(channel)) | CCR_CEN | 476 CCR_ACRPT, DMA_CCR(channel));
469 CCR_ACRPT,
470 DMA_BASE + DMA_CCR(channel));
471 477
472#ifdef CONFIG_ARCH_MX2 478#ifdef CONFIG_ARCH_MX2
473 if (imxdma->sg && imx_dma_hw_chain(imxdma)) { 479 if (imxdma->sg && imx_dma_hw_chain(imxdma)) {
@@ -475,9 +481,9 @@ void imx_dma_enable(int channel)
475 if (imxdma->sg) { 481 if (imxdma->sg) {
476 u32 tmp; 482 u32 tmp;
477 imx_dma_sg_next(channel, imxdma->sg); 483 imx_dma_sg_next(channel, imxdma->sg);
478 tmp = __raw_readl(DMA_BASE + DMA_CCR(channel)); 484 tmp = imx_dmav1_readl(DMA_CCR(channel));
479 __raw_writel(tmp | CCR_RPT | CCR_ACRPT, 485 imx_dmav1_writel(tmp | CCR_RPT | CCR_ACRPT,
480 DMA_BASE + DMA_CCR(channel)); 486 DMA_CCR(channel));
481 } 487 }
482 } 488 }
483#endif 489#endif
@@ -502,11 +508,10 @@ void imx_dma_disable(int channel)
502 del_timer(&imxdma->watchdog); 508 del_timer(&imxdma->watchdog);
503 509
504 local_irq_save(flags); 510 local_irq_save(flags);
505 __raw_writel(__raw_readl(DMA_BASE + DMA_DIMR) | (1 << channel), 511 imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) | (1 << channel), DMA_DIMR);
506 DMA_BASE + DMA_DIMR); 512 imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) & ~CCR_CEN,
507 __raw_writel(__raw_readl(DMA_BASE + DMA_CCR(channel)) & ~CCR_CEN, 513 DMA_CCR(channel));
508 DMA_BASE + DMA_CCR(channel)); 514 imx_dmav1_writel(1 << channel, DMA_DISR);
509 __raw_writel(1 << channel, DMA_BASE + DMA_DISR);
510 imxdma->in_use = 0; 515 imxdma->in_use = 0;
511 local_irq_restore(flags); 516 local_irq_restore(flags);
512} 517}
@@ -517,7 +522,7 @@ static void imx_dma_watchdog(unsigned long chno)
517{ 522{
518 struct imx_dma_channel *imxdma = &imx_dma_channels[chno]; 523 struct imx_dma_channel *imxdma = &imx_dma_channels[chno];
519 524
520 __raw_writel(0, DMA_BASE + DMA_CCR(chno)); 525 imx_dmav1_writel(0, DMA_CCR(chno));
521 imxdma->in_use = 0; 526 imxdma->in_use = 0;
522 imxdma->sg = NULL; 527 imxdma->sg = NULL;
523 528
@@ -533,17 +538,17 @@ static irqreturn_t dma_err_handler(int irq, void *dev_id)
533 unsigned int err_mask; 538 unsigned int err_mask;
534 int errcode; 539 int errcode;
535 540
536 disr = __raw_readl(DMA_BASE + DMA_DISR); 541 disr = imx_dmav1_readl(DMA_DISR);
537 542
538 err_mask = __raw_readl(DMA_BASE + DMA_DBTOSR) | 543 err_mask = imx_dmav1_readl(DMA_DBTOSR) |
539 __raw_readl(DMA_BASE + DMA_DRTOSR) | 544 imx_dmav1_readl(DMA_DRTOSR) |
540 __raw_readl(DMA_BASE + DMA_DSESR) | 545 imx_dmav1_readl(DMA_DSESR) |
541 __raw_readl(DMA_BASE + DMA_DBOSR); 546 imx_dmav1_readl(DMA_DBOSR);
542 547
543 if (!err_mask) 548 if (!err_mask)
544 return IRQ_HANDLED; 549 return IRQ_HANDLED;
545 550
546 __raw_writel(disr & err_mask, DMA_BASE + DMA_DISR); 551 imx_dmav1_writel(disr & err_mask, DMA_DISR);
547 552
548 for (i = 0; i < IMX_DMA_CHANNELS; i++) { 553 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
549 if (!(err_mask & (1 << i))) 554 if (!(err_mask & (1 << i)))
@@ -551,20 +556,20 @@ static irqreturn_t dma_err_handler(int irq, void *dev_id)
551 imxdma = &imx_dma_channels[i]; 556 imxdma = &imx_dma_channels[i];
552 errcode = 0; 557 errcode = 0;
553 558
554 if (__raw_readl(DMA_BASE + DMA_DBTOSR) & (1 << i)) { 559 if (imx_dmav1_readl(DMA_DBTOSR) & (1 << i)) {
555 __raw_writel(1 << i, DMA_BASE + DMA_DBTOSR); 560 imx_dmav1_writel(1 << i, DMA_DBTOSR);
556 errcode |= IMX_DMA_ERR_BURST; 561 errcode |= IMX_DMA_ERR_BURST;
557 } 562 }
558 if (__raw_readl(DMA_BASE + DMA_DRTOSR) & (1 << i)) { 563 if (imx_dmav1_readl(DMA_DRTOSR) & (1 << i)) {
559 __raw_writel(1 << i, DMA_BASE + DMA_DRTOSR); 564 imx_dmav1_writel(1 << i, DMA_DRTOSR);
560 errcode |= IMX_DMA_ERR_REQUEST; 565 errcode |= IMX_DMA_ERR_REQUEST;
561 } 566 }
562 if (__raw_readl(DMA_BASE + DMA_DSESR) & (1 << i)) { 567 if (imx_dmav1_readl(DMA_DSESR) & (1 << i)) {
563 __raw_writel(1 << i, DMA_BASE + DMA_DSESR); 568 imx_dmav1_writel(1 << i, DMA_DSESR);
564 errcode |= IMX_DMA_ERR_TRANSFER; 569 errcode |= IMX_DMA_ERR_TRANSFER;
565 } 570 }
566 if (__raw_readl(DMA_BASE + DMA_DBOSR) & (1 << i)) { 571 if (imx_dmav1_readl(DMA_DBOSR) & (1 << i)) {
567 __raw_writel(1 << i, DMA_BASE + DMA_DBOSR); 572 imx_dmav1_writel(1 << i, DMA_DBOSR);
568 errcode |= IMX_DMA_ERR_BUFFER; 573 errcode |= IMX_DMA_ERR_BUFFER;
569 } 574 }
570 if (imxdma->name && imxdma->err_handler) { 575 if (imxdma->name && imxdma->err_handler) {
@@ -607,7 +612,7 @@ static void dma_irq_handle_channel(int chno)
607 if (imxdma->sg) { 612 if (imxdma->sg) {
608 imx_dma_sg_next(chno, imxdma->sg); 613 imx_dma_sg_next(chno, imxdma->sg);
609 614
610 tmp = __raw_readl(DMA_BASE + DMA_CCR(chno)); 615 tmp = imx_dmav1_readl(DMA_CCR(chno));
611 616
612 if (imx_dma_hw_chain(imxdma)) { 617 if (imx_dma_hw_chain(imxdma)) {
613 /* FIXME: The timeout should probably be 618 /* FIXME: The timeout should probably be
@@ -617,15 +622,13 @@ static void dma_irq_handle_channel(int chno)
617 jiffies + msecs_to_jiffies(500)); 622 jiffies + msecs_to_jiffies(500));
618 623
619 tmp |= CCR_CEN | CCR_RPT | CCR_ACRPT; 624 tmp |= CCR_CEN | CCR_RPT | CCR_ACRPT;
620 __raw_writel(tmp, DMA_BASE + 625 imx_dmav1_writel(tmp, DMA_CCR(chno));
621 DMA_CCR(chno));
622 } else { 626 } else {
623 __raw_writel(tmp & ~CCR_CEN, DMA_BASE + 627 imx_dmav1_writel(tmp & ~CCR_CEN, DMA_CCR(chno));
624 DMA_CCR(chno));
625 tmp |= CCR_CEN; 628 tmp |= CCR_CEN;
626 } 629 }
627 630
628 __raw_writel(tmp, DMA_BASE + DMA_CCR(chno)); 631 imx_dmav1_writel(tmp, DMA_CCR(chno));
629 632
630 if (imxdma->prog_handler) 633 if (imxdma->prog_handler)
631 imxdma->prog_handler(chno, imxdma->data, 634 imxdma->prog_handler(chno, imxdma->data,
@@ -640,7 +643,7 @@ static void dma_irq_handle_channel(int chno)
640 } 643 }
641 } 644 }
642 645
643 __raw_writel(0, DMA_BASE + DMA_CCR(chno)); 646 imx_dmav1_writel(0, DMA_CCR(chno));
644 imxdma->in_use = 0; 647 imxdma->in_use = 0;
645 if (imxdma->irq_handler) 648 if (imxdma->irq_handler)
646 imxdma->irq_handler(chno, imxdma->data); 649 imxdma->irq_handler(chno, imxdma->data);
@@ -654,12 +657,12 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
654 dma_err_handler(irq, dev_id); 657 dma_err_handler(irq, dev_id);
655#endif 658#endif
656 659
657 disr = __raw_readl(DMA_BASE + DMA_DISR); 660 disr = imx_dmav1_readl(DMA_DISR);
658 661
659 pr_debug("imxdma: dma_irq_handler called, disr=0x%08x\n", 662 pr_debug("imxdma: dma_irq_handler called, disr=0x%08x\n",
660 disr); 663 disr);
661 664
662 __raw_writel(disr, DMA_BASE + DMA_DISR); 665 imx_dmav1_writel(disr, DMA_DISR);
663 for (i = 0; i < IMX_DMA_CHANNELS; i++) { 666 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
664 if (disr & (1 << i)) 667 if (disr & (1 << i))
665 dma_irq_handle_channel(i); 668 dma_irq_handle_channel(i);
@@ -699,12 +702,12 @@ int imx_dma_request(int channel, const char *name)
699 local_irq_restore(flags); /* request_irq() can block */ 702 local_irq_restore(flags); /* request_irq() can block */
700 703
701#ifdef CONFIG_ARCH_MX2 704#ifdef CONFIG_ARCH_MX2
702 ret = request_irq(MXC_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA", 705 ret = request_irq(MX2x_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA",
703 NULL); 706 NULL);
704 if (ret) { 707 if (ret) {
705 imxdma->name = NULL; 708 imxdma->name = NULL;
706 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n", 709 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n",
707 MXC_INT_DMACH0 + channel, channel); 710 MX2x_INT_DMACH0 + channel, channel);
708 return ret; 711 return ret;
709 } 712 }
710 init_timer(&imxdma->watchdog); 713 init_timer(&imxdma->watchdog);
@@ -738,7 +741,7 @@ void imx_dma_free(int channel)
738 imxdma->name = NULL; 741 imxdma->name = NULL;
739 742
740#ifdef CONFIG_ARCH_MX2 743#ifdef CONFIG_ARCH_MX2
741 free_irq(MXC_INT_DMACH0 + channel, NULL); 744 free_irq(MX2x_INT_DMACH0 + channel, NULL);
742#endif 745#endif
743 746
744 local_irq_restore(flags); 747 local_irq_restore(flags);
@@ -796,11 +799,28 @@ static int __init imx_dma_init(void)
796 int ret = 0; 799 int ret = 0;
797 int i; 800 int i;
798 801
802#ifdef CONFIG_ARCH_MX1
803 if (cpu_is_mx1())
804 imx_dmav1_baseaddr = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR);
805 else
806#endif
807#ifdef CONFIG_MACH_MX21
808 if (cpu_is_mx21())
809 imx_dmav1_baseaddr = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR);
810 else
811#endif
812#ifdef CONFIG_MACH_MX27
813 if (cpu_is_mx27())
814 imx_dmav1_baseaddr = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR);
815 else
816#endif
817 BUG();
818
799 dma_clk = clk_get(NULL, "dma"); 819 dma_clk = clk_get(NULL, "dma");
800 clk_enable(dma_clk); 820 clk_enable(dma_clk);
801 821
802 /* reset DMA module */ 822 /* reset DMA module */
803 __raw_writel(DCR_DRST, DMA_BASE + DMA_DCR); 823 imx_dmav1_writel(DCR_DRST, DMA_DCR);
804 824
805#ifdef CONFIG_ARCH_MX1 825#ifdef CONFIG_ARCH_MX1
806 ret = request_irq(DMA_INT, dma_irq_handler, 0, "DMA", NULL); 826 ret = request_irq(DMA_INT, dma_irq_handler, 0, "DMA", NULL);
@@ -817,13 +837,13 @@ static int __init imx_dma_init(void)
817 } 837 }
818#endif 838#endif
819 /* enable DMA module */ 839 /* enable DMA module */
820 __raw_writel(DCR_DEN, DMA_BASE + DMA_DCR); 840 imx_dmav1_writel(DCR_DEN, DMA_DCR);
821 841
822 /* clear all interrupts */ 842 /* clear all interrupts */
823 __raw_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_BASE + DMA_DISR); 843 imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
824 844
825 /* disable interrupts */ 845 /* disable interrupts */
826 __raw_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_BASE + DMA_DIMR); 846 imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
827 847
828 for (i = 0; i < IMX_DMA_CHANNELS; i++) { 848 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
829 imx_dma_channels[i].sg = NULL; 849 imx_dma_channels[i].sg = NULL;