Merge branch 'for-linus' of git://neil.brown.name/md
[linux-2.6] / arch / powerpc / platforms / 83xx / sbc834x.c
1 /*
2  * arch/powerpc/platforms/83xx/sbc834x.c
3  *
4  * Wind River SBC834x board specific routines
5  *
6  * By Paul Gortmaker (see MAINTAINERS for contact information)
7  *
8  * Based largely on the mpc834x_mds.c support by Kumar Gala.
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/init.h>
19 #include <linux/errno.h>
20 #include <linux/reboot.h>
21 #include <linux/pci.h>
22 #include <linux/kdev_t.h>
23 #include <linux/major.h>
24 #include <linux/console.h>
25 #include <linux/delay.h>
26 #include <linux/seq_file.h>
27 #include <linux/root_dev.h>
28 #include <linux/of_platform.h>
29
30 #include <asm/system.h>
31 #include <asm/atomic.h>
32 #include <asm/time.h>
33 #include <asm/io.h>
34 #include <asm/machdep.h>
35 #include <asm/ipic.h>
36 #include <asm/irq.h>
37 #include <asm/prom.h>
38 #include <asm/udbg.h>
39 #include <sysdev/fsl_soc.h>
40 #include <sysdev/fsl_pci.h>
41
42 #include "mpc83xx.h"
43
44 /* ************************************************************************
45  *
46  * Setup the architecture
47  *
48  */
49 static void __init sbc834x_setup_arch(void)
50 {
51 #ifdef CONFIG_PCI
52         struct device_node *np;
53 #endif
54
55         if (ppc_md.progress)
56                 ppc_md.progress("sbc834x_setup_arch()", 0);
57
58 #ifdef CONFIG_PCI
59         for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
60                 mpc83xx_add_bridge(np);
61 #endif
62
63 }
64
65 static void __init sbc834x_init_IRQ(void)
66 {
67         struct device_node *np;
68
69         np = of_find_node_by_type(NULL, "ipic");
70         if (!np)
71                 return;
72
73         ipic_init(np, 0);
74
75         /* Initialize the default interrupt mapping priorities,
76          * in case the boot rom changed something on us.
77          */
78         ipic_set_default_priority();
79
80         of_node_put(np);
81 }
82
83 static struct __initdata of_device_id sbc834x_ids[] = {
84         { .type = "soc", },
85         { .compatible = "soc", },
86         { .compatible = "simple-bus", },
87         { .compatible = "gianfar", },
88         {},
89 };
90
91 static int __init sbc834x_declare_of_platform_devices(void)
92 {
93         of_platform_bus_probe(NULL, sbc834x_ids, NULL);
94         return 0;
95 }
96 machine_device_initcall(sbc834x, sbc834x_declare_of_platform_devices);
97
98 /*
99  * Called very early, MMU is off, device-tree isn't unflattened
100  */
101 static int __init sbc834x_probe(void)
102 {
103         unsigned long root = of_get_flat_dt_root();
104
105         return of_flat_dt_is_compatible(root, "SBC834x");
106 }
107
108 define_machine(sbc834x) {
109         .name                   = "SBC834x",
110         .probe                  = sbc834x_probe,
111         .setup_arch             = sbc834x_setup_arch,
112         .init_IRQ               = sbc834x_init_IRQ,
113         .get_irq                = ipic_get_irq,
114         .restart                = mpc83xx_restart,
115         .time_init              = mpc83xx_time_init,
116         .calibrate_decr         = generic_calibrate_decr,
117         .progress               = udbg_progress,
118 };