aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/dma.c
diff options
context:
space:
mode:
authorMika Westerberg <ext-mika.1.westerberg@nokia.com>2010-05-14 15:05:25 -0400
committerTony Lindgren <tony@atomide.com>2010-05-20 14:16:39 -0400
commitada8d4a5e2ed9de8a5a58788c4b6a4c8103e0f8d (patch)
treef7cc3f4ff489b2536c6b038b52122e9413f906e7 /arch/arm/plat-omap/dma.c
parentad57c39482a91cc7e377b0356d130810a78167fd (diff)
OMAP2/3/4: DMA: disable channel interrupts in omap_init_dma()
If we are softbooting another kernel using kexec, DMA controller state is not known when we are performing omap_init_dma(). It is possible that some DMA channels are already active. For example after kexec we get: <4>IRQ 0020 for non-allocated DMAchannel 5 <4>IRQ 0020 for non-allocated DMAchannel 5 <4>IRQ 0020 for non-allocated DMAchannel 5 <4>IRQ 0020 for non-allocated DMAchannel 5 <4>IRQ 0020 for non-allocated DMAchannel 5 To prevent any weird things happening, we disable all channel interrupts during init. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/dma.c')
-rw-r--r--arch/arm/plat-omap/dma.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 1d959965ff52..ad42ec3592e5 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -709,6 +709,21 @@ static inline void omap2_enable_irq_lch(int lch)
709 spin_unlock_irqrestore(&dma_chan_lock, flags); 709 spin_unlock_irqrestore(&dma_chan_lock, flags);
710} 710}
711 711
712static inline void omap2_disable_irq_lch(int lch)
713{
714 u32 val;
715 unsigned long flags;
716
717 if (!cpu_class_is_omap2())
718 return;
719
720 spin_lock_irqsave(&dma_chan_lock, flags);
721 val = dma_read(IRQENABLE_L0);
722 val &= ~(1 << lch);
723 dma_write(val, IRQENABLE_L0);
724 spin_unlock_irqrestore(&dma_chan_lock, flags);
725}
726
712int omap_request_dma(int dev_id, const char *dev_name, 727int omap_request_dma(int dev_id, const char *dev_name,
713 void (*callback)(int lch, u16 ch_status, void *data), 728 void (*callback)(int lch, u16 ch_status, void *data),
714 void *data, int *dma_ch_out) 729 void *data, int *dma_ch_out)
@@ -807,14 +822,7 @@ void omap_free_dma(int lch)
807 } 822 }
808 823
809 if (cpu_class_is_omap2()) { 824 if (cpu_class_is_omap2()) {
810 u32 val; 825 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 826
819 /* Clear the CSR register and IRQ status register */ 827 /* Clear the CSR register and IRQ status register */
820 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch)); 828 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(lch));
@@ -2107,6 +2115,9 @@ static int __init omap_init_dma(void)
2107 2115
2108 for (ch = 0; ch < dma_chan_count; ch++) { 2116 for (ch = 0; ch < dma_chan_count; ch++) {
2109 omap_clear_dma(ch); 2117 omap_clear_dma(ch);
2118 if (cpu_class_is_omap2())
2119 omap2_disable_irq_lch(ch);
2120
2110 dma_chan[ch].dev_id = -1; 2121 dma_chan[ch].dev_id = -1;
2111 dma_chan[ch].next_lch = -1; 2122 dma_chan[ch].next_lch = -1;
2112 2123