Merge branch 'common/dma' into sh-latest
[pandora-kernel.git] / drivers / dma / shdma.c
index 6a21cd8..7f49235 100644 (file)
@@ -194,6 +194,9 @@ static void dmae_start(struct sh_dmae_chan *sh_chan)
        struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
        u32 chcr = chcr_read(sh_chan);
 
+       if (shdev->pdata->needs_tend_set)
+               sh_dmae_writel(sh_chan, 0xFFFFFFFF, TEND);
+
        chcr |= CHCR_DE | shdev->chcr_ie_bit;
        chcr_write(sh_chan, chcr & ~CHCR_TE);
 }
@@ -242,6 +245,9 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
        if (dmae_is_busy(sh_chan))
                return -EBUSY;
 
+       if (pdata->no_dmars)
+               return 0;
+
        /* in the case of a missing DMARS resource use first memory window */
        if (!addr)
                addr = (u16 __iomem *)shdev->chan_reg;
@@ -1251,6 +1257,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
        } else {
                do {
                        for (i = chanirq_res->start; i <= chanirq_res->end; i++) {
+                               if (irq_cnt >= SH_DMAC_MAX_CHANNELS) {
+                                       irq_cap = 1;
+                                       break;
+                               }
+
                                if ((errirq_res->flags & IORESOURCE_BITS) ==
                                    IORESOURCE_IRQ_SHAREABLE)
                                        chan_flag[irq_cnt] = IRQF_SHARED;
@@ -1260,15 +1271,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
                                        "Found IRQ %d for channel %d\n",
                                        i, irq_cnt);
                                chan_irq[irq_cnt++] = i;
-
-                               if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
-                                       break;
                        }
 
-                       if (irq_cnt >= SH_DMAC_MAX_CHANNELS) {
-                               irq_cap = 1;
+                       if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
                                break;
-                       }
+
                        chanirq_res = platform_get_resource(pdev,
                                                IORESOURCE_IRQ, ++irqres);
                } while (irq_cnt < pdata->channel_num && chanirq_res);