]>
Commit | Line | Data |
---|---|---|
2874c5fd | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
9653018b SW |
2 | /* |
3 | * Paravirt target for a generic QEMU e500 machine | |
4 | * | |
5 | * This is intended to be a flexible device-tree-driven platform, not fixed | |
6 | * to a particular piece of hardware or a particular spec of virtual hardware, | |
7 | * beyond the assumption of an e500-family CPU. Some things are still hardcoded | |
8 | * here, such as MPIC, but this is a limitation of the current code rather than | |
9 | * an interface contract with QEMU. | |
10 | * | |
11 | * Copyright 2012 Freescale Semiconductor Inc. | |
9653018b SW |
12 | */ |
13 | ||
14 | #include <linux/kernel.h> | |
15 | #include <linux/of_fdt.h> | |
16 | #include <asm/machdep.h> | |
84f44cc5 | 17 | #include <asm/pgtable.h> |
9653018b SW |
18 | #include <asm/time.h> |
19 | #include <asm/udbg.h> | |
20 | #include <asm/mpic.h> | |
4a605e2d | 21 | #include <asm/swiotlb.h> |
9653018b SW |
22 | #include <sysdev/fsl_soc.h> |
23 | #include <sysdev/fsl_pci.h> | |
24 | #include "smp.h" | |
25 | #include "mpc85xx.h" | |
26 | ||
27 | void __init qemu_e500_pic_init(void) | |
28 | { | |
29 | struct mpic *mpic; | |
64871ff6 SW |
30 | unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU | |
31 | MPIC_ENABLE_COREINT; | |
9653018b | 32 | |
64871ff6 | 33 | mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC "); |
9653018b SW |
34 | |
35 | BUG_ON(mpic == NULL); | |
36 | mpic_init(mpic); | |
37 | } | |
38 | ||
39 | static void __init qemu_e500_setup_arch(void) | |
40 | { | |
41 | ppc_md.progress("qemu_e500_setup_arch()", 0); | |
42 | ||
905e75c4 | 43 | fsl_pci_assign_primary(); |
688ba1db | 44 | swiotlb_detect_4g(); |
9653018b SW |
45 | mpc85xx_smp_init(); |
46 | } | |
47 | ||
48 | /* | |
49 | * Called very early, device-tree isn't unflattened | |
50 | */ | |
51 | static int __init qemu_e500_probe(void) | |
52 | { | |
56571384 | 53 | return !!of_machine_is_compatible("fsl,qemu-e500"); |
9653018b SW |
54 | } |
55 | ||
905e75c4 | 56 | machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices); |
9653018b SW |
57 | |
58 | define_machine(qemu_e500) { | |
59 | .name = "QEMU e500", | |
60 | .probe = qemu_e500_probe, | |
61 | .setup_arch = qemu_e500_setup_arch, | |
62 | .init_IRQ = qemu_e500_pic_init, | |
63 | #ifdef CONFIG_PCI | |
64 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, | |
48b16180 | 65 | .pcibios_fixup_phb = fsl_pcibios_fixup_phb, |
9653018b | 66 | #endif |
64871ff6 | 67 | .get_irq = mpic_get_coreint_irq, |
9653018b SW |
68 | .calibrate_decr = generic_calibrate_decr, |
69 | .progress = udbg_progress, | |
70 | }; |