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.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 0eb676d7e807..68eaae324b6a 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -691,13 +691,16 @@ static inline void disable_lnk(int lch)
691static inline void omap2_enable_irq_lch(int lch) 691static inline void omap2_enable_irq_lch(int lch)
692{ 692{
693 u32 val; 693 u32 val;
694 unsigned long flags;
694 695
695 if (!cpu_class_is_omap2()) 696 if (!cpu_class_is_omap2())
696 return; 697 return;
697 698
699 spin_lock_irqsave(&dma_chan_lock, flags);
698 val = dma_read(IRQENABLE_L0); 700 val = dma_read(IRQENABLE_L0);
699 val |= 1 << lch; 701 val |= 1 << lch;
700 dma_write(val, IRQENABLE_L0); 702 dma_write(val, IRQENABLE_L0);
703 spin_unlock_irqrestore(&dma_chan_lock, flags);
701} 704}
702 705
703int omap_request_dma(int dev_id, const char *dev_name, 706int omap_request_dma(int dev_id, const char *dev_name,
@@ -799,10 +802,13 @@ void omap_free_dma(int lch)
799 802
800 if (cpu_class_is_omap2()) { 803 if (cpu_class_is_omap2()) {
801 u32 val; 804 u32 val;
805
806 spin_lock_irqsave(&dma_chan_lock, flags);
802 /* Disable interrupts */ 807 /* Disable interrupts */
803 val = dma_read(IRQENABLE_L0); 808 val = dma_read(IRQENABLE_L0);
804 val &= ~(1 << lch); 809 val &= ~(1 << lch);
805 dma_write(val, IRQENABLE_L0); 810 dma_write(val, IRQENABLE_L0);
811 spin_unlock_irqrestore(&dma_chan_lock, flags);
806 812
807 /* Clear the CSR register and IRQ status register */ 813 /* Clear the CSR register and IRQ status register */
808 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch)); 814 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
@@ -978,6 +984,14 @@ void omap_stop_dma(int lch)
978{ 984{
979 u32 l; 985 u32 l;
980 986
987 /* Disable all interrupts on the channel */
988 if (cpu_class_is_omap1())
989 dma_write(0, CICR(lch));
990
991 l = dma_read(CCR(lch));
992 l &= ~OMAP_DMA_CCR_EN;
993 dma_write(l, CCR(lch));
994
981 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 995 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
982 int next_lch, cur_lch = lch; 996 int next_lch, cur_lch = lch;
983 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT]; 997 char dma_chan_link_map[OMAP_DMA4_LOGICAL_DMA_CH_COUNT];
@@ -995,18 +1009,8 @@ void omap_stop_dma(int lch)
995 next_lch = dma_chan[cur_lch].next_lch; 1009 next_lch = dma_chan[cur_lch].next_lch;
996 cur_lch = next_lch; 1010 cur_lch = next_lch;
997 } while (next_lch != -1); 1011 } while (next_lch != -1);
998
999 return;
1000 } 1012 }
1001 1013
1002 /* Disable all interrupts on the channel */
1003 if (cpu_class_is_omap1())
1004 dma_write(0, CICR(lch));
1005
1006 l = dma_read(CCR(lch));
1007 l &= ~OMAP_DMA_CCR_EN;
1008 dma_write(l, CCR(lch));
1009
1010 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; 1014 dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
1011} 1015}
1012EXPORT_SYMBOL(omap_stop_dma); 1016EXPORT_SYMBOL(omap_stop_dma);
@@ -1110,6 +1114,14 @@ int omap_dma_running(void)
1110{ 1114{
1111 int lch; 1115 int lch;
1112 1116
1117 /*
1118 * On OMAP1510, internal LCD controller will start the transfer
1119 * when it gets enabled, so assume DMA running if LCD enabled.
1120 */
1121 if (cpu_is_omap1510())
1122 if (omap_readw(0xfffec000 + 0x00) & (1 << 0))
1123 return 1;
1124
1113 /* Check if LCD DMA is running */ 1125 /* Check if LCD DMA is running */
1114 if (cpu_is_omap16xx()) 1126 if (cpu_is_omap16xx())
1115 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN) 1127 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)