]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/plat-omap/dma.c
OMAP: MMU: Fix inconsistency to unregister device MMU
[linux-2.6-omap-h63xx.git] / arch / arm / plat-omap / dma.c
index a3c5d4fe8e1e0e1b46730392a023276c796624f0..c00eda588cd81b2ad87d51646a27b7ffcd577549 100644 (file)
 
 #include <asm/arch/tc.h>
 
-#define DEBUG_PRINTS
-#undef DEBUG_PRINTS
-#ifdef DEBUG_PRINTS
-#define debug_printk(x) printk x
-#else
-#define        debug_printk(x)
-#endif
+#undef DEBUG
 
 #ifndef CONFIG_ARCH_OMAP1
 enum { DMA_CH_ALLOC_DONE, DMA_CH_PARAMS_SET_DONE, DMA_CH_STARTED,
@@ -143,7 +137,7 @@ static void omap_disable_channel_irq(int lch);
 static inline void omap_enable_channel_irq(int lch);
 
 #define REVISIT_24XX()         printk(KERN_ERR "FIXME: no %s on 24xx\n", \
-                                               __FUNCTION__);
+                                               __func__);
 
 #ifdef CONFIG_ARCH_OMAP15XX
 /* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
@@ -610,6 +604,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
        chan->data = data;
 #ifndef CONFIG_ARCH_OMAP1
        chan->chain_id = -1;
+       chan->next_linked_ch = -1;
 #endif
        chan->enabled_irqs = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
 
@@ -705,7 +700,7 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams)
        u32 reg;
 
        if (!cpu_class_is_omap2()) {
-               printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __FUNCTION__);
+               printk(KERN_ERR "FIXME: no %s on 15xx/16xx\n", __func__);
                return;
        }
 
@@ -1026,12 +1021,12 @@ static void create_dma_lch_chain(int lch_head, int lch_queue)
        }
 
        w = OMAP_DMA_CLNK_CTRL_REG(lch_head);
-       w &= ~(0x0f);
-       w |= lch_queue ;
+       w &= ~(0x1f);
+       w |= lch_queue;
        OMAP_DMA_CLNK_CTRL_REG(lch_head) = w;
 
        w = OMAP_DMA_CLNK_CTRL_REG(lch_queue);
-       w &= ~(0x0f);
+       w &= ~(0x1f);
        w |= (dma_chan[lch_queue].next_linked_ch);
        OMAP_DMA_CLNK_CTRL_REG(lch_queue) = w;
 }
@@ -1063,7 +1058,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
        /* Is the chain mode valid ? */
        if (chain_mode != OMAP_DMA_STATIC_CHAIN
                        && chain_mode != OMAP_DMA_DYNAMIC_CHAIN) {
-               printk(KERN_ERR "Invalid chain mode requested \n");
+               printk(KERN_ERR "Invalid chain mode requested\n");
                return -EINVAL;
        }
 
@@ -1075,7 +1070,7 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
 
        /* Allocate a queue to maintain the status of the channels
         * in the chain */
-       channels = (int *)kmalloc(sizeof(*channels) * no_of_chans, GFP_KERNEL);
+       channels = kmalloc(sizeof(*channels) * no_of_chans, GFP_KERNEL);
        if (channels == NULL) {
                printk(KERN_ERR "omap_dma: No memory for channel queue\n");
                return -ENOMEM;
@@ -1093,7 +1088,6 @@ int omap_request_dma_chain(int dev_id, const char *dev_name,
                        printk(KERN_ERR "omap_dma: Request failed %d\n", err);
                        return err;
                }
-               dma_chan[channels[i]].next_linked_ch = -1;
                dma_chan[channels[i]].prev_linked_ch = -1;
                dma_chan[channels[i]].state = DMA_CH_NOTSTARTED;
 
@@ -1234,8 +1228,8 @@ int omap_dma_chain_status(int chain_id)
                printk(KERN_ERR "Chain doesn't exists\n");
                return -EINVAL;
        }
-       debug_printk((KERN_INFO "CHAINID=%d, qcnt=%d\n", chain_id,
-                     dma_linked_lch[chain_id].q_count));
+       pr_debug("CHAINID=%d, qcnt=%d\n", chain_id,
+                       dma_linked_lch[chain_id].q_count);
 
        if (OMAP_DMA_CHAIN_QEMPTY(chain_id))
                return OMAP_DMA_CHAIN_INACTIVE;
@@ -1254,7 +1248,7 @@ EXPORT_SYMBOL(omap_dma_chain_status);
  * @param frame_count
  * @param callbk_data - channel callback parameter data.
  *
- * @return  - Success : start_dma status
+ * @return  - Success : 0
  *           Failure: -EINVAL/-EBUSY
  */
 int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
@@ -1339,8 +1333,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
                                        (dma_chan[lch].prev_linked_ch)))) {
                                        disable_lnk(dma_chan[lch].
                                                    prev_linked_ch);
-                                       debug_printk((KERN_INFO
-                                               "\n prev ch is stopped\n"));
+                                       pr_debug("\n prev ch is stopped\n");
                                        start_dma = 1;
                                }
                        }
@@ -1363,8 +1356,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
                                if (0 == (w & (1 << 7))) {
                                        w |= (1 << 7);
                                        dma_chan[lch].state = DMA_CH_STARTED;
-                                       debug_printk((KERN_INFO
-                                               "starting %d\n", lch));
+                                       pr_debug("starting %d\n", lch);
                                        OMAP_DMA_CCR_REG(lch) = w;
                                } else
                                        start_dma = 0;
@@ -1375,7 +1367,7 @@ int omap_dma_chain_a_transfer(int chain_id, int src_start, int dest_start,
                        dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
                }
        }
-       return start_dma;
+       return 0;
 }
 EXPORT_SYMBOL(omap_dma_chain_a_transfer);
 
@@ -1400,7 +1392,7 @@ int omap_start_dma_chain_transfers(int chain_id)
        channels = dma_linked_lch[chain_id].linked_dmach_q;
 
        if (dma_linked_lch[channels[0]].chain_state == DMA_CHAIN_STARTED) {
-               printk(KERN_ERR "Chain is already started \n");
+               printk(KERN_ERR "Chain is already started\n");
                return -EBUSY;
        }
 
@@ -1671,6 +1663,7 @@ static int omap2_dma_handle_ch(int ch)
        if (!status) {
                if (printk_ratelimit())
                        printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", ch);
+               omap_writel(1 << ch, OMAP_DMA4_IRQSTATUS_L0);
                return 0;
        }
        if (unlikely(dma_chan[ch].dev_id == -1)) {
@@ -1713,14 +1706,8 @@ static int omap2_dma_handle_ch(int ch)
                status = OMAP_DMA_CSR_REG(ch);
        }
 
-       if (likely(dma_chan[ch].callback != NULL)) {
-               if (dma_chan[ch].chain_id != -1)
-                       dma_chan[ch].callback(dma_chan[ch].chain_id, status,
-                                             dma_chan[ch].data);
-               else
-                       dma_chan[ch].callback(ch, status, dma_chan[ch].data);
-
-       }
+       if (likely(dma_chan[ch].callback != NULL))
+               dma_chan[ch].callback(ch, status, dma_chan[ch].data);
 
        OMAP_DMA_CSR_REG(ch) = status;