xref: /linux/arch/powerpc/platforms/85xx/socrates.c (revision b8d312aa075f33282565467662c4628dae0a2aff)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2008 Emcraft Systems
4  * Sergei Poselenov <sposelenov@emcraft.com>
5  *
6  * Based on MPC8560 ADS and arch/ppc tqm85xx ports
7  *
8  * Maintained by Kumar Gala (see MAINTAINERS for contact information)
9  *
10  * Copyright 2008 Freescale Semiconductor Inc.
11  *
12  * Copyright (c) 2005-2006 DENX Software Engineering
13  * Stefan Roese <sr@denx.de>
14  *
15  * Based on original work by
16  * 	Kumar Gala <kumar.gala@freescale.com>
17  *      Copyright 2004 Freescale Semiconductor Inc.
18  */
19 
20 #include <linux/stddef.h>
21 #include <linux/kernel.h>
22 #include <linux/pci.h>
23 #include <linux/kdev_t.h>
24 #include <linux/delay.h>
25 #include <linux/seq_file.h>
26 #include <linux/of_platform.h>
27 
28 #include <asm/time.h>
29 #include <asm/machdep.h>
30 #include <asm/pci-bridge.h>
31 #include <asm/mpic.h>
32 #include <asm/prom.h>
33 #include <mm/mmu_decl.h>
34 #include <asm/udbg.h>
35 
36 #include <sysdev/fsl_soc.h>
37 #include <sysdev/fsl_pci.h>
38 
39 #include "mpc85xx.h"
40 #include "socrates_fpga_pic.h"
41 
42 static void __init socrates_pic_init(void)
43 {
44 	struct device_node *np;
45 
46 	struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
47 			0, 256, " OpenPIC  ");
48 	BUG_ON(mpic == NULL);
49 	mpic_init(mpic);
50 
51 	np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic");
52 	if (!np) {
53 		printk(KERN_ERR "Could not find socrates-fpga-pic node\n");
54 		return;
55 	}
56 	socrates_fpga_pic_init(np);
57 	of_node_put(np);
58 }
59 
60 /*
61  * Setup the architecture
62  */
63 static void __init socrates_setup_arch(void)
64 {
65 	if (ppc_md.progress)
66 		ppc_md.progress("socrates_setup_arch()", 0);
67 
68 	fsl_pci_assign_primary();
69 }
70 
71 machine_arch_initcall(socrates, mpc85xx_common_publish_devices);
72 
73 /*
74  * Called very early, device-tree isn't unflattened
75  */
76 static int __init socrates_probe(void)
77 {
78 	if (of_machine_is_compatible("abb,socrates"))
79 		return 1;
80 
81 	return 0;
82 }
83 
84 define_machine(socrates) {
85 	.name			= "Socrates",
86 	.probe			= socrates_probe,
87 	.setup_arch		= socrates_setup_arch,
88 	.init_IRQ		= socrates_pic_init,
89 	.get_irq		= mpic_get_irq,
90 	.calibrate_decr		= generic_calibrate_decr,
91 	.progress		= udbg_progress,
92 };
93