2 * Corenet based SoC DS Setup
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
6 * Copyright 2009-2011 Freescale Semiconductor Inc.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/kernel.h>
15 #include <linux/pci.h>
16 #include <linux/kdev_t.h>
17 #include <linux/delay.h>
18 #include <linux/interrupt.h>
21 #include <asm/machdep.h>
22 #include <asm/pci-bridge.h>
23 #include <asm/ppc-pci.h>
24 #include <mm/mmu_decl.h>
28 #include <asm/ehv_pic.h>
29 #include <asm/qe_ic.h>
31 #include <linux/of_platform.h>
32 #include <sysdev/fsl_soc.h>
33 #include <sysdev/fsl_pci.h>
37 void __init corenet_gen_pic_init(void)
40 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
43 struct device_node *np;
45 if (ppc_md.get_irq == mpic_get_coreint_irq)
46 flags |= MPIC_ENABLE_COREINT;
48 mpic = mpic_alloc(NULL, 0, flags, 0, 512, " OpenPIC ");
53 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
55 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
56 qe_ic_cascade_high_mpic);
62 * Setup the architecture
64 void __init corenet_gen_setup_arch(void)
70 pr_info("%s board\n", ppc_md.name);
75 static const struct of_device_id of_device_ids[] = {
77 .compatible = "simple-bus"
80 .compatible = "fsl,srio",
83 .compatible = "fsl,p4080-pcie",
86 .compatible = "fsl,qoriq-pcie-v2.2",
89 .compatible = "fsl,qoriq-pcie-v2.3",
92 .compatible = "fsl,qoriq-pcie-v2.4",
95 .compatible = "fsl,qoriq-pcie-v3.0",
98 .compatible = "fsl,qe",
100 /* The following two are for the Freescale hypervisor */
102 .name = "hypervisor",
110 int __init corenet_gen_publish_devices(void)
112 return of_platform_bus_probe(NULL, of_device_ids, NULL);
115 static const char * const boards[] __initconst = {
132 static const char * const hv_boards[] __initconst = {
149 * Called very early, device-tree isn't unflattened
151 static int __init corenet_generic_probe(void)
153 unsigned long root = of_get_flat_dt_root();
155 extern struct smp_ops_t smp_85xx_ops;
158 if (of_flat_dt_match(root, boards))
161 /* Check if we're running under the Freescale hypervisor */
162 if (of_flat_dt_match(root, hv_boards)) {
163 ppc_md.init_IRQ = ehv_pic_init;
164 ppc_md.get_irq = ehv_pic_get_irq;
165 ppc_md.restart = fsl_hv_restart;
166 ppc_md.power_off = fsl_hv_halt;
167 ppc_md.halt = fsl_hv_halt;
170 * Disable the timebase sync operations because we can't write
171 * to the timebase registers under the hypervisor.
173 smp_85xx_ops.give_timebase = NULL;
174 smp_85xx_ops.take_timebase = NULL;
182 define_machine(corenet_generic) {
183 .name = "CoreNet Generic",
184 .probe = corenet_generic_probe,
185 .setup_arch = corenet_gen_setup_arch,
186 .init_IRQ = corenet_gen_pic_init,
188 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
189 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
191 .get_irq = mpic_get_coreint_irq,
192 .restart = fsl_rstcr_restart,
193 .calibrate_decr = generic_calibrate_decr,
194 .progress = udbg_progress,
196 .power_save = book3e_idle,
198 .power_save = e500_idle,
202 machine_arch_initcall(corenet_generic, corenet_gen_publish_devices);
204 #ifdef CONFIG_SWIOTLB
205 machine_arch_initcall(corenet_generic, swiotlb_setup_bus_notifier);