diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-07-03 07:36:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-03 07:36:01 -0400 |
commit | 0ebfff1491ef85d41ddf9c633834838be144f69f (patch) | |
tree | 5b469a6d61a9fcfbf94e7b6d411e544dbdec8dec /sound | |
parent | f63e115fb50db39706b955b81e3375ef6bab2268 (diff) |
[POWERPC] Add new interrupt mapping core and change platforms to use it
This adds the new irq remapper core and removes the old one. Because
there are some fundamental conflicts with the old code, like the value
of NO_IRQ which I'm now setting to 0 (as per discussions with Linus),
etc..., this commit also changes the relevant platform and driver code
over to use the new remapper (so as not to cause difficulties later
in bisecting).
This patch removes the old pre-parsing of the open firmware interrupt
tree along with all the bogus assumptions it made to try to renumber
interrupts according to the platform. This is all to be handled by the
new code now.
For the pSeries XICS interrupt controller, a single remapper host is
created for the whole machine regardless of how many interrupt
presentation and source controllers are found, and it's set to match
any device node that isn't a 8259. That works fine on pSeries and
avoids having to deal with some of the complexities of split source
controllers vs. presentation controllers in the pSeries device trees.
The powerpc i8259 PIC driver now always requests the legacy interrupt
range. It also has the feature of being able to match any device node
(including NULL) if passed no device node as an input. That will help
porting over platforms with broken device-trees like Pegasos who don't
have a proper interrupt tree.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/aoa/core/snd-aoa-gpio-feature.c | 7 | ||||
-rw-r--r-- | sound/aoa/soundbus/i2sbus/i2sbus-core.c | 7 | ||||
-rw-r--r-- | sound/oss/dmasound/dmasound_awacs.c | 16 | ||||
-rw-r--r-- | sound/ppc/pmac.c | 33 | ||||
-rw-r--r-- | sound/ppc/tumbler.c | 8 |
5 files changed, 29 insertions, 42 deletions
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index bab97547a052..7ae0c0bdfad8 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c | |||
@@ -112,12 +112,7 @@ static struct device_node *get_gpio(char *name, | |||
112 | 112 | ||
113 | static void get_irq(struct device_node * np, int *irqptr) | 113 | static void get_irq(struct device_node * np, int *irqptr) |
114 | { | 114 | { |
115 | *irqptr = -1; | 115 | *irqptr = irq_of_parse_and_map(np, 0); |
116 | if (!np) | ||
117 | return; | ||
118 | if (np->n_intrs != 1) | ||
119 | return; | ||
120 | *irqptr = np->intrs[0].line; | ||
121 | } | 116 | } |
122 | 117 | ||
123 | /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ | 118 | /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ |
diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c index f268dacdaa00..01c0724335a3 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c | |||
@@ -129,7 +129,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, | |||
129 | if (strncmp(np->name, "i2s-", 4)) | 129 | if (strncmp(np->name, "i2s-", 4)) |
130 | return 0; | 130 | return 0; |
131 | 131 | ||
132 | if (np->n_intrs != 3) | 132 | if (macio_irq_count(macio) != 3) |
133 | return 0; | 133 | return 0; |
134 | 134 | ||
135 | dev = kzalloc(sizeof(struct i2sbus_dev), GFP_KERNEL); | 135 | dev = kzalloc(sizeof(struct i2sbus_dev), GFP_KERNEL); |
@@ -183,9 +183,10 @@ static int i2sbus_add_dev(struct macio_dev *macio, | |||
183 | snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name); | 183 | snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name); |
184 | } | 184 | } |
185 | for (i=0;i<3;i++) { | 185 | for (i=0;i<3;i++) { |
186 | if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i], dev)) | 186 | if (request_irq(macio_irq(macio, i), ints[i], 0, |
187 | dev->rnames[i], dev)) | ||
187 | goto err; | 188 | goto err; |
188 | dev->interrupts[i] = np->intrs[i].line; | 189 | dev->interrupts[i] = macio_irq(macio, i); |
189 | } | 190 | } |
190 | 191 | ||
191 | for (i=0;i<3;i++) { | 192 | for (i=0;i<3;i++) { |
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c index de454ca39226..4359903f4376 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c | |||
@@ -374,10 +374,7 @@ setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* | |||
374 | *gpio_pol = *pp; | 374 | *gpio_pol = *pp; |
375 | else | 375 | else |
376 | *gpio_pol = 1; | 376 | *gpio_pol = 1; |
377 | if (np->n_intrs > 0) | 377 | return irq_of_parse_and_map(np, 0); |
378 | return np->intrs[0].line; | ||
379 | |||
380 | return 0; | ||
381 | } | 378 | } |
382 | 379 | ||
383 | static inline void | 380 | static inline void |
@@ -2864,14 +2861,13 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2864 | * other info if necessary (early AWACS we want to read chip ids) | 2861 | * other info if necessary (early AWACS we want to read chip ids) |
2865 | */ | 2862 | */ |
2866 | 2863 | ||
2867 | if (of_get_address(io, 2, NULL, NULL) == NULL || io->n_intrs < 3) { | 2864 | if (of_get_address(io, 2, NULL, NULL) == NULL) { |
2868 | /* OK - maybe we need to use the 'awacs' node (on earlier | 2865 | /* OK - maybe we need to use the 'awacs' node (on earlier |
2869 | * machines). | 2866 | * machines). |
2870 | */ | 2867 | */ |
2871 | if (awacs_node) { | 2868 | if (awacs_node) { |
2872 | io = awacs_node ; | 2869 | io = awacs_node ; |
2873 | if (of_get_address(io, 2, NULL, NULL) == NULL || | 2870 | if (of_get_address(io, 2, NULL, NULL) == NULL) { |
2874 | io->n_intrs < 3) { | ||
2875 | printk("dmasound_pmac: can't use %s\n", | 2871 | printk("dmasound_pmac: can't use %s\n", |
2876 | io->full_name); | 2872 | io->full_name); |
2877 | return -ENODEV; | 2873 | return -ENODEV; |
@@ -2940,9 +2936,9 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2940 | if (awacs_revision == AWACS_SCREAMER && awacs) | 2936 | if (awacs_revision == AWACS_SCREAMER && awacs) |
2941 | awacs_recalibrate(); | 2937 | awacs_recalibrate(); |
2942 | 2938 | ||
2943 | awacs_irq = io->intrs[0].line; | 2939 | awacs_irq = irq_of_parse_and_map(io, 0); |
2944 | awacs_tx_irq = io->intrs[1].line; | 2940 | awacs_tx_irq = irq_of_parse_and_map(io, 1); |
2945 | awacs_rx_irq = io->intrs[2].line; | 2941 | awacs_rx_irq = irq_of_parse_and_map(io, 2); |
2946 | 2942 | ||
2947 | /* Hack for legacy crap that will be killed someday */ | 2943 | /* Hack for legacy crap that will be killed someday */ |
2948 | awacs_node = io; | 2944 | awacs_node = io; |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 90db9a1d1e0a..641430631505 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -1120,6 +1120,7 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
1120 | struct snd_pmac *chip; | 1120 | struct snd_pmac *chip; |
1121 | struct device_node *np; | 1121 | struct device_node *np; |
1122 | int i, err; | 1122 | int i, err; |
1123 | unsigned int irq; | ||
1123 | unsigned long ctrl_addr, txdma_addr, rxdma_addr; | 1124 | unsigned long ctrl_addr, txdma_addr, rxdma_addr; |
1124 | static struct snd_device_ops ops = { | 1125 | static struct snd_device_ops ops = { |
1125 | .dev_free = snd_pmac_dev_free, | 1126 | .dev_free = snd_pmac_dev_free, |
@@ -1153,10 +1154,6 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
1153 | if (chip->is_k2) { | 1154 | if (chip->is_k2) { |
1154 | static char *rnames[] = { | 1155 | static char *rnames[] = { |
1155 | "Sound Control", "Sound DMA" }; | 1156 | "Sound Control", "Sound DMA" }; |
1156 | if (np->n_intrs < 3) { | ||
1157 | err = -ENODEV; | ||
1158 | goto __error; | ||
1159 | } | ||
1160 | for (i = 0; i < 2; i ++) { | 1157 | for (i = 0; i < 2; i ++) { |
1161 | if (of_address_to_resource(np->parent, i, | 1158 | if (of_address_to_resource(np->parent, i, |
1162 | &chip->rsrc[i])) { | 1159 | &chip->rsrc[i])) { |
@@ -1185,10 +1182,6 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
1185 | } else { | 1182 | } else { |
1186 | static char *rnames[] = { | 1183 | static char *rnames[] = { |
1187 | "Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; | 1184 | "Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; |
1188 | if (np->n_intrs < 3) { | ||
1189 | err = -ENODEV; | ||
1190 | goto __error; | ||
1191 | } | ||
1192 | for (i = 0; i < 3; i ++) { | 1185 | for (i = 0; i < 3; i ++) { |
1193 | if (of_address_to_resource(np, i, | 1186 | if (of_address_to_resource(np, i, |
1194 | &chip->rsrc[i])) { | 1187 | &chip->rsrc[i])) { |
@@ -1220,28 +1213,30 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
1220 | chip->playback.dma = ioremap(txdma_addr, 0x100); | 1213 | chip->playback.dma = ioremap(txdma_addr, 0x100); |
1221 | chip->capture.dma = ioremap(rxdma_addr, 0x100); | 1214 | chip->capture.dma = ioremap(rxdma_addr, 0x100); |
1222 | if (chip->model <= PMAC_BURGUNDY) { | 1215 | if (chip->model <= PMAC_BURGUNDY) { |
1223 | if (request_irq(np->intrs[0].line, snd_pmac_ctrl_intr, 0, | 1216 | irq = irq_of_parse_and_map(np, 0); |
1217 | if (request_irq(irq, snd_pmac_ctrl_intr, 0, | ||
1224 | "PMac", (void*)chip)) { | 1218 | "PMac", (void*)chip)) { |
1225 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[0].line); | 1219 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", |
1220 | irq); | ||
1226 | err = -EBUSY; | 1221 | err = -EBUSY; |
1227 | goto __error; | 1222 | goto __error; |
1228 | } | 1223 | } |
1229 | chip->irq = np->intrs[0].line; | 1224 | chip->irq = irq; |
1230 | } | 1225 | } |
1231 | if (request_irq(np->intrs[1].line, snd_pmac_tx_intr, 0, | 1226 | irq = irq_of_parse_and_map(np, 1); |
1232 | "PMac Output", (void*)chip)) { | 1227 | if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){ |
1233 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[1].line); | 1228 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); |
1234 | err = -EBUSY; | 1229 | err = -EBUSY; |
1235 | goto __error; | 1230 | goto __error; |
1236 | } | 1231 | } |
1237 | chip->tx_irq = np->intrs[1].line; | 1232 | chip->tx_irq = irq; |
1238 | if (request_irq(np->intrs[2].line, snd_pmac_rx_intr, 0, | 1233 | irq = irq_of_parse_and_map(np, 2); |
1239 | "PMac Input", (void*)chip)) { | 1234 | if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) { |
1240 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[2].line); | 1235 | snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); |
1241 | err = -EBUSY; | 1236 | err = -EBUSY; |
1242 | goto __error; | 1237 | goto __error; |
1243 | } | 1238 | } |
1244 | chip->rx_irq = np->intrs[2].line; | 1239 | chip->rx_irq = irq; |
1245 | 1240 | ||
1246 | snd_pmac_sound_feature(chip, 1); | 1241 | snd_pmac_sound_feature(chip, 1); |
1247 | 1242 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 70e4ebc70260..692c61177678 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -1121,7 +1121,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
1121 | DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", | 1121 | DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", |
1122 | device, gp->addr, gp->active_state); | 1122 | device, gp->addr, gp->active_state); |
1123 | 1123 | ||
1124 | return (node->n_intrs > 0) ? node->intrs[0].line : 0; | 1124 | return irq_of_parse_and_map(node, 0); |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | /* reset audio */ | 1127 | /* reset audio */ |
@@ -1264,16 +1264,16 @@ static int __init tumbler_init(struct snd_pmac *chip) | |||
1264 | &mix->line_mute, 1); | 1264 | &mix->line_mute, 1); |
1265 | irq = tumbler_find_device("headphone-detect", | 1265 | irq = tumbler_find_device("headphone-detect", |
1266 | NULL, &mix->hp_detect, 0); | 1266 | NULL, &mix->hp_detect, 0); |
1267 | if (irq < 0) | 1267 | if (irq <= NO_IRQ) |
1268 | irq = tumbler_find_device("headphone-detect", | 1268 | irq = tumbler_find_device("headphone-detect", |
1269 | NULL, &mix->hp_detect, 1); | 1269 | NULL, &mix->hp_detect, 1); |
1270 | if (irq < 0) | 1270 | if (irq <= NO_IRQ) |
1271 | irq = tumbler_find_device("keywest-gpio15", | 1271 | irq = tumbler_find_device("keywest-gpio15", |
1272 | NULL, &mix->hp_detect, 1); | 1272 | NULL, &mix->hp_detect, 1); |
1273 | mix->headphone_irq = irq; | 1273 | mix->headphone_irq = irq; |
1274 | irq = tumbler_find_device("line-output-detect", | 1274 | irq = tumbler_find_device("line-output-detect", |
1275 | NULL, &mix->line_detect, 0); | 1275 | NULL, &mix->line_detect, 0); |
1276 | if (irq < 0) | 1276 | if (irq <= NO_IRQ) |
1277 | irq = tumbler_find_device("line-output-detect", | 1277 | irq = tumbler_find_device("line-output-detect", |
1278 | NULL, &mix->line_detect, 1); | 1278 | NULL, &mix->line_detect, 1); |
1279 | mix->lineout_irq = irq; | 1279 | mix->lineout_irq = irq; |