Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 1 | /* |
| 2 | * MPC85xx RDB Board Setup |
| 3 | * |
Zhicheng Fan | 7e6af14 | 2012-02-10 14:48:15 +0800 | [diff] [blame^] | 4 | * Copyright 2009,2012 Freescale Semiconductor Inc. |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 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> |
Kyle Moffett | 582d3e0 | 2011-12-02 06:27:58 +0000 | [diff] [blame] | 32 | #include "smp.h" |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 33 | |
Dmitry Eremin-Solenikov | 543a07b | 2011-11-17 21:56:16 +0400 | [diff] [blame] | 34 | #include "mpc85xx.h" |
| 35 | |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 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; |
Poonam Aggrwal | dc2e673 | 2009-09-19 22:43:56 +0530 | [diff] [blame] | 48 | unsigned long root = of_get_flat_dt_root(); |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 49 | |
Fabio Baltieri | a63e23b | 2011-07-12 09:49:43 +0200 | [diff] [blame] | 50 | if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) { |
Kyle Moffett | e55d7f7 | 2011-12-22 10:19:14 +0000 | [diff] [blame] | 51 | mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | |
Kyle Moffett | 5019609 | 2011-12-22 10:19:12 +0000 | [diff] [blame] | 52 | MPIC_BIG_ENDIAN | |
Fabio Baltieri | a63e23b | 2011-07-12 09:49:43 +0200 | [diff] [blame] | 53 | MPIC_SINGLE_DEST_CPU, |
Poonam Aggrwal | dc2e673 | 2009-09-19 22:43:56 +0530 | [diff] [blame] | 54 | 0, 256, " OpenPIC "); |
| 55 | } else { |
Kyle Moffett | 996983b | 2011-12-02 06:28:02 +0000 | [diff] [blame] | 56 | mpic = mpic_alloc(NULL, 0, |
Kyle Moffett | 5019609 | 2011-12-22 10:19:12 +0000 | [diff] [blame] | 57 | MPIC_BIG_ENDIAN | |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 58 | MPIC_SINGLE_DEST_CPU, |
| 59 | 0, 256, " OpenPIC "); |
Poonam Aggrwal | dc2e673 | 2009-09-19 22:43:56 +0530 | [diff] [blame] | 60 | } |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 61 | |
| 62 | BUG_ON(mpic == NULL); |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 63 | mpic_init(mpic); |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | /* |
| 67 | * Setup the architecture |
| 68 | */ |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 69 | static void __init mpc85xx_rdb_setup_arch(void) |
| 70 | { |
| 71 | #ifdef CONFIG_PCI |
| 72 | struct device_node *np; |
| 73 | #endif |
| 74 | |
| 75 | if (ppc_md.progress) |
| 76 | ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); |
| 77 | |
| 78 | #ifdef CONFIG_PCI |
| 79 | for_each_node_by_type(np, "pci") { |
| 80 | if (of_device_is_compatible(np, "fsl,mpc8548-pcie")) |
| 81 | fsl_add_bridge(np, 0); |
| 82 | } |
| 83 | |
| 84 | #endif |
| 85 | |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 86 | mpc85xx_smp_init(); |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 87 | printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); |
| 88 | } |
| 89 | |
Dmitry Eremin-Solenikov | 46d026a | 2011-11-17 21:56:17 +0400 | [diff] [blame] | 90 | machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); |
Tang Yuantian | 35ce1b5 | 2011-12-28 11:41:47 +0800 | [diff] [blame] | 91 | machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); |
Jerry Huang | d1fb106 | 2012-03-14 17:08:27 +0800 | [diff] [blame] | 92 | machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); |
Dmitry Eremin-Solenikov | 46d026a | 2011-11-17 21:56:17 +0400 | [diff] [blame] | 93 | machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); |
Zhicheng Fan | 7e6af14 | 2012-02-10 14:48:15 +0800 | [diff] [blame^] | 94 | machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); |
Jerry Huang | 1a244b8 | 2012-03-14 17:08:28 +0800 | [diff] [blame] | 95 | machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); |
Xu Jiucheng | b73bdf4 | 2012-01-17 16:01:30 +0800 | [diff] [blame] | 96 | machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); |
Zhicheng Fan | 6886780 | 2012-02-13 22:06:22 +0000 | [diff] [blame] | 97 | machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices); |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * Called very early, device-tree isn't unflattened |
| 101 | */ |
| 102 | static int __init p2020_rdb_probe(void) |
| 103 | { |
| 104 | unsigned long root = of_get_flat_dt_root(); |
| 105 | |
| 106 | if (of_flat_dt_is_compatible(root, "fsl,P2020RDB")) |
| 107 | return 1; |
| 108 | return 0; |
| 109 | } |
| 110 | |
Poonam Aggrwal | 52dffd7 | 2009-09-25 09:50:28 +0530 | [diff] [blame] | 111 | static int __init p1020_rdb_probe(void) |
| 112 | { |
| 113 | unsigned long root = of_get_flat_dt_root(); |
| 114 | |
| 115 | if (of_flat_dt_is_compatible(root, "fsl,P1020RDB")) |
| 116 | return 1; |
| 117 | return 0; |
| 118 | } |
| 119 | |
Zhicheng Fan | 7e6af14 | 2012-02-10 14:48:15 +0800 | [diff] [blame^] | 120 | static int __init p1020_rdb_pc_probe(void) |
| 121 | { |
| 122 | unsigned long root = of_get_flat_dt_root(); |
| 123 | |
| 124 | return of_flat_dt_is_compatible(root, "fsl,P1020RDB-PC"); |
| 125 | } |
| 126 | |
Xu Jiucheng | b73bdf4 | 2012-01-17 16:01:30 +0800 | [diff] [blame] | 127 | static int __init p1021_rdb_pc_probe(void) |
| 128 | { |
| 129 | unsigned long root = of_get_flat_dt_root(); |
| 130 | |
| 131 | if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC")) |
| 132 | return 1; |
| 133 | return 0; |
| 134 | } |
| 135 | |
Tang Yuantian | 35ce1b5 | 2011-12-28 11:41:47 +0800 | [diff] [blame] | 136 | static int __init p2020_rdb_pc_probe(void) |
| 137 | { |
| 138 | unsigned long root = of_get_flat_dt_root(); |
| 139 | |
| 140 | if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC")) |
| 141 | return 1; |
| 142 | return 0; |
| 143 | } |
| 144 | |
Zhicheng Fan | 6886780 | 2012-02-13 22:06:22 +0000 | [diff] [blame] | 145 | static int __init p1025_rdb_probe(void) |
| 146 | { |
| 147 | unsigned long root = of_get_flat_dt_root(); |
| 148 | |
| 149 | return of_flat_dt_is_compatible(root, "fsl,P1025RDB"); |
| 150 | } |
| 151 | |
Jerry Huang | d1fb106 | 2012-03-14 17:08:27 +0800 | [diff] [blame] | 152 | static int __init p1020_mbg_pc_probe(void) |
| 153 | { |
| 154 | unsigned long root = of_get_flat_dt_root(); |
| 155 | |
| 156 | return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC"); |
| 157 | } |
| 158 | |
Jerry Huang | 1a244b8 | 2012-03-14 17:08:28 +0800 | [diff] [blame] | 159 | static int __init p1020_utm_pc_probe(void) |
| 160 | { |
| 161 | unsigned long root = of_get_flat_dt_root(); |
| 162 | |
| 163 | return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC"); |
| 164 | } |
| 165 | |
Poonam Aggrwal | fb8e3e1 | 2009-08-07 21:05:16 +0530 | [diff] [blame] | 166 | define_machine(p2020_rdb) { |
| 167 | .name = "P2020 RDB", |
| 168 | .probe = p2020_rdb_probe, |
| 169 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 170 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 171 | #ifdef CONFIG_PCI |
| 172 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 173 | #endif |
| 174 | .get_irq = mpic_get_irq, |
| 175 | .restart = fsl_rstcr_restart, |
| 176 | .calibrate_decr = generic_calibrate_decr, |
| 177 | .progress = udbg_progress, |
| 178 | }; |
Poonam Aggrwal | 52dffd7 | 2009-09-25 09:50:28 +0530 | [diff] [blame] | 179 | |
| 180 | define_machine(p1020_rdb) { |
| 181 | .name = "P1020 RDB", |
| 182 | .probe = p1020_rdb_probe, |
| 183 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 184 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 185 | #ifdef CONFIG_PCI |
| 186 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 187 | #endif |
| 188 | .get_irq = mpic_get_irq, |
| 189 | .restart = fsl_rstcr_restart, |
| 190 | .calibrate_decr = generic_calibrate_decr, |
| 191 | .progress = udbg_progress, |
| 192 | }; |
Xu Jiucheng | b73bdf4 | 2012-01-17 16:01:30 +0800 | [diff] [blame] | 193 | |
| 194 | define_machine(p1021_rdb_pc) { |
| 195 | .name = "P1021 RDB-PC", |
| 196 | .probe = p1021_rdb_pc_probe, |
| 197 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 198 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 199 | #ifdef CONFIG_PCI |
| 200 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 201 | #endif |
| 202 | .get_irq = mpic_get_irq, |
| 203 | .restart = fsl_rstcr_restart, |
| 204 | .calibrate_decr = generic_calibrate_decr, |
| 205 | .progress = udbg_progress, |
| 206 | }; |
Tang Yuantian | 35ce1b5 | 2011-12-28 11:41:47 +0800 | [diff] [blame] | 207 | |
| 208 | define_machine(p2020_rdb_pc) { |
| 209 | .name = "P2020RDB-PC", |
| 210 | .probe = p2020_rdb_pc_probe, |
| 211 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 212 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 213 | #ifdef CONFIG_PCI |
| 214 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 215 | #endif |
| 216 | .get_irq = mpic_get_irq, |
| 217 | .restart = fsl_rstcr_restart, |
| 218 | .calibrate_decr = generic_calibrate_decr, |
| 219 | .progress = udbg_progress, |
| 220 | }; |
Zhicheng Fan | 6886780 | 2012-02-13 22:06:22 +0000 | [diff] [blame] | 221 | |
| 222 | define_machine(p1025_rdb) { |
| 223 | .name = "P1025 RDB", |
| 224 | .probe = p1025_rdb_probe, |
| 225 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 226 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 227 | #ifdef CONFIG_PCI |
| 228 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 229 | #endif |
| 230 | .get_irq = mpic_get_irq, |
| 231 | .restart = fsl_rstcr_restart, |
| 232 | .calibrate_decr = generic_calibrate_decr, |
| 233 | .progress = udbg_progress, |
| 234 | }; |
Jerry Huang | d1fb106 | 2012-03-14 17:08:27 +0800 | [diff] [blame] | 235 | |
| 236 | define_machine(p1020_mbg_pc) { |
| 237 | .name = "P1020 MBG-PC", |
| 238 | .probe = p1020_mbg_pc_probe, |
| 239 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 240 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 241 | #ifdef CONFIG_PCI |
| 242 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 243 | #endif |
| 244 | .get_irq = mpic_get_irq, |
| 245 | .restart = fsl_rstcr_restart, |
| 246 | .calibrate_decr = generic_calibrate_decr, |
| 247 | .progress = udbg_progress, |
| 248 | }; |
Jerry Huang | 1a244b8 | 2012-03-14 17:08:28 +0800 | [diff] [blame] | 249 | |
| 250 | define_machine(p1020_utm_pc) { |
| 251 | .name = "P1020 UTM-PC", |
| 252 | .probe = p1020_utm_pc_probe, |
| 253 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 254 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 255 | #ifdef CONFIG_PCI |
| 256 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 257 | #endif |
| 258 | .get_irq = mpic_get_irq, |
| 259 | .restart = fsl_rstcr_restart, |
| 260 | .calibrate_decr = generic_calibrate_decr, |
| 261 | .progress = udbg_progress, |
| 262 | }; |
Zhicheng Fan | 7e6af14 | 2012-02-10 14:48:15 +0800 | [diff] [blame^] | 263 | |
| 264 | define_machine(p1020_rdb_pc) { |
| 265 | .name = "P1020RDB-PC", |
| 266 | .probe = p1020_rdb_pc_probe, |
| 267 | .setup_arch = mpc85xx_rdb_setup_arch, |
| 268 | .init_IRQ = mpc85xx_rdb_pic_init, |
| 269 | #ifdef CONFIG_PCI |
| 270 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 271 | #endif |
| 272 | .get_irq = mpic_get_irq, |
| 273 | .restart = fsl_rstcr_restart, |
| 274 | .calibrate_decr = generic_calibrate_decr, |
| 275 | .progress = udbg_progress, |
| 276 | }; |