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