1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * C293PCIE Board Setup
4  *
5  * Copyright 2013 Freescale Semiconductor Inc.
6  */
7 
8 #include <linux/stddef.h>
9 #include <linux/kernel.h>
10 #include <linux/of_fdt.h>
11 #include <linux/of_platform.h>
12 
13 #include <asm/machdep.h>
14 #include <asm/udbg.h>
15 #include <asm/mpic.h>
16 
17 #include <sysdev/fsl_soc.h>
18 #include <sysdev/fsl_pci.h>
19 
20 #include "mpc85xx.h"
21 
22 void __init c293_pcie_pic_init(void)
23 {
24 	struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
25 	  MPIC_SINGLE_DEST_CPU, 0, 256, " OpenPIC  ");
26 
27 	BUG_ON(mpic == NULL);
28 
29 	mpic_init(mpic);
30 }
31 
32 
33 /*
34  * Setup the architecture
35  */
36 static void __init c293_pcie_setup_arch(void)
37 {
38 	if (ppc_md.progress)
39 		ppc_md.progress("c293_pcie_setup_arch()", 0);
40 
41 	fsl_pci_assign_primary();
42 
43 	printk(KERN_INFO "C293 PCIE board from Freescale Semiconductor\n");
44 }
45 
46 machine_arch_initcall(c293_pcie, mpc85xx_common_publish_devices);
47 
48 /*
49  * Called very early, device-tree isn't unflattened
50  */
51 static int __init c293_pcie_probe(void)
52 {
53 	if (of_machine_is_compatible("fsl,C293PCIE"))
54 		return 1;
55 	return 0;
56 }
57 
58 define_machine(c293_pcie) {
59 	.name			= "C293 PCIE",
60 	.probe			= c293_pcie_probe,
61 	.setup_arch		= c293_pcie_setup_arch,
62 	.init_IRQ		= c293_pcie_pic_init,
63 	.get_irq		= mpic_get_irq,
64 	.calibrate_decr		= generic_calibrate_decr,
65 	.progress		= udbg_progress,
66 };
67