2 * Based on MPC8560 ADS and arch/ppc stx_gp3 ports
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
6 * Copyright 2008 Freescale Semiconductor Inc.
8 * Dan Malek <dan@embeddededge.com>
9 * Copyright 2004 Embedded Edge, LLC
11 * Copied from mpc8560_ads.c
12 * Copyright 2002, 2003 Motorola Inc.
14 * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
15 * Copyright 2004-2005 MontaVista Software, Inc.
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
23 #include <linux/stddef.h>
24 #include <linux/kernel.h>
25 #include <linux/pci.h>
26 #include <linux/kdev_t.h>
27 #include <linux/delay.h>
28 #include <linux/seq_file.h>
29 #include <linux/of_platform.h>
31 #include <asm/system.h>
33 #include <asm/machdep.h>
34 #include <asm/pci-bridge.h>
37 #include <mm/mmu_decl.h>
40 #include <sysdev/fsl_soc.h>
41 #include <sysdev/fsl_pci.h>
45 #include <sysdev/cpm2_pic.h>
47 static void cpm2_cascade(unsigned int irq
, struct irq_desc
*desc
)
51 while ((cascade_irq
= cpm2_get_irq()) >= 0)
52 generic_handle_irq(cascade_irq
);
56 #endif /* CONFIG_CPM2 */
58 static void __init
stx_gp3_pic_init(void)
62 struct device_node
*np
;
67 np
= of_find_node_by_type(NULL
, "open-pic");
69 printk(KERN_ERR
"Could not find open-pic node\n");
73 if (of_address_to_resource(np
, 0, &r
)) {
74 printk(KERN_ERR
"Could not map mpic register space\n");
79 mpic
= mpic_alloc(np
, r
.start
,
80 MPIC_PRIMARY
| MPIC_WANTS_RESET
| MPIC_BIG_ENDIAN
,
89 np
= of_find_compatible_node(NULL
, NULL
, "fsl,cpm2-pic");
91 printk(KERN_ERR
"PIC init: can not find fsl,cpm2-pic node\n");
94 irq
= irq_of_parse_and_map(np
, 0);
98 printk(KERN_ERR
"PIC init: got no IRQ for cpm cascade\n");
104 set_irq_chained_handler(irq
, cpm2_cascade
);
109 * Setup the architecture
111 static void __init
stx_gp3_setup_arch(void)
114 struct device_node
*np
;
118 ppc_md
.progress("stx_gp3_setup_arch()", 0);
125 for_each_compatible_node(np
, "pci", "fsl,mpc8540-pci")
126 fsl_add_bridge(np
, 1);
130 static void stx_gp3_show_cpuinfo(struct seq_file
*m
)
132 uint pvid
, svid
, phid1
;
134 pvid
= mfspr(SPRN_PVR
);
135 svid
= mfspr(SPRN_SVR
);
137 seq_printf(m
, "Vendor\t\t: RPC Electronics STx \n");
138 seq_printf(m
, "PVR\t\t: 0x%x\n", pvid
);
139 seq_printf(m
, "SVR\t\t: 0x%x\n", svid
);
141 /* Display cpu Pll setting */
142 phid1
= mfspr(SPRN_HID1
);
143 seq_printf(m
, "PLL setting\t: 0x%x\n", ((phid1
>> 24) & 0x3f));
146 static struct of_device_id __initdata of_bus_ids
[] = {
147 { .compatible
= "simple-bus", },
151 static int __init
declare_of_platform_devices(void)
153 of_platform_bus_probe(NULL
, of_bus_ids
, NULL
);
157 machine_device_initcall(stx_gp3
, declare_of_platform_devices
);
160 * Called very early, device-tree isn't unflattened
162 static int __init
stx_gp3_probe(void)
164 unsigned long root
= of_get_flat_dt_root();
166 return of_flat_dt_is_compatible(root
, "stx,gp3-8560");
169 define_machine(stx_gp3
) {
171 .probe
= stx_gp3_probe
,
172 .setup_arch
= stx_gp3_setup_arch
,
173 .init_IRQ
= stx_gp3_pic_init
,
174 .show_cpuinfo
= stx_gp3_show_cpuinfo
,
175 .get_irq
= mpic_get_irq
,
176 .restart
= fsl_rstcr_restart
,
177 .calibrate_decr
= generic_calibrate_decr
,
178 .progress
= udbg_progress
,