diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-12-20 23:39:26 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2007-12-23 14:13:14 -0500 |
commit | 619740384cebe2601a8d307654a22d9ed85f2fcb (patch) | |
tree | a354c4b83554f2c718afea3ba6aa91d50702e03d /arch/powerpc/platforms | |
parent | 9dae8afdf212d39bc7c25f1b1ca9b10f10f6beaa (diff) |
[POWERPC] 4xx: EP405 boards support for arch/powerpc
Brings EP405 support to arch/powerpc. The IRQ routing for the CPLD
comes from a device-tree property, PCI is working to the point where
I can see the video card, USB device, and south bridge.
This should work with both EP405 and EP405PC.
I've not totally figured out how IRQs are wired on this hardware
though, thus at this stage, expect only USB interrupts working,
pretty much the same as what arch/ppc did.
Also, the flash, nvram, rtc and temp control still have to be wired.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/40x/Kconfig | 22 | ||||
-rw-r--r-- | arch/powerpc/platforms/40x/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/40x/ep405.c | 124 |
3 files changed, 133 insertions, 14 deletions
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig index 8f6699fcc145..b8f0a6c16486 100644 --- a/arch/powerpc/platforms/40x/Kconfig +++ b/arch/powerpc/platforms/40x/Kconfig | |||
@@ -14,20 +14,14 @@ | |||
14 | # help | 14 | # help |
15 | # This option enables support for the CPCI405 board. | 15 | # This option enables support for the CPCI405 board. |
16 | 16 | ||
17 | #config EP405 | 17 | config EP405 |
18 | # bool "EP405/EP405PC" | 18 | bool "EP405/EP405PC" |
19 | # depends on 40x | 19 | depends on 40x |
20 | # default n | 20 | default n |
21 | # select 405GP | 21 | select 405GP |
22 | # help | 22 | select PCI |
23 | # This option enables support for the EP405/EP405PC boards. | 23 | help |
24 | 24 | This option enables support for the EP405/EP405PC boards. | |
25 | #config EP405PC | ||
26 | # bool "EP405PC Support" | ||
27 | # depends on EP405 | ||
28 | # default y | ||
29 | # help | ||
30 | # This option enables support for the extra features of the EP405PC board. | ||
31 | 25 | ||
32 | config KILAUEA | 26 | config KILAUEA |
33 | bool "Kilauea" | 27 | bool "Kilauea" |
diff --git a/arch/powerpc/platforms/40x/Makefile b/arch/powerpc/platforms/40x/Makefile index 51dadeee6fc6..0f42fd481c77 100644 --- a/arch/powerpc/platforms/40x/Makefile +++ b/arch/powerpc/platforms/40x/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_KILAUEA) += kilauea.o | 1 | obj-$(CONFIG_KILAUEA) += kilauea.o |
2 | obj-$(CONFIG_WALNUT) += walnut.o | 2 | obj-$(CONFIG_WALNUT) += walnut.o |
3 | obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o | 3 | obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o |
4 | obj-$(CONFIG_EP405) += ep405.o | ||
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c new file mode 100644 index 000000000000..ba84a41e63e6 --- /dev/null +++ b/arch/powerpc/platforms/40x/ep405.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Architecture- / platform-specific boot-time initialization code for | ||
3 | * IBM PowerPC 4xx based boards. Adapted from original | ||
4 | * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek | ||
5 | * <dan@net4x.com>. | ||
6 | * | ||
7 | * Copyright(c) 1999-2000 Grant Erickson <grant@lcse.umn.edu> | ||
8 | * | ||
9 | * Rewritten and ported to the merged powerpc tree: | ||
10 | * Copyright 2007 IBM Corporation | ||
11 | * Josh Boyer <jwboyer@linux.vnet.ibm.com> | ||
12 | * | ||
13 | * Adapted to EP405 by Ben. Herrenschmidt <benh@kernel.crashing.org> | ||
14 | * | ||
15 | * TODO: Wire up the PCI IRQ mux and the southbridge interrupts | ||
16 | * | ||
17 | * 2002 (c) MontaVista, Software, Inc. This file is licensed under | ||
18 | * the terms of the GNU General Public License version 2. This program | ||
19 | * is licensed "as is" without any warranty of any kind, whether express | ||
20 | * or implied. | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/of_platform.h> | ||
25 | |||
26 | #include <asm/machdep.h> | ||
27 | #include <asm/prom.h> | ||
28 | #include <asm/udbg.h> | ||
29 | #include <asm/time.h> | ||
30 | #include <asm/uic.h> | ||
31 | #include <asm/pci-bridge.h> | ||
32 | |||
33 | static struct device_node *bcsr_node; | ||
34 | static void __iomem *bcsr_regs; | ||
35 | |||
36 | /* BCSR registers */ | ||
37 | #define BCSR_ID 0 | ||
38 | #define BCSR_PCI_CTRL 1 | ||
39 | #define BCSR_FLASH_NV_POR_CTRL 2 | ||
40 | #define BCSR_FENET_UART_CTRL 3 | ||
41 | #define BCSR_PCI_IRQ 4 | ||
42 | #define BCSR_XIRQ_SELECT 5 | ||
43 | #define BCSR_XIRQ_ROUTING 6 | ||
44 | #define BCSR_XIRQ_STATUS 7 | ||
45 | #define BCSR_XIRQ_STATUS2 8 | ||
46 | #define BCSR_SW_STAT_LED_CTRL 9 | ||
47 | #define BCSR_GPIO_IRQ_PAR_CTRL 10 | ||
48 | /* there's more, can't be bothered typing them tho */ | ||
49 | |||
50 | |||
51 | static struct of_device_id ep405_of_bus[] = { | ||
52 | { .compatible = "ibm,plb3", }, | ||
53 | { .compatible = "ibm,opb", }, | ||
54 | { .compatible = "ibm,ebc", }, | ||
55 | {}, | ||
56 | }; | ||
57 | |||
58 | static int __init ep405_device_probe(void) | ||
59 | { | ||
60 | if (!machine_is(ep405)) | ||
61 | return 0; | ||
62 | |||
63 | of_platform_bus_probe(NULL, ep405_of_bus, NULL); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | device_initcall(ep405_device_probe); | ||
68 | |||
69 | static void __init ep405_init_bcsr(void) | ||
70 | { | ||
71 | const u8 *irq_routing; | ||
72 | int i; | ||
73 | |||
74 | /* Find the bloody thing & map it */ | ||
75 | bcsr_node = of_find_compatible_node(NULL, NULL, "ep405-bcsr"); | ||
76 | if (bcsr_node == NULL) { | ||
77 | printk(KERN_ERR "EP405 BCSR not found !\n"); | ||
78 | return; | ||
79 | } | ||
80 | bcsr_regs = of_iomap(bcsr_node, 0); | ||
81 | if (bcsr_regs == NULL) { | ||
82 | printk(KERN_ERR "EP405 BCSR failed to map !\n"); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | /* Get the irq-routing property and apply the routing to the CPLD */ | ||
87 | irq_routing = of_get_property(bcsr_node, "irq-routing", NULL); | ||
88 | if (irq_routing == NULL) | ||
89 | return; | ||
90 | for (i = 0; i < 16; i++) { | ||
91 | u8 irq = irq_routing[i]; | ||
92 | out_8(bcsr_regs + BCSR_XIRQ_SELECT, i); | ||
93 | out_8(bcsr_regs + BCSR_XIRQ_ROUTING, irq); | ||
94 | } | ||
95 | in_8(bcsr_regs + BCSR_XIRQ_SELECT); | ||
96 | mb(); | ||
97 | out_8(bcsr_regs + BCSR_GPIO_IRQ_PAR_CTRL, 0xfe); | ||
98 | } | ||
99 | |||
100 | static void __init ep405_setup_arch(void) | ||
101 | { | ||
102 | /* Find & init the BCSR CPLD */ | ||
103 | ep405_init_bcsr(); | ||
104 | } | ||
105 | |||
106 | static int __init ep405_probe(void) | ||
107 | { | ||
108 | unsigned long root = of_get_flat_dt_root(); | ||
109 | |||
110 | if (!of_flat_dt_is_compatible(root, "ep405")) | ||
111 | return 0; | ||
112 | |||
113 | return 1; | ||
114 | } | ||
115 | |||
116 | define_machine(ep405) { | ||
117 | .name = "EP405", | ||
118 | .probe = ep405_probe, | ||
119 | .setup_arch = ep405_setup_arch, | ||
120 | .progress = udbg_progress, | ||
121 | .init_IRQ = uic_init_tree, | ||
122 | .get_irq = uic_get_irq, | ||
123 | .calibrate_decr = generic_calibrate_decr, | ||
124 | }; | ||