]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/blackfin/kernel/bfin_dma_5xx.c
ARM: S3C2410: H1940: Make h1940-bluetooth.c compile again
[karo-tx-linux.git] / arch / blackfin / kernel / bfin_dma_5xx.c
index 1e485dfdc9f2133a37d1d7d8b81af47b6bf53814..6ce8dce753c9a49039a615e56cf8e83fbb8097bf 100644 (file)
@@ -84,6 +84,24 @@ static int __init proc_dma_init(void)
 late_initcall(proc_dma_init);
 #endif
 
+static void set_dma_peripheral_map(unsigned int channel, const char *device_id)
+{
+#ifdef CONFIG_BF54x
+       unsigned int per_map;
+
+       switch (channel) {
+               case CH_UART2_RX: per_map = 0xC << 12; break;
+               case CH_UART2_TX: per_map = 0xD << 12; break;
+               case CH_UART3_RX: per_map = 0xE << 12; break;
+               case CH_UART3_TX: per_map = 0xF << 12; break;
+               default:          return;
+       }
+
+       if (strncmp(device_id, "BFIN_UART", 9) == 0)
+               dma_ch[channel].regs->peripheral_map = per_map;
+#endif
+}
+
 /**
  *     request_dma - request a DMA channel
  *
@@ -111,19 +129,7 @@ int request_dma(unsigned int channel, const char *device_id)
                return -EBUSY;
        }
 
-#ifdef CONFIG_BF54x
-       if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {
-               unsigned int per_map;
-               per_map = dma_ch[channel].regs->peripheral_map & 0xFFF;
-               if (strncmp(device_id, "BFIN_UART", 9) == 0)
-                       dma_ch[channel].regs->peripheral_map = per_map |
-                               ((channel - CH_UART2_RX + 0xC)<<12);
-               else
-                       dma_ch[channel].regs->peripheral_map = per_map |
-                               ((channel - CH_UART2_RX + 0x6)<<12);
-       }
-#endif
-
+       set_dma_peripheral_map(channel, device_id);
        dma_ch[channel].device_id = device_id;
        dma_ch[channel].irq = 0;