2 * MPC86xx HPCN board specific routines
4 * Recode: ZHANG WEI <wei.zhang@freescale.com>
5 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
7 * Copyright 2006 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/of_platform.h>
23 #include <asm/system.h>
25 #include <asm/machdep.h>
26 #include <asm/pci-bridge.h>
28 #include <mm/mmu_decl.h>
33 #include <sysdev/fsl_pci.h>
34 #include <sysdev/fsl_soc.h>
41 #define DBG(fmt...) do { printk(KERN_ERR fmt); } while(0)
43 #define DBG(fmt...) do { } while(0)
47 extern int uli_exclude_device(struct pci_controller *hose,
48 u_char bus, u_char devfn);
50 static int mpc86xx_exclude_device(struct pci_controller *hose,
51 u_char bus, u_char devfn)
53 struct device_node* node;
57 of_address_to_resource(node, 0, &rsrc);
59 if ((rsrc.start & 0xfffff) == 0x8000) {
60 return uli_exclude_device(hose, bus, devfn);
63 return PCIBIOS_SUCCESSFUL;
65 #endif /* CONFIG_PCI */
69 mpc86xx_hpcn_setup_arch(void)
72 struct device_node *np;
76 ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
79 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") {
81 of_address_to_resource(np, 0, &rsrc);
82 if ((rsrc.start & 0xfffff) == 0x8000)
83 fsl_add_bridge(np, 1);
85 fsl_add_bridge(np, 0);
88 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
92 printk("MPC86xx HPCN board from Freescale Semiconductor\n");
101 mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
103 uint svid = mfspr(SPRN_SVR);
105 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
107 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
112 * Called very early, device-tree isn't unflattened
114 static int __init mpc86xx_hpcn_probe(void)
116 unsigned long root = of_get_flat_dt_root();
118 if (of_flat_dt_is_compatible(root, "fsl,mpc8641hpcn"))
119 return 1; /* Looks good */
121 /* Be nice and don't give silent boot death. Delete this in 2.6.27 */
122 if (of_flat_dt_is_compatible(root, "mpc86xx")) {
123 pr_warning("WARNING: your dts/dtb is old. You must update before the next kernel release\n");
131 mpc86xx_time_init(void)
135 /* Set the time base to zero */
139 temp = mfspr(SPRN_HID0);
141 mtspr(SPRN_HID0, temp);
142 asm volatile("isync");
147 static __initdata struct of_device_id of_bus_ids[] = {
148 { .compatible = "simple-bus", },
149 { .compatible = "fsl,rapidio-delta", },
150 { .compatible = "gianfar", },
154 static int __init declare_of_platform_devices(void)
156 of_platform_bus_probe(NULL, of_bus_ids, NULL);
160 machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices);
162 define_machine(mpc86xx_hpcn) {
163 .name = "MPC86xx HPCN",
164 .probe = mpc86xx_hpcn_probe,
165 .setup_arch = mpc86xx_hpcn_setup_arch,
166 .init_IRQ = mpc86xx_init_irq,
167 .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo,
168 .get_irq = mpic_get_irq,
169 .restart = fsl_rstcr_restart,
170 .time_init = mpc86xx_time_init,
171 .calibrate_decr = generic_calibrate_decr,
172 .progress = udbg_progress,
174 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,