Blackfin arch: push bf561 PERIPHERAL_MAP oddity into bf561-specific code
authorMike Frysinger <vapier.adi@gmail.com>
Wed, 7 Jan 2009 15:14:39 +0000 (23:14 +0800)
committerBryan Wu <cooloney@kernel.org>
Wed, 7 Jan 2009 15:14:39 +0000 (23:14 +0800)
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
arch/blackfin/kernel/bfin_dma_5xx.c
arch/blackfin/mach-bf561/include/mach/dma.h

index 1882fd82879b8c4a4fb9eb9cce09c501177c2cd1..36f78c1648b9037f0a82babfb3216821c1089f1b 100644 (file)
@@ -411,15 +411,14 @@ unsigned long get_dma_curr_addr(unsigned int channel)
 EXPORT_SYMBOL(get_dma_curr_addr);
 
 #ifdef CONFIG_PM
+# ifndef MAX_DMA_SUSPEND_CHANNELS
+#  define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS
+# endif
 int blackfin_dma_suspend(void)
 {
        int i;
 
-#ifdef CONFIG_BF561    /* IMDMA channels doesn't have a PERIPHERAL_MAP */
-       for (i = 0; i <= CH_MEM_STREAM3_SRC; i++) {
-#else
-       for (i = 0; i < MAX_DMA_CHANNELS; i++) {
-#endif
+       for (i = 0; i < MAX_DMA_SUSPEND_CHANNELS; ++i) {
                if (dma_ch[i].chan_status == DMA_CHANNEL_ENABLED) {
                        printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
                        return -EBUSY;
@@ -434,12 +433,7 @@ int blackfin_dma_suspend(void)
 void blackfin_dma_resume(void)
 {
        int i;
-
-#ifdef CONFIG_BF561    /* IMDMA channels doesn't have a PERIPHERAL_MAP */
-       for (i = 0; i <= CH_MEM_STREAM3_SRC; i++)
-#else
-       for (i = 0; i < MAX_DMA_CHANNELS; i++)
-#endif
+       for (i = 0; i < MAX_DMA_SUSPEND_CHANNELS; ++i)
                dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
 }
 #endif
index 2597a09a012c2c37d5dfa43d6a4eda8d40d58ae5..13647c71f1c786cf6d3c76a78604cc69441c66c9 100644 (file)
@@ -10,6 +10,9 @@
 
 #define MAX_DMA_CHANNELS 36
 
+/* [#4267] IMDMA channels have no PERIPHERAL_MAP MMR */
+#define MAX_DMA_SUSPEND_CHANNELS 32
+
 #define CH_PPI0                        0
 #define CH_PPI                 (CH_PPI0)
 #define CH_PPI1                        1