12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
29653018bSScott Wood /*
39653018bSScott Wood  * Paravirt target for a generic QEMU e500 machine
49653018bSScott Wood  *
59653018bSScott Wood  * This is intended to be a flexible device-tree-driven platform, not fixed
69653018bSScott Wood  * to a particular piece of hardware or a particular spec of virtual hardware,
79653018bSScott Wood  * beyond the assumption of an e500-family CPU.  Some things are still hardcoded
89653018bSScott Wood  * here, such as MPIC, but this is a limitation of the current code rather than
99653018bSScott Wood  * an interface contract with QEMU.
109653018bSScott Wood  *
119653018bSScott Wood  * Copyright 2012 Freescale Semiconductor Inc.
129653018bSScott Wood  */
139653018bSScott Wood 
149653018bSScott Wood #include <linux/kernel.h>
15e6f6390aSChristophe Leroy #include <linux/of.h>
169653018bSScott Wood #include <linux/of_fdt.h>
17ca5999fdSMike Rapoport #include <linux/pgtable.h>
1865fddcfcSMike Rapoport #include <asm/machdep.h>
199653018bSScott Wood #include <asm/time.h>
209653018bSScott Wood #include <asm/udbg.h>
219653018bSScott Wood #include <asm/mpic.h>
224a605e2dSChristoph Hellwig #include <asm/swiotlb.h>
239653018bSScott Wood #include <sysdev/fsl_soc.h>
249653018bSScott Wood #include <sysdev/fsl_pci.h>
259653018bSScott Wood #include "smp.h"
269653018bSScott Wood #include "mpc85xx.h"
279653018bSScott Wood 
qemu_e500_pic_init(void)28*c265735fSChristophe Leroy static void __init qemu_e500_pic_init(void)
299653018bSScott Wood {
309653018bSScott Wood 	struct mpic *mpic;
3164871ff6SScott Wood 	unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
3264871ff6SScott Wood 		MPIC_ENABLE_COREINT;
339653018bSScott Wood 
3464871ff6SScott Wood 	mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC  ");
359653018bSScott Wood 
369653018bSScott Wood 	BUG_ON(mpic == NULL);
379653018bSScott Wood 	mpic_init(mpic);
389653018bSScott Wood }
399653018bSScott Wood 
qemu_e500_setup_arch(void)409653018bSScott Wood static void __init qemu_e500_setup_arch(void)
419653018bSScott Wood {
429653018bSScott Wood 	ppc_md.progress("qemu_e500_setup_arch()", 0);
439653018bSScott Wood 
44905e75c4SJia Hongtao 	fsl_pci_assign_primary();
45688ba1dbSJia Hongtao 	swiotlb_detect_4g();
469653018bSScott Wood 	mpc85xx_smp_init();
479653018bSScott Wood }
489653018bSScott Wood 
49905e75c4SJia Hongtao machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices);
509653018bSScott Wood 
define_machine(qemu_e500)519653018bSScott Wood define_machine(qemu_e500) {
529653018bSScott Wood 	.name			= "QEMU e500",
531c96fcdeSChristophe Leroy 	.compatible		= "fsl,qemu-e500",
549653018bSScott Wood 	.setup_arch		= qemu_e500_setup_arch,
559653018bSScott Wood 	.init_IRQ		= qemu_e500_pic_init,
569653018bSScott Wood #ifdef CONFIG_PCI
579653018bSScott Wood 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
5848b16180SWang Dongsheng 	.pcibios_fixup_phb      = fsl_pcibios_fixup_phb,
599653018bSScott Wood #endif
6064871ff6SScott Wood 	.get_irq		= mpic_get_coreint_irq,
619653018bSScott Wood 	.progress		= udbg_progress,
62f529edd1STobias Waldekranz 	.power_save		= e500_idle,
639653018bSScott Wood };
64