Full support for Ginger Console
[linux-ginger.git] / arch / powerpc / platforms / 85xx / mpc85xx_rdb.c
blobc8468de4acf656d96a98bf30790ba4b8bd9ed7fb
1 /*
2 * MPC85xx RDB Board Setup
4 * Copyright 2009 Freescale Semiconductor Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/pci.h>
15 #include <linux/kdev_t.h>
16 #include <linux/delay.h>
17 #include <linux/seq_file.h>
18 #include <linux/interrupt.h>
19 #include <linux/of_platform.h>
21 #include <asm/system.h>
22 #include <asm/time.h>
23 #include <asm/machdep.h>
24 #include <asm/pci-bridge.h>
25 #include <mm/mmu_decl.h>
26 #include <asm/prom.h>
27 #include <asm/udbg.h>
28 #include <asm/mpic.h>
30 #include <sysdev/fsl_soc.h>
31 #include <sysdev/fsl_pci.h>
33 #undef DEBUG
35 #ifdef DEBUG
36 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
37 #else
38 #define DBG(fmt, args...)
39 #endif
42 void __init mpc85xx_rdb_pic_init(void)
44 struct mpic *mpic;
45 struct resource r;
46 struct device_node *np;
48 np = of_find_node_by_type(NULL, "open-pic");
49 if (np == NULL) {
50 printk(KERN_ERR "Could not find open-pic node\n");
51 return;
54 if (of_address_to_resource(np, 0, &r)) {
55 printk(KERN_ERR "Failed to map mpic register space\n");
56 of_node_put(np);
57 return;
60 mpic = mpic_alloc(np, r.start,
61 MPIC_PRIMARY | MPIC_WANTS_RESET |
62 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
63 MPIC_SINGLE_DEST_CPU,
64 0, 256, " OpenPIC ");
66 BUG_ON(mpic == NULL);
67 of_node_put(np);
69 mpic_init(mpic);
74 * Setup the architecture
76 #ifdef CONFIG_SMP
77 extern void __init mpc85xx_smp_init(void);
78 #endif
79 static void __init mpc85xx_rdb_setup_arch(void)
81 #ifdef CONFIG_PCI
82 struct device_node *np;
83 #endif
85 if (ppc_md.progress)
86 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
88 #ifdef CONFIG_PCI
89 for_each_node_by_type(np, "pci") {
90 if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
91 fsl_add_bridge(np, 0);
94 #endif
96 #ifdef CONFIG_SMP
97 mpc85xx_smp_init();
98 #endif
100 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
103 static struct of_device_id __initdata mpc85xxrdb_ids[] = {
104 { .type = "soc", },
105 { .compatible = "soc", },
106 { .compatible = "simple-bus", },
107 { .compatible = "gianfar", },
111 static int __init mpc85xxrdb_publish_devices(void)
113 return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);
115 machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);
118 * Called very early, device-tree isn't unflattened
120 static int __init p2020_rdb_probe(void)
122 unsigned long root = of_get_flat_dt_root();
124 if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
125 return 1;
126 return 0;
129 define_machine(p2020_rdb) {
130 .name = "P2020 RDB",
131 .probe = p2020_rdb_probe,
132 .setup_arch = mpc85xx_rdb_setup_arch,
133 .init_IRQ = mpc85xx_rdb_pic_init,
134 #ifdef CONFIG_PCI
135 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
136 #endif
137 .get_irq = mpic_get_irq,
138 .restart = fsl_rstcr_restart,
139 .calibrate_decr = generic_calibrate_decr,
140 .progress = udbg_progress,