2 * Wind River SBC8548 setup and early boot code.
4 * Copyright 2007 Wind River Systems Inc.
6 * By Paul Gortmaker (see MAINTAINERS for contact information)
8 * Based largely on the MPC8548CDS support - Copyright 2005 Freescale Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
17 #include <linux/stddef.h>
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/errno.h>
21 #include <linux/reboot.h>
22 #include <linux/pci.h>
23 #include <linux/kdev_t.h>
24 #include <linux/major.h>
25 #include <linux/console.h>
26 #include <linux/delay.h>
27 #include <linux/seq_file.h>
28 #include <linux/initrd.h>
29 #include <linux/interrupt.h>
30 #include <linux/fsl_devices.h>
31 #include <linux/of_platform.h>
33 #include <asm/system.h>
34 #include <asm/pgtable.h>
36 #include <linux/atomic.h>
39 #include <asm/machdep.h>
41 #include <asm/pci-bridge.h>
43 #include <mm/mmu_decl.h>
48 #include <sysdev/fsl_soc.h>
49 #include <sysdev/fsl_pci.h>
53 static void __init
sbc8548_pic_init(void)
57 struct device_node
*np
= NULL
;
59 np
= of_find_node_by_type(np
, "open-pic");
62 printk(KERN_ERR
"Could not find open-pic node\n");
66 if (of_address_to_resource(np
, 0, &r
)) {
67 printk(KERN_ERR
"Failed to map mpic register space\n");
72 mpic
= mpic_alloc(np
, r
.start
,
73 MPIC_PRIMARY
| MPIC_WANTS_RESET
| MPIC_BIG_ENDIAN
,
77 /* Return the mpic node */
83 /* Extract the HW Rev from the EPLD on the board */
84 static int __init
sbc8548_hw_rev(void)
86 struct device_node
*np
;
91 np
= of_find_compatible_node(NULL
, NULL
, "hw-rev");
93 printk("No HW-REV found in DTB.\n");
97 of_address_to_resource(np
, 0, &res
);
100 rev
= ioremap(res
.start
,sizeof(unsigned int));
101 board_rev
= (*rev
) >> 28;
108 * Setup the architecture
110 static void __init
sbc8548_setup_arch(void)
113 struct device_node
*np
;
117 ppc_md
.progress("sbc8548_setup_arch()", 0);
120 for_each_node_by_type(np
, "pci") {
121 if (of_device_is_compatible(np
, "fsl,mpc8540-pci") ||
122 of_device_is_compatible(np
, "fsl,mpc8548-pcie")) {
123 struct resource rsrc
;
124 of_address_to_resource(np
, 0, &rsrc
);
125 if ((rsrc
.start
& 0xfffff) == 0x8000)
126 fsl_add_bridge(np
, 1);
128 fsl_add_bridge(np
, 0);
132 sbc_rev
= sbc8548_hw_rev();
135 static void sbc8548_show_cpuinfo(struct seq_file
*m
)
137 uint pvid
, svid
, phid1
;
139 pvid
= mfspr(SPRN_PVR
);
140 svid
= mfspr(SPRN_SVR
);
142 seq_printf(m
, "Vendor\t\t: Wind River\n");
143 seq_printf(m
, "Machine\t\t: SBC8548 v%d\n", sbc_rev
);
144 seq_printf(m
, "PVR\t\t: 0x%x\n", pvid
);
145 seq_printf(m
, "SVR\t\t: 0x%x\n", svid
);
147 /* Display cpu Pll setting */
148 phid1
= mfspr(SPRN_HID1
);
149 seq_printf(m
, "PLL setting\t: 0x%x\n", ((phid1
>> 24) & 0x3f));
152 static struct of_device_id __initdata of_bus_ids
[] = {
155 { .compatible
= "simple-bus", },
156 { .compatible
= "gianfar", },
160 static int __init
declare_of_platform_devices(void)
162 of_platform_bus_probe(NULL
, of_bus_ids
, NULL
);
166 machine_device_initcall(sbc8548
, declare_of_platform_devices
);
169 * Called very early, device-tree isn't unflattened
171 static int __init
sbc8548_probe(void)
173 unsigned long root
= of_get_flat_dt_root();
175 return of_flat_dt_is_compatible(root
, "SBC8548");
178 define_machine(sbc8548
) {
180 .probe
= sbc8548_probe
,
181 .setup_arch
= sbc8548_setup_arch
,
182 .init_IRQ
= sbc8548_pic_init
,
183 .show_cpuinfo
= sbc8548_show_cpuinfo
,
184 .get_irq
= mpic_get_irq
,
185 .restart
= fsl_rstcr_restart
,
187 .pcibios_fixup_bus
= fsl_pcibios_fixup_bus
,
189 .calibrate_decr
= generic_calibrate_decr
,
190 .progress
= udbg_progress
,