blob: 106896c3b60a56c0a119222444ea1895238bc8de [file] [log] [blame]
Olof Johansson1e768752006-09-06 14:42:08 -05001/*
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
Olof Johansson1e768752006-09-06 14:42:08 -050025#include <linux/errno.h>
26#include <linux/kernel.h>
27#include <linux/delay.h>
28#include <linux/console.h>
29
30#include <asm/prom.h>
31#include <asm/system.h>
32#include <asm/iommu.h>
33#include <asm/machdep.h>
34#include <asm/mpic.h>
35#include <asm/smp.h>
36#include <asm/time.h>
37
38#include "pasemi.h"
39
40static void pas_restart(char *cmd)
41{
42 printk("restart unimplemented, looping...\n");
43 for (;;) ;
44}
45
46static void pas_power_off(void)
47{
48 printk("power off unimplemented, looping...\n");
49 for (;;) ;
50}
51
52static void pas_halt(void)
53{
54 pas_power_off();
55}
56
57#ifdef CONFIG_SMP
58struct smp_ops_t pas_smp_ops = {
59 .probe = smp_mpic_probe,
60 .message_pass = smp_mpic_message_pass,
61 .kick_cpu = smp_generic_kick_cpu,
62 .setup_cpu = smp_mpic_setup_cpu,
63 .give_timebase = smp_generic_give_timebase,
64 .take_timebase = smp_generic_take_timebase,
65};
66#endif /* CONFIG_SMP */
67
68void __init pas_setup_arch(void)
69{
70#ifdef CONFIG_SMP
71 /* Setup SMP callback */
72 smp_ops = &pas_smp_ops;
73#endif
74 /* Lookup PCI hosts */
75 pas_pci_init();
76
77#ifdef CONFIG_DUMMY_CONSOLE
78 conswitchp = &dummy_con;
79#endif
80
81 printk(KERN_DEBUG "Using default idle loop\n");
82}
83
84static void iommu_dev_setup_null(struct pci_dev *dev) { }
85static void iommu_bus_setup_null(struct pci_bus *bus) { }
86
87static void __init pas_init_early(void)
88{
89 /* No iommu code yet */
90 ppc_md.iommu_dev_setup = iommu_dev_setup_null;
91 ppc_md.iommu_bus_setup = iommu_bus_setup_null;
92 pci_direct_iommu_init();
93}
94
95/* No legacy IO on our parts */
96static int pas_check_legacy_ioport(unsigned int baseport)
97{
98 return -ENODEV;
99}
100
101static __init void pas_init_IRQ(void)
102{
103 struct device_node *np;
104 struct device_node *root, *mpic_node;
105 unsigned long openpic_addr;
106 const unsigned int *opprop;
107 int naddr, opplen;
108 struct mpic *mpic;
109
110 mpic_node = NULL;
111
112 for_each_node_by_type(np, "interrupt-controller")
113 if (device_is_compatible(np, "open-pic")) {
114 mpic_node = np;
115 break;
116 }
117 if (!mpic_node)
118 for_each_node_by_type(np, "open-pic") {
119 mpic_node = np;
120 break;
121 }
122 if (!mpic_node) {
123 printk(KERN_ERR
124 "Failed to locate the MPIC interrupt controller\n");
125 return;
126 }
127
128 /* Find address list in /platform-open-pic */
129 root = of_find_node_by_path("/");
130 naddr = prom_n_addr_cells(root);
131 opprop = get_property(root, "platform-open-pic", &opplen);
132 if (!opprop) {
133 printk(KERN_ERR "No platform-open-pic property.\n");
134 of_node_put(root);
135 return;
136 }
137 openpic_addr = of_read_number(opprop, naddr);
138 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
139 of_node_put(root);
140
141 mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0,
142 " PAS-OPIC ");
143 BUG_ON(!mpic);
144
145 mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
146 mpic_init(mpic);
147 of_node_put(mpic_node);
148 of_node_put(root);
149}
150
151static void __init pas_progress(char *s, unsigned short hex)
152{
153 printk("[%04x] : %s\n", hex, s ? s : "");
154}
155
156
157/*
158 * Called very early, MMU is off, device-tree isn't unflattened
159 */
160static int __init pas_probe(void)
161{
162 unsigned long root = of_get_flat_dt_root();
163
164 if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
165 return 0;
166
167 hpte_init_native();
168
169 return 1;
170}
171
172define_machine(pas) {
173 .name = "PA Semi PA6T-1682M",
174 .probe = pas_probe,
175 .setup_arch = pas_setup_arch,
176 .init_early = pas_init_early,
177 .init_IRQ = pas_init_IRQ,
178 .get_irq = mpic_get_irq,
179 .pcibios_fixup = pas_pcibios_fixup,
180 .restart = pas_restart,
181 .power_off = pas_power_off,
182 .halt = pas_halt,
183 .get_boot_time = pas_get_boot_time,
184 .calibrate_decr = generic_calibrate_decr,
185 .check_legacy_ioport = pas_check_legacy_ioport,
186 .progress = pas_progress,
187};