]> err.no Git - linux-2.6/blob - arch/powerpc/platforms/83xx/mpc832x_rdb.c
Pull fujitsu-v3 into release branch
[linux-2.6] / arch / powerpc / platforms / 83xx / mpc832x_rdb.c
1 /*
2  * arch/powerpc/platforms/83xx/mpc832x_rdb.c
3  *
4  * Copyright (C) Freescale Semiconductor, Inc. 2007. All rights reserved.
5  *
6  * Description:
7  * MPC832x RDB board specific routines.
8  * This file is based on mpc832x_mds.c and mpc8313_rdb.c
9  * Author: Michael Barkowski <michael.barkowski@freescale.com>
10  *
11  * This program is free software; you can redistribute  it and/or modify it
12  * under  the terms of  the GNU General  Public License as published by the
13  * Free Software Foundation;  either version 2 of the  License, or (at your
14  * option) any later version.
15  */
16
17 #include <linux/pci.h>
18
19 #include <asm/of_platform.h>
20 #include <asm/time.h>
21 #include <asm/ipic.h>
22 #include <asm/udbg.h>
23 #include <asm/qe.h>
24 #include <asm/qe_ic.h>
25
26 #include "mpc83xx.h"
27
28 #undef DEBUG
29 #ifdef DEBUG
30 #define DBG(fmt...) udbg_printf(fmt)
31 #else
32 #define DBG(fmt...)
33 #endif
34
35 /* ************************************************************************
36  *
37  * Setup the architecture
38  *
39  */
40 static void __init mpc832x_rdb_setup_arch(void)
41 {
42 #if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
43         struct device_node *np;
44 #endif
45
46         if (ppc_md.progress)
47                 ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
48
49 #ifdef CONFIG_PCI
50         for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
51                 mpc83xx_add_bridge(np);
52
53         ppc_md.pci_exclude_device = mpc83xx_exclude_device;
54 #endif
55
56 #ifdef CONFIG_QUICC_ENGINE
57         qe_reset();
58
59         if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
60                 par_io_init(np);
61                 of_node_put(np);
62
63                 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
64                         par_io_of_config(np);
65         }
66 #endif                          /* CONFIG_QUICC_ENGINE */
67 }
68
69 static struct of_device_id mpc832x_ids[] = {
70         { .type = "soc", },
71         { .compatible = "soc", },
72         { .type = "qe", },
73         {},
74 };
75
76 static int __init mpc832x_declare_of_platform_devices(void)
77 {
78         if (!machine_is(mpc832x_rdb))
79                 return 0;
80
81         /* Publish the QE devices */
82         of_platform_bus_probe(NULL, mpc832x_ids, NULL);
83
84         return 0;
85 }
86 device_initcall(mpc832x_declare_of_platform_devices);
87
88 void __init mpc832x_rdb_init_IRQ(void)
89 {
90
91         struct device_node *np;
92
93         np = of_find_node_by_type(NULL, "ipic");
94         if (!np)
95                 return;
96
97         ipic_init(np, 0);
98
99         /* Initialize the default interrupt mapping priorities,
100          * in case the boot rom changed something on us.
101          */
102         ipic_set_default_priority();
103         of_node_put(np);
104
105 #ifdef CONFIG_QUICC_ENGINE
106         np = of_find_node_by_type(NULL, "qeic");
107         if (!np)
108                 return;
109
110         qe_ic_init(np, 0);
111         of_node_put(np);
112 #endif                          /* CONFIG_QUICC_ENGINE */
113 }
114
115 /*
116  * Called very early, MMU is off, device-tree isn't unflattened
117  */
118 static int __init mpc832x_rdb_probe(void)
119 {
120         unsigned long root = of_get_flat_dt_root();
121
122         return of_flat_dt_is_compatible(root, "MPC832xRDB");
123 }
124
125 define_machine(mpc832x_rdb) {
126         .name           = "MPC832x RDB",
127         .probe          = mpc832x_rdb_probe,
128         .setup_arch     = mpc832x_rdb_setup_arch,
129         .init_IRQ       = mpc832x_rdb_init_IRQ,
130         .get_irq        = ipic_get_irq,
131         .restart        = mpc83xx_restart,
132         .time_init      = mpc83xx_time_init,
133         .calibrate_decr = generic_calibrate_decr,
134         .progress       = udbg_progress,
135 };