aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/dma.c')
-rw-r--r--arch/arm/plat-omap/dma.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 1d959965ff52..f7f571e7987e 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -501,7 +501,8 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
501 burst = 0x2; 501 burst = 0x2;
502 break; 502 break;
503 } 503 }
504 /* not supported by current hardware on OMAP1 504 /*
505 * not supported by current hardware on OMAP1
505 * w |= (0x03 << 7); 506 * w |= (0x03 << 7);
506 * fall through 507 * fall through
507 */ 508 */
@@ -510,7 +511,8 @@ void omap_set_dma_src_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
510 burst = 0x3; 511 burst = 0x3;
511 break; 512 break;
512 } 513 }
513 /* OMAP1 don't support burst 16 514 /*
515 * OMAP1 don't support burst 16
514 * fall through 516 * fall through
515 */ 517 */
516 default: 518 default:
@@ -604,7 +606,8 @@ void omap_set_dma_dest_burst_mode(int lch, enum omap_dma_burst_mode burst_mode)
604 burst = 0x3; 606 burst = 0x3;
605 break; 607 break;
606 } 608 }
607 /* OMAP1 don't support burst 16 609 /*
610 * OMAP1 don't support burst 16
608 * fall through 611 * fall through
609 */ 612 */
610 default: 613 default:
@@ -709,6 +712,21 @@ static inline void omap2_enable_irq_lch(int lch)
709 spin_unlock_irqrestore(&dma_chan_lock, flags); 712 spin_unlock_irqrestore(&dma_chan_lock, flags);
710} 713}
711 714
715static inline void omap2_disable_irq_lch(int lch)
716{
717 u32 val;
718 unsigned long flags;
719
720 if (!cpu_class_is_omap2())
721 return;
722
723 spin_lock_irqsave(&dma_chan_lock, flags);
724 val = dma_read(IRQENABLE_L0);
725 val &= ~(1 << lch);
726 dma_write(val, IRQENABLE_L0);
727 spin_unlock_irqrestore(&dma_chan_lock, flags);
728}
729
712int omap_request_dma(int dev_id, const char *dev_name, 730int omap_request_dma(int dev_id, const char *dev_name,
713 void (*callback)(int lch, u16 ch_status, void *data), 731 void (*callback)(int lch, u16 ch_status, void *data),
714 void *data, int *dma_ch_out) 732 void *data, int *dma_ch_out)
@@ -807,14 +825,7 @@ void omap_free_dma(int lch)
807 } 825 }
808 826
809 if (cpu_class_is_omap2()) { 827 if (cpu_class_is_omap2()) {
810 u32 val; 828 omap2_disable_irq_lch(lch);
811
812 spin_lock_irqsave(&dma_chan_lock, flags);
813 /* Disable interrupts */
814 val = dma_read(IRQENABLE_L0);
815 val &= ~(1 << lch);
816 dma_write(val, IRQENABLE_L0);
817 spin_unlock_irqrestore(&dma_chan_lock, flags);
818 829
819 /* Clear the CSR register and IRQ status register */ 830 /* Clear the CSR register and IRQ status register */
820 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch)); 831 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
@@ -1277,8 +1288,10 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
1277 return -EINVAL; 1288 return -EINVAL;
1278 } 1289 }
1279 1290
1280 /* Allocate a queue to maintain the status of the channels 1291 /*
1281 * in the chain */ 1292 * Allocate a queue to maintain the status of the channels
1293 * in the chain
1294 */
1282 channels = kmalloc(sizeof(*channels) * no_of_chans, GFP_KERNEL); 1295 channels = kmalloc(sizeof(*channels) * no_of_chans, GFP_KERNEL);
1283 if (channels == NULL) { 1296 if (channels == NULL) {
1284 printk(KERN_ERR "omap_dma: No memory for channel queue\n"); 1297 printk(KERN_ERR "omap_dma: No memory for channel queue\n");
@@ -1907,7 +1920,8 @@ static int omap2_dma_handle_ch(int ch)
1907 printk(KERN_INFO "DMA transaction error with device %d\n", 1920 printk(KERN_INFO "DMA transaction error with device %d\n",
1908 dma_chan[ch].dev_id); 1921 dma_chan[ch].dev_id);
1909 if (cpu_class_is_omap2()) { 1922 if (cpu_class_is_omap2()) {
1910 /* Errata: sDMA Channel is not disabled 1923 /*
1924 * Errata: sDMA Channel is not disabled
1911 * after a transaction error. So we explicitely 1925 * after a transaction error. So we explicitely
1912 * disable the channel 1926 * disable the channel
1913 */ 1927 */
@@ -2107,6 +2121,9 @@ static int __init omap_init_dma(void)
2107 2121
2108 for (ch = 0; ch < dma_chan_count; ch++) { 2122 for (ch = 0; ch < dma_chan_count; ch++) {
2109 omap_clear_dma(ch); 2123 omap_clear_dma(ch);
2124 if (cpu_class_is_omap2())
2125 omap2_disable_irq_lch(ch);
2126
2110 dma_chan[ch].dev_id = -1; 2127 dma_chan[ch].dev_id = -1;
2111 dma_chan[ch].next_lch = -1; 2128 dma_chan[ch].next_lch = -1;
2112 2129