blob: 51c8f331b6714b085a4822d620f2a3fb02f815f9 [file] [log] [blame]
Paul Gortmaker4e8aae82008-04-15 18:41:30 -04001/*
2 * SBC8641D board specific routines
3 *
4 * Copyright 2008 Wind River Systems Inc.
5 *
6 * By Paul Gortmaker (see MAINTAINERS for contact information)
7 *
8 * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
9 *
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.
14 */
15
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>
23
24#include <asm/system.h>
25#include <asm/time.h>
26#include <asm/machdep.h>
27#include <asm/pci-bridge.h>
Paul Gortmaker4e8aae82008-04-15 18:41:30 -040028#include <asm/prom.h>
29#include <mm/mmu_decl.h>
30#include <asm/udbg.h>
31
32#include <asm/mpic.h>
33
34#include <sysdev/fsl_pci.h>
35#include <sysdev/fsl_soc.h>
36
37#include "mpc86xx.h"
38
39static void __init
Paul Gortmaker4e8aae82008-04-15 18:41:30 -040040sbc8641_setup_arch(void)
41{
42#ifdef CONFIG_PCI
43 struct device_node *np;
44#endif
45
46 if (ppc_md.progress)
47 ppc_md.progress("sbc8641_setup_arch()", 0);
48
49#ifdef CONFIG_PCI
50 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
51 fsl_add_bridge(np, 0);
52#endif
53
54 printk("SBC8641 board from Wind River\n");
55
56#ifdef CONFIG_SMP
57 mpc86xx_smp_init();
58#endif
59}
60
61
62static void
63sbc8641_show_cpuinfo(struct seq_file *m)
64{
Paul Gortmaker4e8aae82008-04-15 18:41:30 -040065 uint svid = mfspr(SPRN_SVR);
66
67 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
68
Paul Gortmaker4e8aae82008-04-15 18:41:30 -040069 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
Paul Gortmaker4e8aae82008-04-15 18:41:30 -040070}
71
72
73/*
74 * Called very early, device-tree isn't unflattened
75 */
76static int __init sbc8641_probe(void)
77{
78 unsigned long root = of_get_flat_dt_root();
79
80 if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
81 return 1; /* Looks good */
82
83 return 0;
84}
85
86static long __init
87mpc86xx_time_init(void)
88{
89 unsigned int temp;
90
91 /* Set the time base to zero */
92 mtspr(SPRN_TBWL, 0);
93 mtspr(SPRN_TBWU, 0);
94
95 temp = mfspr(SPRN_HID0);
96 temp |= HID0_TBEN;
97 mtspr(SPRN_HID0, temp);
98 asm volatile("isync");
99
100 return 0;
101}
102
103static __initdata struct of_device_id of_bus_ids[] = {
104 { .compatible = "simple-bus", },
Anton Vorontsovd8bc55f2009-03-19 21:01:51 +0300105 { .compatible = "gianfar", },
Paul Gortmaker4e8aae82008-04-15 18:41:30 -0400106 {},
107};
108
109static int __init declare_of_platform_devices(void)
110{
111 of_platform_bus_probe(NULL, of_bus_ids, NULL);
112
113 return 0;
114}
115machine_device_initcall(sbc8641, declare_of_platform_devices);
116
117define_machine(sbc8641) {
118 .name = "SBC8641D",
119 .probe = sbc8641_probe,
120 .setup_arch = sbc8641_setup_arch,
Kumar Gala98384c62008-07-02 11:46:20 -0500121 .init_IRQ = mpc86xx_init_irq,
Paul Gortmaker4e8aae82008-04-15 18:41:30 -0400122 .show_cpuinfo = sbc8641_show_cpuinfo,
123 .get_irq = mpic_get_irq,
124 .restart = fsl_rstcr_restart,
125 .time_init = mpc86xx_time_init,
126 .calibrate_decr = generic_calibrate_decr,
127 .progress = udbg_progress,
128#ifdef CONFIG_PCI
129 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
130#endif
131};