1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * PPC476 board specific routines
5 * Copyright 2010 Torez Smith, IBM Corporation.
7 * Based on earlier code:
8 * Matt Porter <mporter@kernel.crashing.org>
9 * Copyright 2002-2005 MontaVista Software Inc.
11 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
12 * Copyright (c) 2003-2005 Zultys Technologies
14 * Rewritten and ported to the merged powerpc tree:
15 * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
18 #include <linux/init.h>
19 #include <linux/of_platform.h>
20 #include <linux/rtc.h>
22 #include <asm/machdep.h>
27 #include <asm/ppc4xx.h>
31 static const struct of_device_id iss4xx_of_bus
[] __initconst
= {
32 { .compatible
= "ibm,plb4", },
33 { .compatible
= "ibm,plb6", },
34 { .compatible
= "ibm,opb", },
35 { .compatible
= "ibm,ebc", },
39 static int __init
iss4xx_device_probe(void)
41 of_platform_bus_probe(NULL
, iss4xx_of_bus
, NULL
);
46 machine_device_initcall(iss4xx
, iss4xx_device_probe
);
48 /* We can have either UICs or MPICs */
49 static void __init
iss4xx_init_irq(void)
51 struct device_node
*np
;
53 /* Find top level interrupt controller */
54 for_each_node_with_property(np
, "interrupt-controller") {
55 if (of_get_property(np
, "interrupts", NULL
) == NULL
)
59 panic("Can't find top level interrupt controller");
61 /* Check type and do appropriate initialization */
62 if (of_device_is_compatible(np
, "ibm,uic")) {
64 ppc_md
.get_irq
= uic_get_irq
;
66 } else if (of_device_is_compatible(np
, "chrp,open-pic")) {
67 /* The MPIC driver will get everything it needs from the
68 * device-tree, just pass 0 to all arguments
70 struct mpic
*mpic
= mpic_alloc(np
, 0, MPIC_NO_RESET
, 0, 0, " MPIC ");
73 ppc_md
.get_irq
= mpic_get_irq
;
76 panic("Unrecognized top level interrupt controller");
80 static void smp_iss4xx_setup_cpu(int cpu
)
82 mpic_setup_this_cpu();
85 static int smp_iss4xx_kick_cpu(int cpu
)
87 struct device_node
*cpunode
= of_get_cpu_node(cpu
, NULL
);
88 const u64
*spin_table_addr_prop
;
90 extern void start_secondary_47x(void);
92 BUG_ON(cpunode
== NULL
);
94 /* Assume spin table. We could test for the enable-method in
95 * the device-tree but currently there's little point as it's
96 * our only supported method
98 spin_table_addr_prop
= of_get_property(cpunode
, "cpu-release-addr",
100 if (spin_table_addr_prop
== NULL
) {
101 pr_err("CPU%d: Can't start, missing cpu-release-addr !\n", cpu
);
105 /* Assume it's mapped as part of the linear mapping. This is a bit
106 * fishy but will work fine for now
108 spin_table
= (u32
*)__va(*spin_table_addr_prop
);
109 pr_debug("CPU%d: Spin table mapped at %p\n", cpu
, spin_table
);
113 spin_table
[1] = __pa(start_secondary_47x
);
119 static struct smp_ops_t iss_smp_ops
= {
120 .probe
= smp_mpic_probe
,
121 .message_pass
= smp_mpic_message_pass
,
122 .setup_cpu
= smp_iss4xx_setup_cpu
,
123 .kick_cpu
= smp_iss4xx_kick_cpu
,
124 .give_timebase
= smp_generic_give_timebase
,
125 .take_timebase
= smp_generic_take_timebase
,
128 static void __init
iss4xx_smp_init(void)
130 if (mmu_has_feature(MMU_FTR_TYPE_47x
))
131 smp_ops
= &iss_smp_ops
;
134 #else /* CONFIG_SMP */
135 static void __init
iss4xx_smp_init(void) { }
136 #endif /* CONFIG_SMP */
138 static void __init
iss4xx_setup_arch(void)
144 * Called very early, MMU is off, device-tree isn't unflattened
146 static int __init
iss4xx_probe(void)
148 if (!of_machine_is_compatible("ibm,iss-4xx"))
154 define_machine(iss4xx
) {
156 .probe
= iss4xx_probe
,
157 .progress
= udbg_progress
,
158 .init_IRQ
= iss4xx_init_irq
,
159 .setup_arch
= iss4xx_setup_arch
,
160 .restart
= ppc4xx_reset_system
,
161 .calibrate_decr
= generic_calibrate_decr
,