Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Fix Dreamcast DMA issues.

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>

authored by

Adrian McMenamin and committed by
Paul Mundt
eb695dbf 8cf1a743

+6 -4
+4 -3
arch/sh/drivers/dma/dma-api.c
··· 31 31 * the channel is. 32 32 */ 33 33 list_for_each_entry(info, &registered_dmac_list, list) { 34 - if ((chan < info->first_channel_nr) || 35 - (chan >= info->first_channel_nr + info->nr_channels)) 34 + if ((chan < info->first_vchannel_nr) || 35 + (chan >= info->first_vchannel_nr + info->nr_channels)) 36 36 continue; 37 37 38 38 return info; ··· 82 82 83 83 for (i = 0; i < info->nr_channels; i++) { 84 84 channel = &info->channels[i]; 85 - if (channel->chan == chan) 85 + if (channel->vchan == chan) 86 86 return channel; 87 87 } 88 88 ··· 369 369 } 370 370 371 371 total_channels = get_nr_channels(); 372 + info->first_vchannel_nr = total_channels; 372 373 for (i = 0; i < info->nr_channels; i++) { 373 374 struct dma_channel *chan = &info->channels[i]; 374 375
+1
include/asm-sh/dma.h
··· 111 111 112 112 struct list_head list; 113 113 int first_channel_nr; 114 + int first_vchannel_nr; 114 115 }; 115 116 116 117 struct dma_chan_caps {
+1 -1
sound/sh/aica.h
··· 52 52 #define AICA_CHANNEL1_OFFSET 0x21000 53 53 #define CHANNEL_OFFSET 0x10000 54 54 55 - #define AICA_DMA_CHANNEL 0 55 + #define AICA_DMA_CHANNEL 5 56 56 #define AICA_DMA_MODE 5 57 57 58 58 #define SND_AICA_DRIVER "AICA"