diff options
| author | Kumar Gala <galak@kernel.crashing.org> | 2008-07-02 12:46:20 -0400 |
|---|---|---|
| committer | Kumar Gala <galak@kernel.crashing.org> | 2008-07-14 08:55:41 -0400 |
| commit | 98384c6cdd1fd593f399b6f879bae2cae70aad48 (patch) | |
| tree | 02e289153fb30d0039b306db33fee92ee9be387d | |
| parent | a5d28c8e64ff0bc77d38d9c19c6d8163e4c0ffaa (diff) | |
powerpc/86xx: Refactor pic init
Moved the pic initialization into its own common file and out of the board
code. Also fixed the OF reference counting on the mpic node.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/platforms/86xx/Makefile | 1 | ||||
| -rw-r--r-- | arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 26 | ||||
| -rw-r--r-- | arch/powerpc/platforms/86xx/mpc86xx.h | 3 | ||||
| -rw-r--r-- | arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 64 | ||||
| -rw-r--r-- | arch/powerpc/platforms/86xx/pic.c | 78 | ||||
| -rw-r--r-- | arch/powerpc/platforms/86xx/sbc8641d.c | 25 |
6 files changed, 86 insertions, 111 deletions
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile index 1b9b4a9b2525..8fee37dec795 100644 --- a/arch/powerpc/platforms/86xx/Makefile +++ b/arch/powerpc/platforms/86xx/Makefile | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | # Makefile for the PowerPC 86xx linux kernel. | 2 | # Makefile for the PowerPC 86xx linux kernel. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y := pic.o | ||
| 5 | obj-$(CONFIG_SMP) += mpc86xx_smp.o | 6 | obj-$(CONFIG_SMP) += mpc86xx_smp.o |
| 6 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o | 7 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o |
| 7 | obj-$(CONFIG_SBC8641D) += sbc8641d.o | 8 | obj-$(CONFIG_SBC8641D) += sbc8641d.o |
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c index eb16208b29d9..30725302884a 100644 --- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #include <sysdev/fsl_pci.h> | 39 | #include <sysdev/fsl_pci.h> |
| 40 | #include <sysdev/fsl_soc.h> | 40 | #include <sysdev/fsl_soc.h> |
| 41 | 41 | ||
| 42 | #include "mpc86xx.h" | ||
| 43 | |||
| 42 | static unsigned char *pixis_bdcfg0, *pixis_arch; | 44 | static unsigned char *pixis_bdcfg0, *pixis_arch; |
| 43 | 45 | ||
| 44 | static struct of_device_id __initdata mpc8610_ids[] = { | 46 | static struct of_device_id __initdata mpc8610_ids[] = { |
| @@ -56,28 +58,6 @@ static int __init mpc8610_declare_of_platform_devices(void) | |||
| 56 | } | 58 | } |
| 57 | machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); | 59 | machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); |
| 58 | 60 | ||
| 59 | static void __init mpc86xx_hpcd_init_irq(void) | ||
| 60 | { | ||
| 61 | struct mpic *mpic1; | ||
| 62 | struct device_node *np; | ||
| 63 | struct resource res; | ||
| 64 | |||
| 65 | /* Determine PIC address. */ | ||
| 66 | np = of_find_node_by_type(NULL, "open-pic"); | ||
| 67 | if (np == NULL) | ||
| 68 | return; | ||
| 69 | of_address_to_resource(np, 0, &res); | ||
| 70 | |||
| 71 | /* Alloc mpic structure and per isu has 16 INT entries. */ | ||
| 72 | mpic1 = mpic_alloc(np, res.start, | ||
| 73 | MPIC_PRIMARY | MPIC_WANTS_RESET | | ||
| 74 | MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, | ||
| 75 | 0, 256, " MPIC "); | ||
| 76 | BUG_ON(mpic1 == NULL); | ||
| 77 | |||
| 78 | mpic_init(mpic1); | ||
| 79 | } | ||
| 80 | |||
| 81 | #ifdef CONFIG_PCI | 61 | #ifdef CONFIG_PCI |
| 82 | static void __devinit quirk_uli1575(struct pci_dev *dev) | 62 | static void __devinit quirk_uli1575(struct pci_dev *dev) |
| 83 | { | 63 | { |
| @@ -405,7 +385,7 @@ define_machine(mpc86xx_hpcd) { | |||
| 405 | .name = "MPC86xx HPCD", | 385 | .name = "MPC86xx HPCD", |
| 406 | .probe = mpc86xx_hpcd_probe, | 386 | .probe = mpc86xx_hpcd_probe, |
| 407 | .setup_arch = mpc86xx_hpcd_setup_arch, | 387 | .setup_arch = mpc86xx_hpcd_setup_arch, |
| 408 | .init_IRQ = mpc86xx_hpcd_init_irq, | 388 | .init_IRQ = mpc86xx_init_irq, |
| 409 | .get_irq = mpic_get_irq, | 389 | .get_irq = mpic_get_irq, |
| 410 | .restart = fsl_rstcr_restart, | 390 | .restart = fsl_rstcr_restart, |
| 411 | .time_init = mpc86xx_time_init, | 391 | .time_init = mpc86xx_time_init, |
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h b/arch/powerpc/platforms/86xx/mpc86xx.h index 525ffa1904f9..08efb57559d1 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx.h +++ b/arch/powerpc/platforms/86xx/mpc86xx.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | * mpc86xx_* files. Mostly for use by mpc86xx_setup(). | 15 | * mpc86xx_* files. Mostly for use by mpc86xx_setup(). |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | extern void __init mpc86xx_smp_init(void); | 18 | extern void mpc86xx_smp_init(void); |
| 19 | extern void mpc86xx_init_irq(void); | ||
| 19 | 20 | ||
| 20 | #endif /* __MPC86XX_H__ */ | 21 | #endif /* __MPC86XX_H__ */ |
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index f13704aabbea..7916599c9126 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | #include <asm/prom.h> | 28 | #include <asm/prom.h> |
| 29 | #include <mm/mmu_decl.h> | 29 | #include <mm/mmu_decl.h> |
| 30 | #include <asm/udbg.h> | 30 | #include <asm/udbg.h> |
| 31 | #include <asm/i8259.h> | ||
| 32 | 31 | ||
| 33 | #include <asm/mpic.h> | 32 | #include <asm/mpic.h> |
| 34 | 33 | ||
| @@ -46,67 +45,6 @@ | |||
| 46 | #endif | 45 | #endif |
| 47 | 46 | ||
| 48 | #ifdef CONFIG_PCI | 47 | #ifdef CONFIG_PCI |
| 49 | static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc) | ||
| 50 | { | ||
| 51 | unsigned int cascade_irq = i8259_irq(); | ||
| 52 | if (cascade_irq != NO_IRQ) | ||
| 53 | generic_handle_irq(cascade_irq); | ||
| 54 | desc->chip->eoi(irq); | ||
| 55 | } | ||
| 56 | #endif /* CONFIG_PCI */ | ||
| 57 | |||
| 58 | static void __init | ||
| 59 | mpc86xx_hpcn_init_irq(void) | ||
| 60 | { | ||
| 61 | struct mpic *mpic1; | ||
| 62 | struct device_node *np; | ||
| 63 | struct resource res; | ||
| 64 | #ifdef CONFIG_PCI | ||
| 65 | struct device_node *cascade_node = NULL; | ||
| 66 | int cascade_irq; | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /* Determine PIC address. */ | ||
| 70 | np = of_find_node_by_type(NULL, "open-pic"); | ||
| 71 | if (np == NULL) | ||
| 72 | return; | ||
| 73 | of_address_to_resource(np, 0, &res); | ||
| 74 | |||
| 75 | /* Alloc mpic structure and per isu has 16 INT entries. */ | ||
| 76 | mpic1 = mpic_alloc(np, res.start, | ||
| 77 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | ||
| 78 | 0, 256, " MPIC "); | ||
| 79 | BUG_ON(mpic1 == NULL); | ||
| 80 | |||
| 81 | mpic_init(mpic1); | ||
| 82 | |||
| 83 | #ifdef CONFIG_PCI | ||
| 84 | /* Initialize i8259 controller */ | ||
| 85 | for_each_node_by_type(np, "interrupt-controller") | ||
| 86 | if (of_device_is_compatible(np, "chrp,iic")) { | ||
| 87 | cascade_node = np; | ||
| 88 | break; | ||
| 89 | } | ||
| 90 | if (cascade_node == NULL) { | ||
| 91 | printk(KERN_DEBUG "mpc86xxhpcn: no ISA interrupt controller\n"); | ||
| 92 | return; | ||
| 93 | } | ||
| 94 | |||
| 95 | cascade_irq = irq_of_parse_and_map(cascade_node, 0); | ||
| 96 | if (cascade_irq == NO_IRQ) { | ||
| 97 | printk(KERN_ERR "mpc86xxhpcn: failed to map cascade interrupt"); | ||
| 98 | return; | ||
| 99 | } | ||
| 100 | DBG("mpc86xxhpcn: cascade mapped to irq %d\n", cascade_irq); | ||
| 101 | |||
| 102 | i8259_init(cascade_node, 0); | ||
| 103 | of_node_put(cascade_node); | ||
| 104 | |||
| 105 | set_irq_chained_handler(cascade_irq, mpc86xx_8259_cascade); | ||
| 106 | #endif | ||
| 107 | } | ||
| 108 | |||
| 109 | #ifdef CONFIG_PCI | ||
| 110 | extern int uses_fsl_uli_m1575; | 48 | extern int uses_fsl_uli_m1575; |
| 111 | extern int uli_exclude_device(struct pci_controller *hose, | 49 | extern int uli_exclude_device(struct pci_controller *hose, |
| 112 | u_char bus, u_char devfn); | 50 | u_char bus, u_char devfn); |
| @@ -237,7 +175,7 @@ define_machine(mpc86xx_hpcn) { | |||
| 237 | .name = "MPC86xx HPCN", | 175 | .name = "MPC86xx HPCN", |
| 238 | .probe = mpc86xx_hpcn_probe, | 176 | .probe = mpc86xx_hpcn_probe, |
| 239 | .setup_arch = mpc86xx_hpcn_setup_arch, | 177 | .setup_arch = mpc86xx_hpcn_setup_arch, |
| 240 | .init_IRQ = mpc86xx_hpcn_init_irq, | 178 | .init_IRQ = mpc86xx_init_irq, |
| 241 | .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo, | 179 | .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo, |
| 242 | .get_irq = mpic_get_irq, | 180 | .get_irq = mpic_get_irq, |
| 243 | .restart = fsl_rstcr_restart, | 181 | .restart = fsl_rstcr_restart, |
diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c new file mode 100644 index 000000000000..8881c5de500d --- /dev/null +++ b/arch/powerpc/platforms/86xx/pic.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2008 Freescale Semiconductor, Inc. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/stddef.h> | ||
| 11 | #include <linux/kernel.h> | ||
| 12 | #include <linux/interrupt.h> | ||
| 13 | #include <linux/of_platform.h> | ||
| 14 | |||
| 15 | #include <asm/system.h> | ||
| 16 | #include <asm/mpic.h> | ||
| 17 | #include <asm/i8259.h> | ||
| 18 | |||
| 19 | #ifdef CONFIG_PPC_I8259 | ||
| 20 | static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc) | ||
| 21 | { | ||
| 22 | unsigned int cascade_irq = i8259_irq(); | ||
| 23 | if (cascade_irq != NO_IRQ) | ||
| 24 | generic_handle_irq(cascade_irq); | ||
| 25 | desc->chip->eoi(irq); | ||
| 26 | } | ||
| 27 | #endif /* CONFIG_PPC_I8259 */ | ||
| 28 | |||
| 29 | void __init mpc86xx_init_irq(void) | ||
| 30 | { | ||
| 31 | struct mpic *mpic; | ||
| 32 | struct device_node *np; | ||
| 33 | struct resource res; | ||
| 34 | #ifdef CONFIG_PPC_I8259 | ||
| 35 | struct device_node *cascade_node = NULL; | ||
| 36 | int cascade_irq; | ||
| 37 | #endif | ||
| 38 | |||
| 39 | /* Determine PIC address. */ | ||
| 40 | np = of_find_node_by_type(NULL, "open-pic"); | ||
| 41 | if (np == NULL) | ||
| 42 | return; | ||
| 43 | of_address_to_resource(np, 0, &res); | ||
| 44 | |||
| 45 | mpic = mpic_alloc(np, res.start, | ||
| 46 | MPIC_PRIMARY | MPIC_WANTS_RESET | | ||
| 47 | MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, | ||
| 48 | 0, 256, " MPIC "); | ||
| 49 | of_node_put(np); | ||
| 50 | BUG_ON(mpic == NULL); | ||
| 51 | |||
| 52 | mpic_init(mpic); | ||
| 53 | |||
| 54 | #ifdef CONFIG_PPC_I8259 | ||
| 55 | /* Initialize i8259 controller */ | ||
| 56 | for_each_node_by_type(np, "interrupt-controller") | ||
| 57 | if (of_device_is_compatible(np, "chrp,iic")) { | ||
| 58 | cascade_node = np; | ||
| 59 | break; | ||
| 60 | } | ||
| 61 | |||
| 62 | if (cascade_node == NULL) { | ||
| 63 | printk(KERN_DEBUG "Could not find i8259 PIC\n"); | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | |||
| 67 | cascade_irq = irq_of_parse_and_map(cascade_node, 0); | ||
| 68 | if (cascade_irq == NO_IRQ) { | ||
| 69 | printk(KERN_ERR "Failed to map cascade interrupt\n"); | ||
| 70 | return; | ||
| 71 | } | ||
| 72 | |||
| 73 | i8259_init(cascade_node, 0); | ||
| 74 | of_node_put(cascade_node); | ||
| 75 | |||
| 76 | set_irq_chained_handler(cascade_irq, mpc86xx_8259_cascade); | ||
| 77 | #endif | ||
| 78 | } | ||
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c index 510a06ef0b55..00e6fad3b3ca 100644 --- a/arch/powerpc/platforms/86xx/sbc8641d.c +++ b/arch/powerpc/platforms/86xx/sbc8641d.c | |||
| @@ -38,29 +38,6 @@ | |||
| 38 | #include "mpc86xx.h" | 38 | #include "mpc86xx.h" |
| 39 | 39 | ||
| 40 | static void __init | 40 | static void __init |
| 41 | sbc8641_init_irq(void) | ||
| 42 | { | ||
| 43 | struct mpic *mpic1; | ||
| 44 | struct device_node *np; | ||
| 45 | struct resource res; | ||
| 46 | |||
| 47 | /* Determine PIC address. */ | ||
| 48 | np = of_find_node_by_type(NULL, "open-pic"); | ||
| 49 | if (np == NULL) | ||
| 50 | return; | ||
| 51 | of_address_to_resource(np, 0, &res); | ||
| 52 | |||
| 53 | /* Alloc mpic structure and per isu has 16 INT entries. */ | ||
| 54 | mpic1 = mpic_alloc(np, res.start, | ||
| 55 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | ||
| 56 | 0, 256, " MPIC "); | ||
| 57 | of_node_put(np); | ||
| 58 | BUG_ON(mpic1 == NULL); | ||
| 59 | |||
| 60 | mpic_init(mpic1); | ||
| 61 | } | ||
| 62 | |||
| 63 | static void __init | ||
| 64 | sbc8641_setup_arch(void) | 41 | sbc8641_setup_arch(void) |
| 65 | { | 42 | { |
| 66 | #ifdef CONFIG_PCI | 43 | #ifdef CONFIG_PCI |
| @@ -151,7 +128,7 @@ define_machine(sbc8641) { | |||
| 151 | .name = "SBC8641D", | 128 | .name = "SBC8641D", |
| 152 | .probe = sbc8641_probe, | 129 | .probe = sbc8641_probe, |
| 153 | .setup_arch = sbc8641_setup_arch, | 130 | .setup_arch = sbc8641_setup_arch, |
| 154 | .init_IRQ = sbc8641_init_irq, | 131 | .init_IRQ = mpc86xx_init_irq, |
| 155 | .show_cpuinfo = sbc8641_show_cpuinfo, | 132 | .show_cpuinfo = sbc8641_show_cpuinfo, |
| 156 | .get_irq = mpic_get_irq, | 133 | .get_irq = mpic_get_irq, |
| 157 | .restart = fsl_rstcr_restart, | 134 | .restart = fsl_rstcr_restart, |
