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/pgtable.h>
24 #include <asm/ppc-pci.h>
25 #include <mm/mmu_decl.h>
29 #include <asm/ehv_pic.h>
30 #include <asm/qe_ic.h>
32 #include <linux/of_platform.h>
33 #include <sysdev/fsl_soc.h>
34 #include <sysdev/fsl_pci.h>
38 void __init corenet_gen_pic_init(void)
41 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
44 struct device_node *np;
46 if (ppc_md.get_irq == mpic_get_coreint_irq)
47 flags |= MPIC_ENABLE_COREINT;
49 mpic = mpic_alloc(NULL, 0, flags, 0, 512, " OpenPIC ");
54 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
56 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
57 qe_ic_cascade_high_mpic);
63 * Setup the architecture
65 void __init corenet_gen_setup_arch(void)
71 #if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
73 * Inbound windows don't cover the full lower 4 GiB
74 * due to conflicts with PCICSRBAR and outbound windows,
75 * so limit the DMA32 zone to 2 GiB, to allow consistent
76 * allocations to succeed.
78 limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
81 pr_info("%s board\n", ppc_md.name);
86 static const struct of_device_id of_device_ids[] = {
88 .compatible = "simple-bus"
91 .compatible = "mdio-mux-gpio"
94 .compatible = "fsl,fpga-ngpixis"
97 .compatible = "fsl,fpga-qixis"
100 .compatible = "fsl,srio",
103 .compatible = "fsl,p4080-pcie",
106 .compatible = "fsl,qoriq-pcie-v2.2",
109 .compatible = "fsl,qoriq-pcie-v2.3",
112 .compatible = "fsl,qoriq-pcie-v2.4",
115 .compatible = "fsl,qoriq-pcie-v3.0",
118 .compatible = "fsl,qe",
121 .compatible = "fsl,fman",
123 /* The following two are for the Freescale hypervisor */
125 .name = "hypervisor",
133 int __init corenet_gen_publish_devices(void)
135 return of_platform_bus_probe(NULL, of_device_ids, NULL);
138 static const char * const boards[] __initconst = {
169 * Called very early, device-tree isn't unflattened
171 static int __init corenet_generic_probe(void)
173 unsigned long root = of_get_flat_dt_root();
177 extern struct smp_ops_t smp_85xx_ops;
180 if (of_flat_dt_match(root, boards))
183 /* Check if we're running under the Freescale hypervisor */
184 for (i = 0; boards[i]; i++) {
185 snprintf(hv_compat, sizeof(hv_compat), "%s-hv", boards[i]);
186 if (of_flat_dt_is_compatible(root, hv_compat)) {
187 ppc_md.init_IRQ = ehv_pic_init;
189 ppc_md.get_irq = ehv_pic_get_irq;
190 ppc_md.restart = fsl_hv_restart;
191 pm_power_off = fsl_hv_halt;
192 ppc_md.halt = fsl_hv_halt;
195 * Disable the timebase sync operations because we
196 * can't write to the timebase registers under the
199 smp_85xx_ops.give_timebase = NULL;
200 smp_85xx_ops.take_timebase = NULL;
209 define_machine(corenet_generic) {
210 .name = "CoreNet Generic",
211 .probe = corenet_generic_probe,
212 .setup_arch = corenet_gen_setup_arch,
213 .init_IRQ = corenet_gen_pic_init,
215 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
216 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
219 * Core reset may cause issues if using the proxy mode of MPIC.
220 * So, use the mixed mode of MPIC if enabling CPU hotplug.
222 * Likewise, problems have been seen with kexec when coreint is enabled.
224 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC)
225 .get_irq = mpic_get_irq,
227 .get_irq = mpic_get_coreint_irq,
229 .restart = fsl_rstcr_restart,
230 .calibrate_decr = generic_calibrate_decr,
231 .progress = udbg_progress,
233 .power_save = book3e_idle,
235 .power_save = e500_idle,
239 machine_arch_initcall(corenet_generic, corenet_gen_publish_devices);
241 #ifdef CONFIG_SWIOTLB
242 machine_arch_initcall(corenet_generic, swiotlb_setup_bus_notifier);