1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * MPC85xx RDB Board Setup 4 * 5 * Copyright 2009,2012-2013 Freescale Semiconductor Inc. 6 */ 7 8 #include <linux/stddef.h> 9 #include <linux/kernel.h> 10 #include <linux/pci.h> 11 #include <linux/kdev_t.h> 12 #include <linux/delay.h> 13 #include <linux/seq_file.h> 14 #include <linux/interrupt.h> 15 #include <linux/of_platform.h> 16 #include <linux/fsl/guts.h> 17 18 #include <asm/time.h> 19 #include <asm/machdep.h> 20 #include <asm/pci-bridge.h> 21 #include <mm/mmu_decl.h> 22 #include <asm/udbg.h> 23 #include <asm/mpic.h> 24 #include <soc/fsl/qe/qe.h> 25 26 #include <sysdev/fsl_soc.h> 27 #include <sysdev/fsl_pci.h> 28 #include "smp.h" 29 30 #include "mpc85xx.h" 31 32 #undef DEBUG 33 34 #ifdef DEBUG 35 #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) 36 #else 37 #define DBG(fmt, args...) 38 #endif 39 40 41 void __init mpc85xx_rdb_pic_init(void) 42 { 43 struct mpic *mpic; 44 45 if (of_machine_is_compatible("fsl,MPC85XXRDB-CAMP")) { 46 mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET | 47 MPIC_BIG_ENDIAN | 48 MPIC_SINGLE_DEST_CPU, 49 0, 256, " OpenPIC "); 50 } else { 51 mpic = mpic_alloc(NULL, 0, 52 MPIC_BIG_ENDIAN | 53 MPIC_SINGLE_DEST_CPU, 54 0, 256, " OpenPIC "); 55 } 56 57 BUG_ON(mpic == NULL); 58 mpic_init(mpic); 59 } 60 61 /* 62 * Setup the architecture 63 */ 64 static void __init mpc85xx_rdb_setup_arch(void) 65 { 66 if (ppc_md.progress) 67 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); 68 69 mpc85xx_smp_init(); 70 71 fsl_pci_assign_primary(); 72 73 #ifdef CONFIG_QUICC_ENGINE 74 mpc85xx_qe_par_io_init(); 75 #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) 76 if (machine_is(p1025_rdb)) { 77 struct device_node *np; 78 79 struct ccsr_guts __iomem *guts; 80 81 np = of_find_node_by_name(NULL, "global-utilities"); 82 if (np) { 83 guts = of_iomap(np, 0); 84 if (!guts) { 85 86 pr_err("mpc85xx-rdb: could not map global utilities register\n"); 87 88 } else { 89 /* P1025 has pins muxed for QE and other functions. To 90 * enable QE UEC mode, we need to set bit QE0 for UCC1 91 * in Eth mode, QE0 and QE3 for UCC5 in Eth mode, QE9 92 * and QE12 for QE MII management singals in PMUXCR 93 * register. 94 */ 95 setbits32(&guts->pmuxcr, MPC85xx_PMUXCR_QE(0) | 96 MPC85xx_PMUXCR_QE(3) | 97 MPC85xx_PMUXCR_QE(9) | 98 MPC85xx_PMUXCR_QE(12)); 99 iounmap(guts); 100 } 101 of_node_put(np); 102 } 103 104 } 105 #endif 106 #endif /* CONFIG_QUICC_ENGINE */ 107 108 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 109 } 110 111 machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices); 112 machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); 113 machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); 114 machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices); 115 machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); 116 machine_arch_initcall(p1020_rdb_pd, mpc85xx_common_publish_devices); 117 machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); 118 machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); 119 machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices); 120 machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices); 121 122 define_machine(p2020_rdb) { 123 .name = "P2020 RDB", 124 .compatible = "fsl,P2020RDB", 125 .setup_arch = mpc85xx_rdb_setup_arch, 126 .init_IRQ = mpc85xx_rdb_pic_init, 127 #ifdef CONFIG_PCI 128 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 129 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 130 #endif 131 .get_irq = mpic_get_irq, 132 .progress = udbg_progress, 133 }; 134 135 define_machine(p1020_rdb) { 136 .name = "P1020 RDB", 137 .compatible = "fsl,P1020RDB", 138 .setup_arch = mpc85xx_rdb_setup_arch, 139 .init_IRQ = mpc85xx_rdb_pic_init, 140 #ifdef CONFIG_PCI 141 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 142 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 143 #endif 144 .get_irq = mpic_get_irq, 145 .progress = udbg_progress, 146 }; 147 148 define_machine(p1021_rdb_pc) { 149 .name = "P1021 RDB-PC", 150 .compatible = "fsl,P1021RDB-PC", 151 .setup_arch = mpc85xx_rdb_setup_arch, 152 .init_IRQ = mpc85xx_rdb_pic_init, 153 #ifdef CONFIG_PCI 154 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 155 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 156 #endif 157 .get_irq = mpic_get_irq, 158 .progress = udbg_progress, 159 }; 160 161 define_machine(p2020_rdb_pc) { 162 .name = "P2020RDB-PC", 163 .compatible = "fsl,P2020RDB-PC", 164 .setup_arch = mpc85xx_rdb_setup_arch, 165 .init_IRQ = mpc85xx_rdb_pic_init, 166 #ifdef CONFIG_PCI 167 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 168 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 169 #endif 170 .get_irq = mpic_get_irq, 171 .progress = udbg_progress, 172 }; 173 174 define_machine(p1025_rdb) { 175 .name = "P1025 RDB", 176 .compatible = "fsl,P1025RDB", 177 .setup_arch = mpc85xx_rdb_setup_arch, 178 .init_IRQ = mpc85xx_rdb_pic_init, 179 #ifdef CONFIG_PCI 180 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 181 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 182 #endif 183 .get_irq = mpic_get_irq, 184 .progress = udbg_progress, 185 }; 186 187 define_machine(p1020_mbg_pc) { 188 .name = "P1020 MBG-PC", 189 .compatible = "fsl,P1020MBG-PC", 190 .setup_arch = mpc85xx_rdb_setup_arch, 191 .init_IRQ = mpc85xx_rdb_pic_init, 192 #ifdef CONFIG_PCI 193 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 194 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 195 #endif 196 .get_irq = mpic_get_irq, 197 .progress = udbg_progress, 198 }; 199 200 define_machine(p1020_utm_pc) { 201 .name = "P1020 UTM-PC", 202 .compatible = "fsl,P1020UTM-PC", 203 .setup_arch = mpc85xx_rdb_setup_arch, 204 .init_IRQ = mpc85xx_rdb_pic_init, 205 #ifdef CONFIG_PCI 206 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 207 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 208 #endif 209 .get_irq = mpic_get_irq, 210 .progress = udbg_progress, 211 }; 212 213 define_machine(p1020_rdb_pc) { 214 .name = "P1020RDB-PC", 215 .compatible = "fsl,P1020RDB-PC", 216 .setup_arch = mpc85xx_rdb_setup_arch, 217 .init_IRQ = mpc85xx_rdb_pic_init, 218 #ifdef CONFIG_PCI 219 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 220 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 221 #endif 222 .get_irq = mpic_get_irq, 223 .progress = udbg_progress, 224 }; 225 226 define_machine(p1020_rdb_pd) { 227 .name = "P1020RDB-PD", 228 .compatible = "fsl,P1020RDB-PD", 229 .setup_arch = mpc85xx_rdb_setup_arch, 230 .init_IRQ = mpc85xx_rdb_pic_init, 231 #ifdef CONFIG_PCI 232 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 233 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 234 #endif 235 .get_irq = mpic_get_irq, 236 .progress = udbg_progress, 237 }; 238 239 define_machine(p1024_rdb) { 240 .name = "P1024 RDB", 241 .compatible = "fsl,P1024RDB", 242 .setup_arch = mpc85xx_rdb_setup_arch, 243 .init_IRQ = mpc85xx_rdb_pic_init, 244 #ifdef CONFIG_PCI 245 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 246 .pcibios_fixup_phb = fsl_pcibios_fixup_phb, 247 #endif 248 .get_irq = mpic_get_irq, 249 .progress = udbg_progress, 250 }; 251