[POWERPC] 83xx: convert boards to use machine_device_initcall
[linux-2.6] / arch / powerpc / platforms / 83xx / mpc837x_mds.c
1 /*
2  * arch/powerpc/platforms/83xx/mpc837x_mds.c
3  *
4  * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
5  *
6  * MPC837x MDS board specific routines
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation;  either version 2 of the License, or (at your
11  * option) any later version.
12  */
13
14 #include <linux/pci.h>
15 #include <linux/of.h>
16 #include <linux/of_platform.h>
17
18 #include <asm/time.h>
19 #include <asm/ipic.h>
20 #include <asm/udbg.h>
21 #include <asm/prom.h>
22
23 #include "mpc83xx.h"
24
25 /* ************************************************************************
26  *
27  * Setup the architecture
28  *
29  */
30 static void __init mpc837x_mds_setup_arch(void)
31 {
32 #ifdef CONFIG_PCI
33         struct device_node *np;
34 #endif
35
36         if (ppc_md.progress)
37                 ppc_md.progress("mpc837x_mds_setup_arch()", 0);
38
39 #ifdef CONFIG_PCI
40         for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
41                 mpc83xx_add_bridge(np);
42 #endif
43 }
44
45 static struct of_device_id mpc837x_ids[] = {
46         { .type = "soc", },
47         { .compatible = "soc", },
48         {},
49 };
50
51 static int __init mpc837x_declare_of_platform_devices(void)
52 {
53         /* Publish of_device */
54         of_platform_bus_probe(NULL, mpc837x_ids, NULL);
55
56         return 0;
57 }
58 machine_device_initcall(mpc837x_mds, mpc837x_declare_of_platform_devices);
59
60 static void __init mpc837x_mds_init_IRQ(void)
61 {
62         struct device_node *np;
63
64         np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
65         if (!np)
66                 return;
67
68         ipic_init(np, 0);
69
70         /* Initialize the default interrupt mapping priorities,
71          * in case the boot rom changed something on us.
72          */
73         ipic_set_default_priority();
74 }
75
76 /*
77  * Called very early, MMU is off, device-tree isn't unflattened
78  */
79 static int __init mpc837x_mds_probe(void)
80 {
81         unsigned long root = of_get_flat_dt_root();
82
83         return of_flat_dt_is_compatible(root, "fsl,mpc837xmds");
84 }
85
86 define_machine(mpc837x_mds) {
87         .name                   = "MPC837x MDS",
88         .probe                  = mpc837x_mds_probe,
89         .setup_arch             = mpc837x_mds_setup_arch,
90         .init_IRQ               = mpc837x_mds_init_IRQ,
91         .get_irq                = ipic_get_irq,
92         .restart                = mpc83xx_restart,
93         .time_init              = mpc83xx_time_init,
94         .calibrate_decr         = generic_calibrate_decr,
95         .progress               = udbg_progress,
96 };