2 * MPC8544 DS Board Setup
4 * Author Xianghua Xiao (x.xiao@freescale.com)
5 * Copyright 2007 Freescale Semiconductor Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include <linux/stddef.h>
14 #include <linux/kernel.h>
15 #include <linux/kdev_t.h>
16 #include <linux/delay.h>
17 #include <linux/seq_file.h>
19 #include <asm/system.h>
21 #include <asm/machdep.h>
22 #include <asm/mpc85xx.h>
23 #include <mm/mmu_decl.h>
27 #include <asm/i8259.h>
29 #include <sysdev/fsl_soc.h>
35 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
37 #define DBG(fmt, args...)
41 void __init mpc8544_ds_pic_init(void)
45 struct device_node *np = NULL;
46 #ifdef CONFIG_PPC_I8259
47 struct device_node *cascade_node = NULL;
51 np = of_find_node_by_type(np, "open-pic");
54 printk(KERN_ERR "Could not find open-pic node\n");
58 if (of_address_to_resource(np, 0, &r)) {
59 printk(KERN_ERR "Failed to map mpic register space\n");
64 /* Alloc mpic structure and per isu has 16 INT entries. */
65 mpic = mpic_alloc(np, r.start,
66 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
71 * 48 Internal Interrupts
73 mpic_assign_isu(mpic, 0, r.start + 0x10200);
74 mpic_assign_isu(mpic, 1, r.start + 0x10400);
75 mpic_assign_isu(mpic, 2, r.start + 0x10600);
78 * 16 External interrupts
80 mpic_assign_isu(mpic, 3, r.start + 0x10000);
84 #ifdef CONFIG_PPC_I8259
85 /* Initialize the i8259 controller */
86 for_each_node_by_type(np, "interrupt-controller")
87 if (of_device_is_compatible(np, "chrp,iic")) {
92 if (cascade_node == NULL) {
93 printk(KERN_DEBUG "Could not find i8259 PIC\n");
97 cascade_irq = irq_of_parse_and_map(cascade_node, 0);
98 if (cascade_irq == NO_IRQ) {
99 printk(KERN_ERR "Failed to map cascade interrupt\n");
103 DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
105 i8259_init(cascade_node, 0);
106 of_node_put(cascade_node);
108 set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
109 #endif /* CONFIG_PPC_I8259 */
114 * Setup the architecture
116 static void __init mpc8544_ds_setup_arch(void)
119 ppc_md.progress("mpc8544_ds_setup_arch()", 0);
121 printk("MPC8544 DS board from Freescale Semiconductor\n");
126 * Called very early, device-tree isn't unflattened
128 static int __init mpc8544_ds_probe(void)
130 unsigned long root = of_get_flat_dt_root();
132 return of_flat_dt_is_compatible(root, "MPC8544DS");
135 define_machine(mpc8544_ds) {
136 .name = "MPC8544 DS",
137 .probe = mpc8544_ds_probe,
138 .setup_arch = mpc8544_ds_setup_arch,
139 .init_IRQ = mpc8544_ds_pic_init,
140 .get_irq = mpic_get_irq,
141 .restart = mpc85xx_restart,
142 .calibrate_decr = generic_calibrate_decr,
143 .progress = udbg_progress,