1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * MPC85xx DS Board Setup
4  *
5  * Author Xianghua Xiao (x.xiao@freescale.com)
6  * Roy Zang <tie-fei.zang@freescale.com>
7  * 	- Add PCI/PCI Exprees support
8  * Copyright 2007 Freescale Semiconductor Inc.
9  */
10 
11 #include <linux/stddef.h>
12 #include <linux/kernel.h>
13 #include <linux/pci.h>
14 #include <linux/kdev_t.h>
15 #include <linux/delay.h>
16 #include <linux/seq_file.h>
17 #include <linux/interrupt.h>
18 #include <linux/of.h>
19 #include <linux/of_irq.h>
20 
21 #include <asm/time.h>
22 #include <asm/machdep.h>
23 #include <asm/pci-bridge.h>
24 #include <mm/mmu_decl.h>
25 #include <asm/udbg.h>
26 #include <asm/mpic.h>
27 #include <asm/i8259.h>
28 #include <asm/swiotlb.h>
29 #include <asm/ppc-pci.h>
30 
31 #include <sysdev/fsl_soc.h>
32 #include <sysdev/fsl_pci.h>
33 #include "smp.h"
34 
35 #include "mpc85xx.h"
36 
mpc85xx_ds_pic_init(void)37 static void __init mpc85xx_ds_pic_init(void)
38 {
39 	struct mpic *mpic;
40 	int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
41 
42 	if (of_machine_is_compatible("fsl,MPC8572DS-CAMP"))
43 		flags |= MPIC_NO_RESET;
44 
45 	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
46 
47 	if (WARN_ON(!mpic))
48 		return;
49 
50 	mpic_init(mpic);
51 
52 	mpc85xx_8259_init();
53 }
54 
55 /*
56  * Setup the architecture
57  */
mpc85xx_ds_setup_arch(void)58 static void __init mpc85xx_ds_setup_arch(void)
59 {
60 	if (ppc_md.progress)
61 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
62 
63 	swiotlb_detect_4g();
64 	fsl_pci_assign_primary();
65 	uli_init();
66 	mpc85xx_smp_init();
67 
68 	pr_info("MPC85xx DS board from Freescale Semiconductor\n");
69 }
70 
71 machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
72 machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
73 
define_machine(mpc8544_ds)74 define_machine(mpc8544_ds) {
75 	.name			= "MPC8544 DS",
76 	.compatible		= "MPC8544DS",
77 	.setup_arch		= mpc85xx_ds_setup_arch,
78 	.init_IRQ		= mpc85xx_ds_pic_init,
79 #ifdef CONFIG_PCI
80 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
81 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
82 #endif
83 	.get_irq		= mpic_get_irq,
84 	.progress		= udbg_progress,
85 };
86 
define_machine(mpc8572_ds)87 define_machine(mpc8572_ds) {
88 	.name			= "MPC8572 DS",
89 	.compatible		= "fsl,MPC8572DS",
90 	.setup_arch		= mpc85xx_ds_setup_arch,
91 	.init_IRQ		= mpc85xx_ds_pic_init,
92 #ifdef CONFIG_PCI
93 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
94 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
95 #endif
96 	.get_irq		= mpic_get_irq,
97 	.progress		= udbg_progress,
98 };
99