[PATCH] Patch Dreamcast AICA driver to handle Maple bus support

From: Adrian McMenamin
Date: Sun Sep 09 2007 - 16:22:29 EST


This patches the AICA sound driver for the Dreamcast to handle the
well known flakiness of the Dreamcast's G2 bus.

This is dependent on getting Maple bus support (see
http://lkml.org/lkml/2007/9/9/70) into the kernel.

Signed-off by: Adrian McMenamin <adrian@xxxxxxxxxxxxxxxxx>

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 7397865..a42c58f 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -35,6 +35,7 @@
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
+#include <linux/maple.h>
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/control.h>
@@ -43,7 +44,7 @@
#include <sound/info.h>
#include <asm/io.h>
#include <asm/dma.h>
-#include <asm/dreamcast/sysasic.h>
+#include <asm/mach/sysasic.h>
#include "aica.h"

MODULE_AUTHOR("Adrian McMenamin <adrian@xxxxxxxxxxxxxxxxx>");
@@ -218,6 +219,12 @@ static int aica_dma_transfer(int channels, int buffer_size,
period_offset = dreamcastcard->clicks;
period_offset %= (AICA_PERIOD_NUMBER / channels);
runtime = substream->runtime;
+ /* If maple dma is running, wait for it to finish */
+ do{ cpu_relax();}
+ while (!maple_dma_done());
+ /* Turn off the maple dma now */
+ ctrl_outl(0, MAPLE_ENABLE);
+ local_irq_disable();
for (q = 0; q < channels; q++) {
err = dma_xfer(AICA_DMA_CHANNEL,
(unsigned long) (runtime->dma_area +
@@ -232,6 +239,9 @@ static int aica_dma_transfer(int channels, int buffer_size,
break;
dma_wait_for_completion(AICA_DMA_CHANNEL);
}
+ /* restore maple dma */
+ local_irq_enable();
+ maplebus_init_hardware();
return err;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/