Skip to content

Commit

Permalink
sh: Fix Dreamcast DMA issues.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Paul Mundt <[email protected]>
  • Loading branch information
Adrian McMenamin authored and pmundt committed Jul 24, 2007
1 parent 8cf1a74 commit eb695db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions arch/sh/drivers/dma/dma-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];

Expand Down
1 change: 1 addition & 0 deletions include/asm-sh/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct dma_info {

struct list_head list;
int first_channel_nr;
int first_vchannel_nr;
};

struct dma_chan_caps {
Expand Down
2 changes: 1 addition & 1 deletion sound/sh/aica.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit eb695db

Please sign in to comment.