aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2006-06-26 19:16:15 -0400
committerTony Lindgren <tony@atomide.com>2006-06-26 19:16:15 -0400
commit7ff879dbcd2083c95933a56bce65ae45ecab3f35 (patch)
treeba34240578d5d8cebf58ad9e5f23d22d3eed2d5a
parent6dc3c8f20159530d5553d0f8decc9454916d7495 (diff)
ARM: OMAP: Fix DMA channel irq handling for omap24xx
- DMA CSR register is cleared by reading on omap1, but on omap2 it is cleard by writing to it. - DMA TOUT interrupt does not exist on omap24xx, rename it - Add SECURE and MISALIGNED errors by default for omap24xx - Add defines for external DMA request lines Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/plat-omap/dma.c37
-rw-r--r--drivers/mmc/omap.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c2
-rw-r--r--include/asm-arm/arch-omap/dma.h11
4 files changed, 31 insertions, 21 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 8e7c33656b5..c5d0214ef19 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -43,6 +43,7 @@
43 43
44#define OMAP_DMA_ACTIVE 0x01 44#define OMAP_DMA_ACTIVE 0x01
45#define OMAP_DMA_CCR_EN (1 << 7) 45#define OMAP_DMA_CCR_EN (1 << 7)
46#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe
46 47
47#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) 48#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec)
48 49
@@ -409,8 +410,11 @@ static inline void omap_enable_channel_irq(int lch)
409{ 410{
410 u32 status; 411 u32 status;
411 412
412 /* Read CSR to make sure it's cleared. */ 413 /* Clear CSR */
413 status = OMAP_DMA_CSR_REG(lch); 414 if (cpu_class_is_omap1())
415 status = OMAP_DMA_CSR_REG(lch);
416 else if (cpu_is_omap24xx())
417 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK;
414 418
415 /* Enable some nice interrupts. */ 419 /* Enable some nice interrupts. */
416 OMAP_DMA_CICR_REG(lch) = dma_chan[lch].enabled_irqs; 420 OMAP_DMA_CICR_REG(lch) = dma_chan[lch].enabled_irqs;
@@ -509,11 +513,13 @@ int omap_request_dma(int dev_id, const char *dev_name,
509 chan->dev_name = dev_name; 513 chan->dev_name = dev_name;
510 chan->callback = callback; 514 chan->callback = callback;
511 chan->data = data; 515 chan->data = data;
512 chan->enabled_irqs = OMAP_DMA_TOUT_IRQ | OMAP_DMA_DROP_IRQ | 516 chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
513 OMAP_DMA_BLOCK_IRQ;
514 517
515 if (cpu_is_omap24xx()) 518 if (cpu_class_is_omap1())
516 chan->enabled_irqs |= OMAP2_DMA_TRANS_ERR_IRQ; 519 chan->enabled_irqs |= OMAP1_DMA_TOUT_IRQ;
520 else if (cpu_is_omap24xx())
521 chan->enabled_irqs |= OMAP2_DMA_MISALIGNED_ERR_IRQ |
522 OMAP2_DMA_TRANS_ERR_IRQ;
517 523
518 if (cpu_is_omap16xx()) { 524 if (cpu_is_omap16xx()) {
519 /* If the sync device is set, configure it dynamically. */ 525 /* If the sync device is set, configure it dynamically. */
@@ -533,7 +539,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
533 539
534 omap_enable_channel_irq(free_ch); 540 omap_enable_channel_irq(free_ch);
535 /* Clear the CSR register and IRQ status register */ 541 /* Clear the CSR register and IRQ status register */
536 OMAP_DMA_CSR_REG(free_ch) = 0x0; 542 OMAP_DMA_CSR_REG(free_ch) = OMAP2_DMA_CSR_CLEAR_MASK;
537 omap_writel(~0x0, OMAP_DMA4_IRQSTATUS_L0); 543 omap_writel(~0x0, OMAP_DMA4_IRQSTATUS_L0);
538 } 544 }
539 545
@@ -573,7 +579,7 @@ void omap_free_dma(int lch)
573 omap_writel(val, OMAP_DMA4_IRQENABLE_L0); 579 omap_writel(val, OMAP_DMA4_IRQENABLE_L0);
574 580
575 /* Clear the CSR register and IRQ status register */ 581 /* Clear the CSR register and IRQ status register */
576 OMAP_DMA_CSR_REG(lch) = 0x0; 582 OMAP_DMA_CSR_REG(lch) = OMAP2_DMA_CSR_CLEAR_MASK;
577 583
578 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0); 584 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
579 val |= 1 << lch; 585 val |= 1 << lch;
@@ -837,7 +843,7 @@ static int omap1_dma_handle_ch(int ch)
837 "%d (CSR %04x)\n", ch, csr); 843 "%d (CSR %04x)\n", ch, csr);
838 return 0; 844 return 0;
839 } 845 }
840 if (unlikely(csr & OMAP_DMA_TOUT_IRQ)) 846 if (unlikely(csr & OMAP1_DMA_TOUT_IRQ))
841 printk(KERN_WARNING "DMA timeout with device %d\n", 847 printk(KERN_WARNING "DMA timeout with device %d\n",
842 dma_chan[ch].dev_id); 848 dma_chan[ch].dev_id);
843 if (unlikely(csr & OMAP_DMA_DROP_IRQ)) 849 if (unlikely(csr & OMAP_DMA_DROP_IRQ))
@@ -885,20 +891,21 @@ static int omap2_dma_handle_ch(int ch)
885 return 0; 891 return 0;
886 if (unlikely(dma_chan[ch].dev_id == -1)) 892 if (unlikely(dma_chan[ch].dev_id == -1))
887 return 0; 893 return 0;
888 /* REVISIT: According to 24xx TRM, there's no TOUT_IE */
889 if (unlikely(status & OMAP_DMA_TOUT_IRQ))
890 printk(KERN_INFO "DMA timeout with device %d\n",
891 dma_chan[ch].dev_id);
892 if (unlikely(status & OMAP_DMA_DROP_IRQ)) 894 if (unlikely(status & OMAP_DMA_DROP_IRQ))
893 printk(KERN_INFO 895 printk(KERN_INFO
894 "DMA synchronization event drop occurred with device " 896 "DMA synchronization event drop occurred with device "
895 "%d\n", dma_chan[ch].dev_id); 897 "%d\n", dma_chan[ch].dev_id);
896
897 if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ)) 898 if (unlikely(status & OMAP2_DMA_TRANS_ERR_IRQ))
898 printk(KERN_INFO "DMA transaction error with device %d\n", 899 printk(KERN_INFO "DMA transaction error with device %d\n",
899 dma_chan[ch].dev_id); 900 dma_chan[ch].dev_id);
901 if (unlikely(status & OMAP2_DMA_SECURE_ERR_IRQ))
902 printk(KERN_INFO "DMA secure error with device %d\n",
903 dma_chan[ch].dev_id);
904 if (unlikely(status & OMAP2_DMA_MISALIGNED_ERR_IRQ))
905 printk(KERN_INFO "DMA misaligned error with device %d\n",
906 dma_chan[ch].dev_id);
900 907
901 OMAP_DMA_CSR_REG(ch) = 0x20; 908 OMAP_DMA_CSR_REG(ch) = OMAP2_DMA_CSR_CLEAR_MASK;
902 909
903 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0); 910 val = omap_readl(OMAP_DMA4_IRQSTATUS_L0);
904 /* ch in this function is from 0-31 while in register it is 1-32 */ 911 /* ch in this function is from 0-31 while in register it is 1-32 */
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c
index c25244b3657..4aa1e56235c 100644
--- a/drivers/mmc/omap.c
+++ b/drivers/mmc/omap.c
@@ -663,7 +663,7 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
663 return; 663 return;
664 } 664 }
665 /* FIXME: We really should do something to _handle_ the errors */ 665 /* FIXME: We really should do something to _handle_ the errors */
666 if (ch_status & OMAP_DMA_TOUT_IRQ) { 666 if (ch_status & OMAP1_DMA_TOUT_IRQ) {
667 dev_err(mmc_dev(host->mmc),"DMA timeout\n"); 667 dev_err(mmc_dev(host->mmc),"DMA timeout\n");
668 return; 668 return;
669 } 669 }
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index fbea5144890..36336486c88 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -773,7 +773,7 @@ static void dma_error(int lch, u16 ch_status, void *data)
773 struct omap_ep *ep = data; 773 struct omap_ep *ep = data;
774 774
775 /* if ch_status & OMAP_DMA_DROP_IRQ ... */ 775 /* if ch_status & OMAP_DMA_DROP_IRQ ... */
776 /* if ch_status & OMAP_DMA_TOUT_IRQ ... */ 776 /* if ch_status & OMAP1_DMA_TOUT_IRQ ... */
777 ERR("%s dma error, lch %d status %02x\n", ep->ep.name, lch, ch_status); 777 ERR("%s dma error, lch %d status %02x\n", ep->ep.name, lch, ch_status);
778 778
779 /* complete current transfer ... */ 779 /* complete current transfer ... */
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index e081400b658..1b1b02307e7 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -185,8 +185,8 @@
185/* DMA channels for 24xx */ 185/* DMA channels for 24xx */
186#define OMAP24XX_DMA_NO_DEVICE 0 186#define OMAP24XX_DMA_NO_DEVICE 0
187#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */ 187#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
188#define OMAP24XX_DMA_EXT_NDMA_REQ0 2 /* S_DMA_1 */ 188#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
189#define OMAP24XX_DMA_EXT_NDMA_REQ1 3 /* S_DMA_2 */ 189#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
190#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ 190#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
191#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */ 191#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
192#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */ 192#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
@@ -197,7 +197,9 @@
197#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */ 197#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
198#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */ 198#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
199#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */ 199#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
200 200#define OMAP24XX_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
201#define OMAP24XX_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
202#define OMAP24XX_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
201#define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */ 203#define OMAP24XX_DMA_EAC_AC_RD 17 /* S_DMA_16 */
202#define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */ 204#define OMAP24XX_DMA_EAC_AC_WR 18 /* S_DMA_17 */
203#define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */ 205#define OMAP24XX_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
@@ -244,6 +246,7 @@
244#define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */ 246#define OMAP24XX_DMA_MMC1_TX 61 /* SDMA_60 */
245#define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */ 247#define OMAP24XX_DMA_MMC1_RX 62 /* SDMA_61 */
246#define OMAP24XX_DMA_MS 63 /* SDMA_62 */ 248#define OMAP24XX_DMA_MS 63 /* SDMA_62 */
249#define OMAP24XX_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
247 250
248/*----------------------------------------------------------------------------*/ 251/*----------------------------------------------------------------------------*/
249 252
@@ -274,7 +277,7 @@
274#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea) 277#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
275#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4) 278#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
276 279
277#define OMAP_DMA_TOUT_IRQ (1 << 0) /* Only on omap1 */ 280#define OMAP1_DMA_TOUT_IRQ (1 << 0)
278#define OMAP_DMA_DROP_IRQ (1 << 1) 281#define OMAP_DMA_DROP_IRQ (1 << 1)
279#define OMAP_DMA_HALF_IRQ (1 << 2) 282#define OMAP_DMA_HALF_IRQ (1 << 2)
280#define OMAP_DMA_FRAME_IRQ (1 << 3) 283#define OMAP_DMA_FRAME_IRQ (1 << 3)