2 * P1022DS board specific routines
4 * Authors: Travis Wheatley <travis.wheatley@freescale.com>
5 * Dave Liu <daveliu@freescale.com>
6 * Timur Tabi <timur@freescale.com>
8 * Copyright 2010 Freescale Semiconductor, Inc.
10 * This file is taken from the Freescale P1022DS BSP, with modifications:
11 * 1) No DIU support (pending rewrite of DIU code)
13 * 3) No PCI endpoint support
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
20 #include <linux/pci.h>
21 #include <linux/of_platform.h>
22 #include <linux/lmb.h>
25 #include <asm/swiotlb.h>
27 #include <sysdev/fsl_soc.h>
28 #include <sysdev/fsl_pci.h>
30 void __init p1022_ds_pic_init(void)
34 struct device_node *np;
36 np = of_find_node_by_type(NULL, "open-pic");
38 pr_err("Could not find open-pic node\n");
42 if (of_address_to_resource(np, 0, &r)) {
43 pr_err("Failed to map mpic register space\n");
48 mpic = mpic_alloc(np, r.start,
49 MPIC_PRIMARY | MPIC_WANTS_RESET |
50 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
61 void __init mpc85xx_smp_init(void);
65 * Setup the architecture
67 static void __init p1022_ds_setup_arch(void)
70 struct device_node *np;
72 dma_addr_t max = 0xffffffff;
75 ppc_md.progress("p1022_ds_setup_arch()", 0);
78 for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
80 struct pci_controller *hose;
82 of_address_to_resource(np, 0, &rsrc);
84 if ((rsrc.start & 0xfffff) == 0x8000)
85 fsl_add_bridge(np, 1);
87 fsl_add_bridge(np, 0);
89 hose = pci_find_hose_for_OF_device(np);
90 max = min(max, hose->dma_window_base_cur +
91 hose->dma_window_size);
100 if (lmb_end_of_DRAM() > max) {
101 ppc_swiotlb_enable = 1;
102 set_pci_dma_ops(&swiotlb_dma_ops);
103 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
107 pr_info("Freescale P1022 DS reference board\n");
110 static struct of_device_id __initdata p1022_ds_ids[] = {
112 { .compatible = "soc", },
113 { .compatible = "simple-bus", },
114 { .compatible = "gianfar", },
118 static int __init p1022_ds_publish_devices(void)
120 return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
122 machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
124 machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
127 * Called very early, device-tree isn't unflattened
129 static int __init p1022_ds_probe(void)
131 unsigned long root = of_get_flat_dt_root();
133 return of_flat_dt_is_compatible(root, "fsl,p1022ds");
136 define_machine(p1022_ds) {
138 .probe = p1022_ds_probe,
139 .setup_arch = p1022_ds_setup_arch,
140 .init_IRQ = p1022_ds_pic_init,
142 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
144 .get_irq = mpic_get_irq,
145 .restart = fsl_rstcr_restart,
146 .calibrate_decr = generic_calibrate_decr,
147 .progress = udbg_progress,