diff options
Diffstat (limited to 'arch/arm/kernel/dma-a5k.c')
-rw-r--r-- | arch/arm/kernel/dma-a5k.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/arch/arm/kernel/dma-a5k.c b/arch/arm/kernel/dma-a5k.c index f722809fa..50ee42435 100644 --- a/arch/arm/kernel/dma-a5k.c +++ b/arch/arm/kernel/dma-a5k.c @@ -9,14 +9,18 @@ #include <linux/init.h> #include <asm/dma.h> +#include <asm/fiq.h> #include <asm/io.h> #include <asm/hardware.h> +#include <asm/pgtable.h> #include "dma.h" -int arch_request_dma(dmach_t channel, dma_t *dma) +static struct fiq_handler fh = { "floppydma", NULL }; + +int arch_request_dma(dmach_t channel, dma_t *dma, const char *dev_id) { - if (channel == DMA_VIRTUAL_FLOPPY0) + if (channel == DMA_VIRTUAL_FLOPPY) return 0; else return -EINVAL; @@ -24,14 +28,14 @@ int arch_request_dma(dmach_t channel, dma_t *dma) void arch_free_dma(dmach_t channel, dma_t *dma) { - if (channel != DMA_VIRTUAL_FLOPPY0) - printk ("arch_free_dma: invalid channel %d\n", channel); + if (channel != DMA_VIRTUAL_FLOPPY) + printk("arch_free_dma: invalid channel %d\n", channel); } int arch_get_dma_residue(dmach_t channel, dma_t *dma) { - if (channel != DMA_VIRTUAL_FLOPPY0) - printk ("arch_dma_count: invalid channel %d\n", dmanr); + if (channel != DMA_VIRTUAL_FLOPPY) + printk("arch_dma_count: invalid channel %d\n", channel); else { extern int floppy_fiqresidual(void); return floppy_fiqresidual(); @@ -41,12 +45,12 @@ int arch_get_dma_residue(dmach_t channel, dma_t *dma) void arch_enable_dma(dmach_t channel, dma_t *dma) { - if (channel != DMA_VIRTUAL_FLOPPY0) - printk ("arch_enable_dma: invalid channel %d\n", channel); + if (channel != DMA_VIRTUAL_FLOPPY) + printk("arch_enable_dma: invalid channel %d\n", channel); else { void *fiqhandler_start; unsigned int fiqhandler_length; - extern void floppy_fiqsetup (unsigned long len, unsigned long addr, + extern void floppy_fiqsetup(unsigned long len, unsigned long addr, unsigned long port); if (dma->dma_mode == DMA_MODE_READ) { @@ -58,22 +62,28 @@ void arch_enable_dma(dmach_t channel, dma_t *dma) fiqhandler_start = &floppy_fiqout_start; fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start; } - memcpy ((void *)0x1c, fiqhandler_start, fiqhandler_length); + if (claim_fiq(&fh)) { + printk("floppydma: couldn't claim FIQ.\n"); + return; + } + memcpy((void *)0x1c, fiqhandler_start, fiqhandler_length); flush_page_to_ram(0); - floppy_fiqsetup (dma->buf.length, __bus_to_virt(dma->buf.address), (int)PCIO_FLOPPYDMABASE); - enable_irq (dma->dma_irq); + floppy_fiqsetup(dma->buf.length, __bus_to_virt(dma->buf.address), (int)PCIO_FLOPPYDMABASE); + enable_irq(dma->dma_irq); } } void arch_disable_dma(dmach_t channel, dma_t *dma) { - if (channel != DMA_VIRTUAL_FLOPPY0) - printk ("arch_disable_dma: invalid channel %d\n", channel); - else - disable_irq (dma->dma_irq); + if (channel != DMA_VIRTUAL_FLOPPY) + printk("arch_disable_dma: invalid channel %d\n", channel); + else { + disable_irq(dma->dma_irq); + release_fiq(&fh); + } } __initfunc(void arch_dma_init(dma_t *dma)) { - dma[DMA_VIRTUAL_FLOPPY0].dma_irq = 64; + dma[DMA_VIRTUAL_FLOPPY].dma_irq = 64; } |