]> err.no Git - linux-2.6/commitdiff
sh: Fix Dreamcast DMA issues.
authorAdrian McMenamin <adrian@mcmen.demon.co.uk>
Tue, 24 Jul 2007 04:30:55 +0000 (13:30 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 24 Jul 2007 04:30:55 +0000 (13:30 +0900)
The current SH DMA API is somewhat broken, not correctly matching
virtual channel to the correct SH DMAC. This wasn't noticeable when
using g2 DMA for the sound driver - one channel 0 is as good as any
other! - but caused the pvr2 driver to fail.

This patch fixes the pvr2 problem and consequently fixes the sound
driver to ensure it continues to function.

Signed-off by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/drivers/dma/dma-api.c
include/asm-sh/dma.h
sound/sh/aica.h

index cf8e119943306abd598cd1c761c7ce118891cb14..76ed816d9a24bd56966790f04bc0c74e2361da94 100644 (file)
@@ -31,8 +31,8 @@ struct dma_info *get_dma_info(unsigned int chan)
         * the channel is.
         */
        list_for_each_entry(info, &registered_dmac_list, list) {
-               if ((chan <  info->first_channel_nr) ||
-                   (chan >= info->first_channel_nr + info->nr_channels))
+               if ((chan <  info->first_vchannel_nr) ||
+                   (chan >= info->first_vchannel_nr + info->nr_channels))
                        continue;
 
                return info;
@@ -82,7 +82,7 @@ struct dma_channel *get_dma_channel(unsigned int chan)
 
        for (i = 0; i < info->nr_channels; i++) {
                channel = &info->channels[i];
-               if (channel->chan == chan)
+               if (channel->vchan == chan)
                        return channel;
        }
 
@@ -369,6 +369,7 @@ int register_dmac(struct dma_info *info)
        }
 
        total_channels = get_nr_channels();
+       info->first_vchannel_nr = total_channels;
        for (i = 0; i < info->nr_channels; i++) {
                struct dma_channel *chan = &info->channels[i];
 
index 6034d4a29e73151434597f0ee1fd35d855c0738f..4c75b70b64143be6a1cb7de0234e9633b3e06a95 100644 (file)
@@ -111,6 +111,7 @@ struct dma_info {
 
        struct list_head list;
        int first_channel_nr;
+       int first_vchannel_nr;
 };
 
 struct dma_chan_caps {
index 8c11e3d10a50aa8bc462a51ce43bc6c621f527bf..d098baaa0116c2fc381a5aa5ebe217c74eeceb4a 100644 (file)
@@ -52,7 +52,7 @@
 #define AICA_CHANNEL1_OFFSET 0x21000
 #define CHANNEL_OFFSET 0x10000
 
-#define AICA_DMA_CHANNEL 0
+#define AICA_DMA_CHANNEL 5
 #define AICA_DMA_MODE 5
 
 #define SND_AICA_DRIVER "AICA"