xref: /linux/arch/powerpc/platforms/85xx/mpc85xx_rdb.c (revision b43ab901d671e3e3cad425ea5e9a3c74e266dcdd)
1 /*
2  * MPC85xx RDB Board Setup
3  *
4  * Copyright 2009 Freescale Semiconductor Inc.
5  *
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.
10  */
11 
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>
20 
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>
29 
30 #include <sysdev/fsl_soc.h>
31 #include <sysdev/fsl_pci.h>
32 #include "smp.h"
33 
34 #include "mpc85xx.h"
35 
36 #undef DEBUG
37 
38 #ifdef DEBUG
39 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
40 #else
41 #define DBG(fmt, args...)
42 #endif
43 
44 
45 void __init mpc85xx_rdb_pic_init(void)
46 {
47 	struct mpic *mpic;
48 	unsigned long root = of_get_flat_dt_root();
49 
50 	if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
51 		mpic = mpic_alloc(NULL, 0,
52 			MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
53 			MPIC_SINGLE_DEST_CPU,
54 			0, 256, " OpenPIC  ");
55 	} else {
56 		mpic = mpic_alloc(NULL, 0,
57 		  MPIC_WANTS_RESET |
58 		  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
59 		  MPIC_SINGLE_DEST_CPU,
60 		  0, 256, " OpenPIC  ");
61 	}
62 
63 	BUG_ON(mpic == NULL);
64 	mpic_init(mpic);
65 }
66 
67 /*
68  * Setup the architecture
69  */
70 static void __init mpc85xx_rdb_setup_arch(void)
71 {
72 #ifdef CONFIG_PCI
73 	struct device_node *np;
74 #endif
75 
76 	if (ppc_md.progress)
77 		ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
78 
79 #ifdef CONFIG_PCI
80 	for_each_node_by_type(np, "pci") {
81 		if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
82 			fsl_add_bridge(np, 0);
83 	}
84 
85 #endif
86 
87 	mpc85xx_smp_init();
88 	printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
89 }
90 
91 machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
92 machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
93 
94 /*
95  * Called very early, device-tree isn't unflattened
96  */
97 static int __init p2020_rdb_probe(void)
98 {
99 	unsigned long root = of_get_flat_dt_root();
100 
101 	if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
102 		return 1;
103 	return 0;
104 }
105 
106 static int __init p1020_rdb_probe(void)
107 {
108 	unsigned long root = of_get_flat_dt_root();
109 
110 	if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
111 		return 1;
112 	return 0;
113 }
114 
115 define_machine(p2020_rdb) {
116 	.name			= "P2020 RDB",
117 	.probe			= p2020_rdb_probe,
118 	.setup_arch		= mpc85xx_rdb_setup_arch,
119 	.init_IRQ		= mpc85xx_rdb_pic_init,
120 #ifdef CONFIG_PCI
121 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
122 #endif
123 	.get_irq		= mpic_get_irq,
124 	.restart		= fsl_rstcr_restart,
125 	.calibrate_decr		= generic_calibrate_decr,
126 	.progress		= udbg_progress,
127 };
128 
129 define_machine(p1020_rdb) {
130 	.name			= "P1020 RDB",
131 	.probe			= p1020_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,
141 };
142