summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-12-08 16:33:30 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-12-11 14:32:43 +0000
commit2f757f2ab7411cf0e2779012d8cda0cbf2f80d26 (patch)
tree880e0c661948132d54ce238eb45cba9bb71314d4 /arch/arm/kernel
parent3afb6e9c635f735c751148beddc195daec0e35ec (diff)
downloadop-kernel-dev-2f757f2ab7411cf0e2779012d8cda0cbf2f80d26.zip
op-kernel-dev-2f757f2ab7411cf0e2779012d8cda0cbf2f80d26.tar.gz
[ARM] dma: rejig DMA initialization
Rather than having the central DMA multiplexer call the architecture specific DMA initialization function, have each architecture DMA initialization function use core_initcall(), and register each DMA channel separately with the multiplexer. This removes the array of dma structures in the central multiplexer, replacing it with an array of pointers instead; this is more flexible since it allows the drivers to wrap the DMA structure (eventually allowing us to transition non-ISA DMA drivers away.) Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/dma-isa.c18
-rw-r--r--arch/arm/kernel/dma.c25
2 files changed, 28 insertions, 15 deletions
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index 29eca48..da02a7f 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -160,7 +160,12 @@ static struct resource dma_resources[] = { {
.end = 0x048f
} };
-void __init isa_init_dma(dma_t *dma)
+static dma_t isa_dma[8];
+
+/*
+ * ISA DMA always starts at channel 0
+ */
+void __init isa_init_dma(void)
{
/*
* Try to autodetect presence of an ISA DMA controller.
@@ -178,10 +183,10 @@ void __init isa_init_dma(dma_t *dma)
outb(0xaa, 0x00);
if (inb(0) == 0x55 && inb(0) == 0xaa) {
- int chan, i;
+ unsigned int chan, i;
for (chan = 0; chan < 8; chan++) {
- dma[chan].d_ops = &isa_dma_ops;
+ isa_dma[chan].d_ops = &isa_dma_ops;
isa_disable_dma(chan, NULL);
}
@@ -217,5 +222,12 @@ void __init isa_init_dma(dma_t *dma)
for (i = 0; i < ARRAY_SIZE(dma_resources); i++)
request_resource(&ioport_resource, dma_resources + i);
+
+ for (chan = 0; chan < 8; chan++) {
+ int ret = isa_dma_add(chan, &isa_dma[chan]);
+ if (ret)
+ printk(KERN_ERR "ISADMA%u: unable to register: %d\n",
+ chan, ret);
+ }
}
}
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 0ffea3f..aab24f0 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -23,16 +23,24 @@
DEFINE_SPINLOCK(dma_spin_lock);
EXPORT_SYMBOL(dma_spin_lock);
-static dma_t dma_chan[MAX_DMA_CHANNELS];
+static dma_t *dma_chan[MAX_DMA_CHANNELS];
static inline dma_t *dma_channel(unsigned int chan)
{
- dma_t *dma = dma_chan + chan;
-
- if (chan >= MAX_DMA_CHANNELS || !dma->d_ops)
+ if (chan >= MAX_DMA_CHANNELS)
return NULL;
- return dma;
+ return dma_chan[chan];
+}
+
+int __init isa_dma_add(unsigned int chan, dma_t *dma)
+{
+ if (!dma->d_ops)
+ return -EINVAL;
+ if (dma_chan[chan])
+ return -EBUSY;
+ dma_chan[chan] = dma;
+ return 0;
}
/*
@@ -252,10 +260,3 @@ int get_dma_residue(unsigned int chan)
return ret;
}
EXPORT_SYMBOL(get_dma_residue);
-
-static int __init init_dma(void)
-{
- arch_dma_init(dma_chan);
- return 0;
-}
-core_initcall(init_dma);
OpenPOWER on IntegriCloud