2 * MPC85xx DS Board Setup
4 * Author Xianghua Xiao (x.xiao@freescale.com)
5 * Roy Zang <tie-fei.zang@freescale.com>
6 * - Add PCI/PCI Exprees support
7 * Copyright 2007 Freescale Semiconductor Inc.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
15 #include <linux/stddef.h>
16 #include <linux/kernel.h>
17 #include <linux/pci.h>
18 #include <linux/kdev_t.h>
19 #include <linux/delay.h>
20 #include <linux/seq_file.h>
21 #include <linux/interrupt.h>
22 #include <linux/of_platform.h>
25 #include <asm/machdep.h>
26 #include <asm/pci-bridge.h>
27 #include <mm/mmu_decl.h>
31 #include <asm/i8259.h>
32 #include <asm/swiotlb.h>
34 #include <sysdev/fsl_soc.h>
35 #include <sysdev/fsl_pci.h>
43 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
45 #define DBG(fmt, args...)
48 #ifdef CONFIG_PPC_I8259
49 static void mpc85xx_8259_cascade(struct irq_desc *desc)
51 struct irq_chip *chip = irq_desc_get_chip(desc);
52 unsigned int cascade_irq = i8259_irq();
55 generic_handle_irq(cascade_irq);
57 chip->irq_eoi(&desc->irq_data);
59 #endif /* CONFIG_PPC_I8259 */
61 void __init mpc85xx_ds_pic_init(void)
64 #ifdef CONFIG_PPC_I8259
65 struct device_node *np;
66 struct device_node *cascade_node = NULL;
69 if (of_machine_is_compatible("fsl,MPC8572DS-CAMP")) {
70 mpic = mpic_alloc(NULL, 0,
76 mpic = mpic_alloc(NULL, 0,
85 #ifdef CONFIG_PPC_I8259
86 /* Initialize the i8259 controller */
87 for_each_node_by_type(np, "interrupt-controller")
88 if (of_device_is_compatible(np, "chrp,iic")) {
93 if (cascade_node == NULL) {
94 printk(KERN_DEBUG "Could not find i8259 PIC\n");
98 cascade_irq = irq_of_parse_and_map(cascade_node, 0);
100 printk(KERN_ERR "Failed to map cascade interrupt\n");
104 DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
106 i8259_init(cascade_node, 0);
107 of_node_put(cascade_node);
109 irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade);
110 #endif /* CONFIG_PPC_I8259 */
114 extern int uli_exclude_device(struct pci_controller *hose,
115 u_char bus, u_char devfn);
117 static struct device_node *pci_with_uli;
119 static int mpc85xx_exclude_device(struct pci_controller *hose,
120 u_char bus, u_char devfn)
122 if (hose->dn == pci_with_uli)
123 return uli_exclude_device(hose, bus, devfn);
125 return PCIBIOS_SUCCESSFUL;
127 #endif /* CONFIG_PCI */
129 static void __init mpc85xx_ds_uli_init(void)
132 struct device_node *node;
134 /* See if we have a ULI under the primary */
136 node = of_find_node_by_name(NULL, "uli1575");
137 while ((pci_with_uli = of_get_parent(node))) {
141 if (pci_with_uli == fsl_pci_primary) {
142 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
150 * Setup the architecture
152 static void __init mpc85xx_ds_setup_arch(void)
155 ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
158 fsl_pci_assign_primary();
159 mpc85xx_ds_uli_init();
162 printk("MPC85xx DS board from Freescale Semiconductor\n");
166 * Called very early, device-tree isn't unflattened
168 static int __init mpc8544_ds_probe(void)
170 return !!of_machine_is_compatible("MPC8544DS");
173 machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
174 machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
175 machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
178 * Called very early, device-tree isn't unflattened
180 static int __init mpc8572_ds_probe(void)
182 return !!of_machine_is_compatible("fsl,MPC8572DS");
186 * Called very early, device-tree isn't unflattened
188 static int __init p2020_ds_probe(void)
190 return !!of_machine_is_compatible("fsl,P2020DS");
193 define_machine(mpc8544_ds) {
194 .name = "MPC8544 DS",
195 .probe = mpc8544_ds_probe,
196 .setup_arch = mpc85xx_ds_setup_arch,
197 .init_IRQ = mpc85xx_ds_pic_init,
199 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
200 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
202 .get_irq = mpic_get_irq,
203 .calibrate_decr = generic_calibrate_decr,
204 .progress = udbg_progress,
207 define_machine(mpc8572_ds) {
208 .name = "MPC8572 DS",
209 .probe = mpc8572_ds_probe,
210 .setup_arch = mpc85xx_ds_setup_arch,
211 .init_IRQ = mpc85xx_ds_pic_init,
213 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
214 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
216 .get_irq = mpic_get_irq,
217 .calibrate_decr = generic_calibrate_decr,
218 .progress = udbg_progress,
221 define_machine(p2020_ds) {
223 .probe = p2020_ds_probe,
224 .setup_arch = mpc85xx_ds_setup_arch,
225 .init_IRQ = mpc85xx_ds_pic_init,
227 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
228 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
230 .get_irq = mpic_get_irq,
231 .calibrate_decr = generic_calibrate_decr,
232 .progress = udbg_progress,