2 * Based on MPC8560 ADS and arch/ppc tqm85xx ports
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
6 * Copyright 2008 Freescale Semiconductor Inc.
8 * Copyright (c) 2005-2006 DENX Software Engineering
9 * Stefan Roese <sr@denx.de>
11 * Based on original work by
12 * Kumar Gala <kumar.gala@freescale.com>
13 * Copyright 2004 Freescale Semiconductor Inc.
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
21 #include <linux/stddef.h>
22 #include <linux/kernel.h>
23 #include <linux/pci.h>
24 #include <linux/kdev_t.h>
25 #include <linux/delay.h>
26 #include <linux/seq_file.h>
27 #include <linux/of_platform.h>
29 #include <asm/system.h>
31 #include <asm/machdep.h>
32 #include <asm/pci-bridge.h>
35 #include <mm/mmu_decl.h>
38 #include <sysdev/fsl_soc.h>
39 #include <sysdev/fsl_pci.h>
43 #include <sysdev/cpm2_pic.h>
45 static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
49 while ((cascade_irq = cpm2_get_irq()) >= 0)
50 generic_handle_irq(cascade_irq);
54 #endif /* CONFIG_CPM2 */
56 static void __init tqm85xx_pic_init(void)
60 struct device_node *np;
65 np = of_find_node_by_type(NULL, "open-pic");
67 printk(KERN_ERR "Could not find open-pic node\n");
71 if (of_address_to_resource(np, 0, &r)) {
72 printk(KERN_ERR "Could not map mpic register space\n");
77 mpic = mpic_alloc(np, r.start,
78 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
87 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
89 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
92 irq = irq_of_parse_and_map(np, 0);
96 printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");
102 set_irq_chained_handler(irq, cpm2_cascade);
107 * Setup the architecture
109 static void __init tqm85xx_setup_arch(void)
112 struct device_node *np;
116 ppc_md.progress("tqm85xx_setup_arch()", 0);
123 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
124 fsl_add_bridge(np, 1);
128 static void tqm85xx_show_cpuinfo(struct seq_file *m)
130 uint pvid, svid, phid1;
131 uint memsize = total_memory;
133 pvid = mfspr(SPRN_PVR);
134 svid = mfspr(SPRN_SVR);
136 seq_printf(m, "Vendor\t\t: TQ Components\n");
137 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
138 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
140 /* Display cpu Pll setting */
141 phid1 = mfspr(SPRN_HID1);
142 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
144 /* Display the amount of memory */
145 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
148 static struct of_device_id __initdata of_bus_ids[] = {
149 { .compatible = "simple-bus", },
153 static int __init declare_of_platform_devices(void)
155 of_platform_bus_probe(NULL, of_bus_ids, NULL);
159 machine_device_initcall(tqm85xx, declare_of_platform_devices);
162 * Called very early, device-tree isn't unflattened
164 static int __init tqm85xx_probe(void)
166 unsigned long root = of_get_flat_dt_root();
168 if ((of_flat_dt_is_compatible(root, "tqm,8540")) ||
169 (of_flat_dt_is_compatible(root, "tqm,8541")) ||
170 (of_flat_dt_is_compatible(root, "tqm,8555")) ||
171 (of_flat_dt_is_compatible(root, "tqm,8560")))
177 define_machine(tqm85xx) {
179 .probe = tqm85xx_probe,
180 .setup_arch = tqm85xx_setup_arch,
181 .init_IRQ = tqm85xx_pic_init,
182 .show_cpuinfo = tqm85xx_show_cpuinfo,
183 .get_irq = mpic_get_irq,
184 .restart = fsl_rstcr_restart,
185 .calibrate_decr = generic_calibrate_decr,
186 .progress = udbg_progress,