Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[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 #ifndef CONFIG_PCI
36 unsigned long isa_io_base = 0;
37 unsigned long isa_mem_base = 0;
38 #endif
39
40 /* ************************************************************************
41  *
42  * Setup the architecture
43  *
44  */
45 static void __init mpc832x_rdb_setup_arch(void)
46 {
47 #if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
48         struct device_node *np;
49 #endif
50
51         if (ppc_md.progress)
52                 ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
53
54 #ifdef CONFIG_PCI
55         for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
56                 add_bridge(np);
57
58         ppc_md.pci_exclude_device = mpc83xx_exclude_device;
59 #endif
60
61 #ifdef CONFIG_QUICC_ENGINE
62         qe_reset();
63
64         if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
65                 par_io_init(np);
66                 of_node_put(np);
67
68                 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
69                         par_io_of_config(np);
70         }
71 #endif                          /* CONFIG_QUICC_ENGINE */
72 }
73
74 static struct of_device_id mpc832x_ids[] = {
75         { .type = "soc", },
76         { .compatible = "soc", },
77         { .type = "qe", },
78         { .type = "mdio", },
79         {},
80 };
81
82 static int __init mpc832x_declare_of_platform_devices(void)
83 {
84         if (!machine_is(mpc832x_rdb))
85                 return 0;
86
87         /* Publish the QE devices */
88         of_platform_bus_probe(NULL, mpc832x_ids, NULL);
89
90         return 0;
91 }
92 device_initcall(mpc832x_declare_of_platform_devices);
93
94 void __init mpc832x_rdb_init_IRQ(void)
95 {
96
97         struct device_node *np;
98
99         np = of_find_node_by_type(NULL, "ipic");
100         if (!np)
101                 return;
102
103         ipic_init(np, 0);
104
105         /* Initialize the default interrupt mapping priorities,
106          * in case the boot rom changed something on us.
107          */
108         ipic_set_default_priority();
109         of_node_put(np);
110
111 #ifdef CONFIG_QUICC_ENGINE
112         np = of_find_node_by_type(NULL, "qeic");
113         if (!np)
114                 return;
115
116         qe_ic_init(np, 0);
117         of_node_put(np);
118 #endif                          /* CONFIG_QUICC_ENGINE */
119 }
120
121 /*
122  * Called very early, MMU is off, device-tree isn't unflattened
123  */
124 static int __init mpc832x_rdb_probe(void)
125 {
126         unsigned long root = of_get_flat_dt_root();
127
128         return of_flat_dt_is_compatible(root, "MPC832xRDB");
129 }
130
131 define_machine(mpc832x_rdb) {
132         .name           = "MPC832x RDB",
133         .probe          = mpc832x_rdb_probe,
134         .setup_arch     = mpc832x_rdb_setup_arch,
135         .init_IRQ       = mpc832x_rdb_init_IRQ,
136         .get_irq        = ipic_get_irq,
137         .restart        = mpc83xx_restart,
138         .time_init      = mpc83xx_time_init,
139         .calibrate_decr = generic_calibrate_decr,
140         .progress       = udbg_progress,
141 };