aboutsummaryrefslogtreecommitdiff
path: root/sound/oss/dmasound/dmasound_awacs.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-12-13 18:01:21 +1100
committerPaul Mackerras <paulus@samba.org>2006-01-09 14:53:55 +1100
commitcc5d0189b9ba95260857a5018a1c2fef90008507 (patch)
tree1202c94b6b3cb81a96d0a0e54424cad10eef68bb /sound/oss/dmasound/dmasound_awacs.c
parent9cf84d7c97992dbe5360b241327341c07ce30fc9 (diff)
[PATCH] powerpc: Remove device_node addrs/n_addr
The pre-parsed addrs/n_addrs fields in struct device_node are finally gone. Remove the dodgy heuristics that did that parsing at boot and remove the fields themselves since we now have a good replacement with the new OF parsing code. This patch also fixes a bunch of drivers to use the new code instead, so that at least pmac32, pseries, iseries and g5 defconfigs build. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'sound/oss/dmasound/dmasound_awacs.c')
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c81
1 files changed, 49 insertions, 32 deletions
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index cebd881b91a..74f975676cc 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -125,6 +125,7 @@ static int awacs_rate_index;
static int awacs_subframe;
static struct device_node* awacs_node;
static struct device_node* i2s_node;
+static struct resource awacs_rsrc[3];
static char awacs_name[64];
static int awacs_revision;
@@ -667,9 +668,12 @@ static void PMacIrqCleanup(void)
iounmap(awacs_txdma);
iounmap(awacs_rxdma);
- release_OF_resource(awacs_node, 0);
- release_OF_resource(awacs_node, 1);
- release_OF_resource(awacs_node, 2);
+ release_mem_region(awacs_rsrc[0].start,
+ awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
+ release_mem_region(awacs_rsrc[1].start,
+ awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
+ release_mem_region(awacs_rsrc[2].start,
+ awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
kfree(awacs_tx_cmd_space);
kfree(awacs_rx_cmd_space);
@@ -2863,46 +2867,58 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
* other info if necessary (early AWACS we want to read chip ids)
*/
- if (io->n_addrs < 3 || io->n_intrs < 3) {
+ if (of_get_address(io, 2, NULL, NULL) == NULL || io->n_intrs < 3) {
/* OK - maybe we need to use the 'awacs' node (on earlier
* machines).
- */
+ */
if (awacs_node) {
io = awacs_node ;
- if (io->n_addrs < 3 || io->n_intrs < 3) {
- printk("dmasound_pmac: can't use %s"
- " (%d addrs, %d intrs)\n",
- io->full_name, io->n_addrs, io->n_intrs);
+ if (of_get_address(io, 2, NULL, NULL) == NULL ||
+ io->n_intrs < 3) {
+ printk("dmasound_pmac: can't use %s\n",
+ io->full_name);
return -ENODEV;
}
- } else {
- printk("dmasound_pmac: can't use %s (%d addrs, %d intrs)\n",
- io->full_name, io->n_addrs, io->n_intrs);
- }
+ } else
+ printk("dmasound_pmac: can't use %s\n", io->full_name);
}
- if (!request_OF_resource(io, 0, NULL)) {
+ if (of_address_to_resource(io, 0, &awacs_rsrc[0]) ||
+ request_mem_region(awacs_rsrc[0].start,
+ awacs_rsrc[0].end - awacs_rsrc[0].start + 1,
+ " (IO)") == NULL) {
printk(KERN_ERR "dmasound: can't request IO resource !\n");
return -ENODEV;
}
- if (!request_OF_resource(io, 1, " (tx dma)")) {
- release_OF_resource(io, 0);
- printk(KERN_ERR "dmasound: can't request TX DMA resource !\n");
+ if (of_address_to_resource(io, 1, &awacs_rsrc[1]) ||
+ request_mem_region(awacs_rsrc[1].start,
+ awacs_rsrc[1].end - awacs_rsrc[1].start + 1,
+ " (tx dma)") == NULL) {
+ release_mem_region(awacs_rsrc[0].start,
+ awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
+ printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n");
return -ENODEV;
}
-
- if (!request_OF_resource(io, 2, " (rx dma)")) {
- release_OF_resource(io, 0);
- release_OF_resource(io, 1);
- printk(KERN_ERR "dmasound: can't request RX DMA resource !\n");
+ if (of_address_to_resource(io, 2, &awacs_rsrc[2]) ||
+ request_mem_region(awacs_rsrc[2].start,
+ awacs_rsrc[2].end - awacs_rsrc[2].start + 1,
+ " (rx dma)") == NULL) {
+ release_mem_region(awacs_rsrc[0].start,
+ awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
+ release_mem_region(awacs_rsrc[1].start,
+ awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
+ printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n");
return -ENODEV;
}
awacs_beep_dev = input_allocate_device();
if (!awacs_beep_dev) {
- release_OF_resource(io, 0);
- release_OF_resource(io, 1);
- release_OF_resource(io, 2);
+ release_mem_region(awacs_rsrc[0].start,
+ awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
+ release_mem_region(awacs_rsrc[1].start,
+ awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
+ release_mem_region(awacs_rsrc[2].start,
+ awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
printk(KERN_ERR "dmasound: can't allocate input device !\n");
return -ENOMEM;
}
@@ -2916,11 +2932,11 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
/* all OF versions I've seen use this value */
if (i2s_node)
- i2s = ioremap(io->addrs[0].address, 0x1000);
+ i2s = ioremap(awacs_rsrc[0].start, 0x1000);
else
- awacs = ioremap(io->addrs[0].address, 0x1000);
- awacs_txdma = ioremap(io->addrs[1].address, 0x100);
- awacs_rxdma = ioremap(io->addrs[2].address, 0x100);
+ awacs = ioremap(awacs_rsrc[0].start, 0x1000);
+ awacs_txdma = ioremap(awacs_rsrc[1].start, 0x100);
+ awacs_rxdma = ioremap(awacs_rsrc[2].start, 0x100);
/* first of all make sure that the chip is powered up....*/
pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, io, 0, 1);
@@ -3083,9 +3099,10 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
struct device_node* mio;
macio_base = NULL;
for (mio = io->parent; mio; mio = mio->parent) {
- if (strcmp(mio->name, "mac-io") == 0
- && mio->n_addrs > 0) {
- macio_base = ioremap(mio->addrs[0].address, 0x40);
+ if (strcmp(mio->name, "mac-io") == 0) {
+ struct resource r;
+ if (of_address_to_resource(mio, 0, &r) == 0)
+ macio_base = ioremap(r.start, 0x40);
break;
}
}