diff options
Diffstat (limited to 'arch/powerpc/platforms/pasemi/setup.c')
-rw-r--r-- | arch/powerpc/platforms/pasemi/setup.c | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c new file mode 100644 index 000000000000..628482671c15 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/setup.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 PA Semi, Inc | ||
3 | * | ||
4 | * Authors: Kip Walker, PA Semi | ||
5 | * Olof Johansson, PA Semi | ||
6 | * | ||
7 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
8 | * | ||
9 | * Based on arch/powerpc/platforms/maple/setup.c | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/config.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/console.h> | ||
30 | |||
31 | #include <asm/prom.h> | ||
32 | #include <asm/system.h> | ||
33 | #include <asm/iommu.h> | ||
34 | #include <asm/machdep.h> | ||
35 | #include <asm/mpic.h> | ||
36 | #include <asm/smp.h> | ||
37 | #include <asm/time.h> | ||
38 | |||
39 | #include "pasemi.h" | ||
40 | |||
41 | static void pas_restart(char *cmd) | ||
42 | { | ||
43 | printk("restart unimplemented, looping...\n"); | ||
44 | for (;;) ; | ||
45 | } | ||
46 | |||
47 | static void pas_power_off(void) | ||
48 | { | ||
49 | printk("power off unimplemented, looping...\n"); | ||
50 | for (;;) ; | ||
51 | } | ||
52 | |||
53 | static void pas_halt(void) | ||
54 | { | ||
55 | pas_power_off(); | ||
56 | } | ||
57 | |||
58 | #ifdef CONFIG_SMP | ||
59 | struct smp_ops_t pas_smp_ops = { | ||
60 | .probe = smp_mpic_probe, | ||
61 | .message_pass = smp_mpic_message_pass, | ||
62 | .kick_cpu = smp_generic_kick_cpu, | ||
63 | .setup_cpu = smp_mpic_setup_cpu, | ||
64 | .give_timebase = smp_generic_give_timebase, | ||
65 | .take_timebase = smp_generic_take_timebase, | ||
66 | }; | ||
67 | #endif /* CONFIG_SMP */ | ||
68 | |||
69 | void __init pas_setup_arch(void) | ||
70 | { | ||
71 | #ifdef CONFIG_SMP | ||
72 | /* Setup SMP callback */ | ||
73 | smp_ops = &pas_smp_ops; | ||
74 | #endif | ||
75 | /* Lookup PCI hosts */ | ||
76 | pas_pci_init(); | ||
77 | |||
78 | #ifdef CONFIG_DUMMY_CONSOLE | ||
79 | conswitchp = &dummy_con; | ||
80 | #endif | ||
81 | |||
82 | printk(KERN_DEBUG "Using default idle loop\n"); | ||
83 | } | ||
84 | |||
85 | static void iommu_dev_setup_null(struct pci_dev *dev) { } | ||
86 | static void iommu_bus_setup_null(struct pci_bus *bus) { } | ||
87 | |||
88 | static void __init pas_init_early(void) | ||
89 | { | ||
90 | /* No iommu code yet */ | ||
91 | ppc_md.iommu_dev_setup = iommu_dev_setup_null; | ||
92 | ppc_md.iommu_bus_setup = iommu_bus_setup_null; | ||
93 | pci_direct_iommu_init(); | ||
94 | } | ||
95 | |||
96 | /* No legacy IO on our parts */ | ||
97 | static int pas_check_legacy_ioport(unsigned int baseport) | ||
98 | { | ||
99 | return -ENODEV; | ||
100 | } | ||
101 | |||
102 | static __init void pas_init_IRQ(void) | ||
103 | { | ||
104 | struct device_node *np; | ||
105 | struct device_node *root, *mpic_node; | ||
106 | unsigned long openpic_addr; | ||
107 | const unsigned int *opprop; | ||
108 | int naddr, opplen; | ||
109 | struct mpic *mpic; | ||
110 | |||
111 | mpic_node = NULL; | ||
112 | |||
113 | for_each_node_by_type(np, "interrupt-controller") | ||
114 | if (device_is_compatible(np, "open-pic")) { | ||
115 | mpic_node = np; | ||
116 | break; | ||
117 | } | ||
118 | if (!mpic_node) | ||
119 | for_each_node_by_type(np, "open-pic") { | ||
120 | mpic_node = np; | ||
121 | break; | ||
122 | } | ||
123 | if (!mpic_node) { | ||
124 | printk(KERN_ERR | ||
125 | "Failed to locate the MPIC interrupt controller\n"); | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | /* Find address list in /platform-open-pic */ | ||
130 | root = of_find_node_by_path("/"); | ||
131 | naddr = prom_n_addr_cells(root); | ||
132 | opprop = get_property(root, "platform-open-pic", &opplen); | ||
133 | if (!opprop) { | ||
134 | printk(KERN_ERR "No platform-open-pic property.\n"); | ||
135 | of_node_put(root); | ||
136 | return; | ||
137 | } | ||
138 | openpic_addr = of_read_number(opprop, naddr); | ||
139 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); | ||
140 | of_node_put(root); | ||
141 | |||
142 | mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0, | ||
143 | " PAS-OPIC "); | ||
144 | BUG_ON(!mpic); | ||
145 | |||
146 | mpic_assign_isu(mpic, 0, openpic_addr + 0x10000); | ||
147 | mpic_init(mpic); | ||
148 | of_node_put(mpic_node); | ||
149 | of_node_put(root); | ||
150 | } | ||
151 | |||
152 | static void __init pas_progress(char *s, unsigned short hex) | ||
153 | { | ||
154 | printk("[%04x] : %s\n", hex, s ? s : ""); | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Called very early, MMU is off, device-tree isn't unflattened | ||
160 | */ | ||
161 | static int __init pas_probe(void) | ||
162 | { | ||
163 | unsigned long root = of_get_flat_dt_root(); | ||
164 | |||
165 | if (!of_flat_dt_is_compatible(root, "PA6T-1682M")) | ||
166 | return 0; | ||
167 | |||
168 | hpte_init_native(); | ||
169 | |||
170 | return 1; | ||
171 | } | ||
172 | |||
173 | define_machine(pas) { | ||
174 | .name = "PA Semi PA6T-1682M", | ||
175 | .probe = pas_probe, | ||
176 | .setup_arch = pas_setup_arch, | ||
177 | .init_early = pas_init_early, | ||
178 | .init_IRQ = pas_init_IRQ, | ||
179 | .get_irq = mpic_get_irq, | ||
180 | .pcibios_fixup = pas_pcibios_fixup, | ||
181 | .restart = pas_restart, | ||
182 | .power_off = pas_power_off, | ||
183 | .halt = pas_halt, | ||
184 | .get_boot_time = pas_get_boot_time, | ||
185 | .calibrate_decr = generic_calibrate_decr, | ||
186 | .check_legacy_ioport = pas_check_legacy_ioport, | ||
187 | .progress = pas_progress, | ||
188 | }; | ||