aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powermac
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 18:57:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-05 18:57:35 -0400
commit03c0c29aff7e56b722eb6c47eace222b140d0377 (patch)
tree47267a19b523159cf36a050ef3c35f4dbdb33016 /arch/powerpc/platforms/powermac
parentc60c6a96b7bb0f1f8bb635fdfcf5b592aaf062b4 (diff)
parent7fb8f881c54beb05dd4d2c947dada1c636581d87 (diff)
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits) of/platform: Register of_platform_drivers with an "of:" prefix of/address: Clean up function declarations of/spi: call of_register_spi_devices() from spi core code of: Provide default of_node_to_nid() implementation. of/device: Make of_device_make_bus_id() usable by other code. of/irq: Fix endian issues in parsing interrupt specifiers of: Fix phandle endian issues of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string of: remove of_default_bus_ids of: make of_find_device_by_node generic microblaze: remove references to of_device and to_of_device sparc: remove references to of_device and to_of_device powerpc: remove references to of_device and to_of_device of/device: Replace of_device with platform_device in includes and core code of/device: Protect against binding of_platform_drivers to non-OF devices of: remove asm/of_device.h of: remove asm/of_platform.h of/platform: remove all of_bus_type and of_platform_bus_type references of: Merge of_platform_bus_type with platform_bus_type drivercore/of: Add OF style matching to platform bus ... Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just some obj-y removals by the devicetree branch, while the microblaze updates added a new file.
Diffstat (limited to 'arch/powerpc/platforms/powermac')
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/pic.c72
2 files changed, 68 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 79bd3e89dba..39df6ab1735 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -21,6 +21,8 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
24#include <linux/spinlock.h> 26#include <linux/spinlock.h>
25#include <linux/adb.h> 27#include <linux/adb.h>
26#include <linux/pmu.h> 28#include <linux/pmu.h>
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 630a533d0e5..890d5f72b19 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -46,6 +46,10 @@ struct pmac_irq_hw {
46 unsigned int level; 46 unsigned int level;
47}; 47};
48 48
49/* Workaround flags for 32bit powermac machines */
50unsigned int of_irq_workarounds;
51struct device_node *of_irq_dflt_pic;
52
49/* Default addresses */ 53/* Default addresses */
50static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4]; 54static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4];
51 55
@@ -428,6 +432,42 @@ static void __init pmac_pic_probe_oldstyle(void)
428 setup_irq(irq_create_mapping(NULL, 20), &xmon_action); 432 setup_irq(irq_create_mapping(NULL, 20), &xmon_action);
429#endif 433#endif
430} 434}
435
436int of_irq_map_oldworld(struct device_node *device, int index,
437 struct of_irq *out_irq)
438{
439 const u32 *ints = NULL;
440 int intlen;
441
442 /*
443 * Old machines just have a list of interrupt numbers
444 * and no interrupt-controller nodes. We also have dodgy
445 * cases where the APPL,interrupts property is completely
446 * missing behind pci-pci bridges and we have to get it
447 * from the parent (the bridge itself, as apple just wired
448 * everything together on these)
449 */
450 while (device) {
451 ints = of_get_property(device, "AAPL,interrupts", &intlen);
452 if (ints != NULL)
453 break;
454 device = device->parent;
455 if (device && strcmp(device->type, "pci") != 0)
456 break;
457 }
458 if (ints == NULL)
459 return -EINVAL;
460 intlen /= sizeof(u32);
461
462 if (index >= intlen)
463 return -EINVAL;
464
465 out_irq->controller = NULL;
466 out_irq->specifier[0] = ints[index];
467 out_irq->size = 1;
468
469 return 0;
470}
431#endif /* CONFIG_PPC32 */ 471#endif /* CONFIG_PPC32 */
432 472
433static void pmac_u3_cascade(unsigned int irq, struct irq_desc *desc) 473static void pmac_u3_cascade(unsigned int irq, struct irq_desc *desc)
@@ -559,19 +599,39 @@ static int __init pmac_pic_probe_mpic(void)
559 599
560void __init pmac_pic_init(void) 600void __init pmac_pic_init(void)
561{ 601{
562 unsigned int flags = 0;
563
564 /* We configure the OF parsing based on our oldworld vs. newworld 602 /* We configure the OF parsing based on our oldworld vs. newworld
565 * platform type and wether we were booted by BootX. 603 * platform type and wether we were booted by BootX.
566 */ 604 */
567#ifdef CONFIG_PPC32 605#ifdef CONFIG_PPC32
568 if (!pmac_newworld) 606 if (!pmac_newworld)
569 flags |= OF_IMAP_OLDWORLD_MAC; 607 of_irq_workarounds |= OF_IMAP_OLDWORLD_MAC;
570 if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL) 608 if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL)
571 flags |= OF_IMAP_NO_PHANDLE; 609 of_irq_workarounds |= OF_IMAP_NO_PHANDLE;
572#endif /* CONFIG_PPC_32 */
573 610
574 of_irq_map_init(flags); 611 /* If we don't have phandles on a newworld, then try to locate a
612 * default interrupt controller (happens when booting with BootX).
613 * We do a first match here, hopefully, that only ever happens on
614 * machines with one controller.
615 */
616 if (pmac_newworld && (of_irq_workarounds & OF_IMAP_NO_PHANDLE)) {
617 struct device_node *np;
618
619 for_each_node_with_property(np, "interrupt-controller") {
620 /* Skip /chosen/interrupt-controller */
621 if (strcmp(np->name, "chosen") == 0)
622 continue;
623 /* It seems like at least one person wants
624 * to use BootX on a machine with an AppleKiwi
625 * controller which happens to pretend to be an
626 * interrupt controller too. */
627 if (strcmp(np->name, "AppleKiwi") == 0)
628 continue;
629 /* I think we found one ! */
630 of_irq_dflt_pic = np;
631 break;
632 }
633 }
634#endif /* CONFIG_PPC32 */
575 635
576 /* We first try to detect Apple's new Core99 chipset, since mac-io 636 /* We first try to detect Apple's new Core99 chipset, since mac-io
577 * is quite different on those machines and contains an IBM MPIC2. 637 * is quite different on those machines and contains an IBM MPIC2.