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>
23 #include <linux/memblock.h>
26 #include <asm/machdep.h>
27 #include <asm/pci-bridge.h>
28 #include <mm/mmu_decl.h>
32 #include <asm/i8259.h>
33 #include <asm/swiotlb.h>
35 #include <sysdev/fsl_soc.h>
36 #include <sysdev/fsl_pci.h>
44 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
46 #define DBG(fmt, args...)
49 #ifdef CONFIG_PPC_I8259
50 static void mpc85xx_8259_cascade(unsigned int irq
, struct irq_desc
*desc
)
52 struct irq_chip
*chip
= irq_desc_get_chip(desc
);
53 unsigned int cascade_irq
= i8259_irq();
55 if (cascade_irq
!= NO_IRQ
) {
56 generic_handle_irq(cascade_irq
);
58 chip
->irq_eoi(&desc
->irq_data
);
60 #endif /* CONFIG_PPC_I8259 */
62 void __init
mpc85xx_ds_pic_init(void)
65 #ifdef CONFIG_PPC_I8259
66 struct device_node
*np
;
67 struct device_node
*cascade_node
= NULL
;
70 unsigned long root
= of_get_flat_dt_root();
72 if (of_flat_dt_is_compatible(root
, "fsl,MPC8572DS-CAMP")) {
73 mpic
= mpic_alloc(NULL
, 0,
79 mpic
= mpic_alloc(NULL
, 0,
88 #ifdef CONFIG_PPC_I8259
89 /* Initialize the i8259 controller */
90 for_each_node_by_type(np
, "interrupt-controller")
91 if (of_device_is_compatible(np
, "chrp,iic")) {
96 if (cascade_node
== NULL
) {
97 printk(KERN_DEBUG
"Could not find i8259 PIC\n");
101 cascade_irq
= irq_of_parse_and_map(cascade_node
, 0);
102 if (cascade_irq
== NO_IRQ
) {
103 printk(KERN_ERR
"Failed to map cascade interrupt\n");
107 DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq
);
109 i8259_init(cascade_node
, 0);
110 of_node_put(cascade_node
);
112 irq_set_chained_handler(cascade_irq
, mpc85xx_8259_cascade
);
113 #endif /* CONFIG_PPC_I8259 */
117 extern int uli_exclude_device(struct pci_controller
*hose
,
118 u_char bus
, u_char devfn
);
120 static struct device_node
*pci_with_uli
;
122 static int mpc85xx_exclude_device(struct pci_controller
*hose
,
123 u_char bus
, u_char devfn
)
125 if (hose
->dn
== pci_with_uli
)
126 return uli_exclude_device(hose
, bus
, devfn
);
128 return PCIBIOS_SUCCESSFUL
;
130 #endif /* CONFIG_PCI */
132 static void __init
mpc85xx_ds_pci_init(void)
135 struct device_node
*node
;
139 /* See if we have a ULI under the primary */
141 node
= of_find_node_by_name(NULL
, "uli1575");
142 while ((pci_with_uli
= of_get_parent(node
))) {
146 if (pci_with_uli
== fsl_pci_primary
) {
147 ppc_md
.pci_exclude_device
= mpc85xx_exclude_device
;
155 * Setup the architecture
157 static void __init
mpc85xx_ds_setup_arch(void)
160 ppc_md
.progress("mpc85xx_ds_setup_arch()", 0);
162 mpc85xx_ds_pci_init();
165 printk("MPC85xx DS board from Freescale Semiconductor\n");
169 * Called very early, device-tree isn't unflattened
171 static int __init
mpc8544_ds_probe(void)
173 unsigned long root
= of_get_flat_dt_root();
175 return !!of_flat_dt_is_compatible(root
, "MPC8544DS");
178 machine_device_initcall(mpc8544_ds
, mpc85xx_common_publish_devices
);
179 machine_device_initcall(mpc8572_ds
, mpc85xx_common_publish_devices
);
180 machine_device_initcall(p2020_ds
, mpc85xx_common_publish_devices
);
182 machine_arch_initcall(mpc8544_ds
, swiotlb_setup_bus_notifier
);
183 machine_arch_initcall(mpc8572_ds
, swiotlb_setup_bus_notifier
);
184 machine_arch_initcall(p2020_ds
, swiotlb_setup_bus_notifier
);
187 * Called very early, device-tree isn't unflattened
189 static int __init
mpc8572_ds_probe(void)
191 unsigned long root
= of_get_flat_dt_root();
193 return !!of_flat_dt_is_compatible(root
, "fsl,MPC8572DS");
197 * Called very early, device-tree isn't unflattened
199 static int __init
p2020_ds_probe(void)
201 unsigned long root
= of_get_flat_dt_root();
203 return !!of_flat_dt_is_compatible(root
, "fsl,P2020DS");
206 define_machine(mpc8544_ds
) {
207 .name
= "MPC8544 DS",
208 .probe
= mpc8544_ds_probe
,
209 .setup_arch
= mpc85xx_ds_setup_arch
,
210 .init_IRQ
= mpc85xx_ds_pic_init
,
212 .pcibios_fixup_bus
= fsl_pcibios_fixup_bus
,
214 .get_irq
= mpic_get_irq
,
215 .restart
= fsl_rstcr_restart
,
216 .calibrate_decr
= generic_calibrate_decr
,
217 .progress
= udbg_progress
,
220 define_machine(mpc8572_ds
) {
221 .name
= "MPC8572 DS",
222 .probe
= mpc8572_ds_probe
,
223 .setup_arch
= mpc85xx_ds_setup_arch
,
224 .init_IRQ
= mpc85xx_ds_pic_init
,
226 .pcibios_fixup_bus
= fsl_pcibios_fixup_bus
,
228 .get_irq
= mpic_get_irq
,
229 .restart
= fsl_rstcr_restart
,
230 .calibrate_decr
= generic_calibrate_decr
,
231 .progress
= udbg_progress
,
234 define_machine(p2020_ds
) {
236 .probe
= p2020_ds_probe
,
237 .setup_arch
= mpc85xx_ds_setup_arch
,
238 .init_IRQ
= mpc85xx_ds_pic_init
,
240 .pcibios_fixup_bus
= fsl_pcibios_fixup_bus
,
242 .get_irq
= mpic_get_irq
,
243 .restart
= fsl_rstcr_restart
,
244 .calibrate_decr
= generic_calibrate_decr
,
245 .progress
= udbg_progress
,