Linux 3.17-rc2
[linux/fpc-iii.git] / arch / powerpc / platforms / 86xx / sbc8641d.c
blobb47a8fd0f3d30ad4d2d3e1bfa45a43761bc9e8f1
1 /*
2 * SBC8641D board specific routines
4 * Copyright 2008 Wind River Systems Inc.
6 * By Paul Gortmaker (see MAINTAINERS for contact information)
8 * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
16 #include <linux/stddef.h>
17 #include <linux/kernel.h>
18 #include <linux/pci.h>
19 #include <linux/kdev_t.h>
20 #include <linux/delay.h>
21 #include <linux/seq_file.h>
22 #include <linux/of_platform.h>
24 #include <asm/time.h>
25 #include <asm/machdep.h>
26 #include <asm/pci-bridge.h>
27 #include <asm/prom.h>
28 #include <mm/mmu_decl.h>
29 #include <asm/udbg.h>
31 #include <asm/mpic.h>
33 #include <sysdev/fsl_pci.h>
34 #include <sysdev/fsl_soc.h>
36 #include "mpc86xx.h"
38 static void __init
39 sbc8641_setup_arch(void)
41 if (ppc_md.progress)
42 ppc_md.progress("sbc8641_setup_arch()", 0);
44 printk("SBC8641 board from Wind River\n");
46 #ifdef CONFIG_SMP
47 mpc86xx_smp_init();
48 #endif
50 fsl_pci_assign_primary();
54 static void
55 sbc8641_show_cpuinfo(struct seq_file *m)
57 uint svid = mfspr(SPRN_SVR);
59 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
61 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
66 * Called very early, device-tree isn't unflattened
68 static int __init sbc8641_probe(void)
70 unsigned long root = of_get_flat_dt_root();
72 if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
73 return 1; /* Looks good */
75 return 0;
78 static long __init
79 mpc86xx_time_init(void)
81 unsigned int temp;
83 /* Set the time base to zero */
84 mtspr(SPRN_TBWL, 0);
85 mtspr(SPRN_TBWU, 0);
87 temp = mfspr(SPRN_HID0);
88 temp |= HID0_TBEN;
89 mtspr(SPRN_HID0, temp);
90 asm volatile("isync");
92 return 0;
95 static __initdata struct of_device_id of_bus_ids[] = {
96 { .compatible = "simple-bus", },
97 { .compatible = "gianfar", },
98 { .compatible = "fsl,mpc8641-pcie", },
99 {},
102 static int __init declare_of_platform_devices(void)
104 of_platform_bus_probe(NULL, of_bus_ids, NULL);
106 return 0;
108 machine_arch_initcall(sbc8641, declare_of_platform_devices);
110 define_machine(sbc8641) {
111 .name = "SBC8641D",
112 .probe = sbc8641_probe,
113 .setup_arch = sbc8641_setup_arch,
114 .init_IRQ = mpc86xx_init_irq,
115 .show_cpuinfo = sbc8641_show_cpuinfo,
116 .get_irq = mpic_get_irq,
117 .restart = fsl_rstcr_restart,
118 .time_init = mpc86xx_time_init,
119 .calibrate_decr = generic_calibrate_decr,
120 .progress = udbg_progress,
121 #ifdef CONFIG_PCI
122 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
123 #endif