blob: eda6ed5683e100369a354b9c3e92e515e861d2e3 [file] [log] [blame]
Mingkai Hu3fce1c02011-06-28 15:52:34 +08001/*
Mingkai Hud3133762011-08-26 18:45:03 +08002 * P2041 RDB Setup
Mingkai Hu3fce1c02011-06-28 15:52:34 +08003 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/pci.h>
14#include <linux/kdev_t.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/phy.h>
18
19#include <asm/system.h>
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <mm/mmu_decl.h>
24#include <asm/prom.h>
25#include <asm/udbg.h>
26#include <asm/mpic.h>
27
28#include <linux/of_platform.h>
29#include <sysdev/fsl_soc.h>
30#include <sysdev/fsl_pci.h>
31#include <asm/ehv_pic.h>
32
33#include "corenet_ds.h"
34
35/*
36 * Called very early, device-tree isn't unflattened
37 */
Mingkai Hud3133762011-08-26 18:45:03 +080038static int __init p2041_rdb_probe(void)
Mingkai Hu3fce1c02011-06-28 15:52:34 +080039{
40 unsigned long root = of_get_flat_dt_root();
41#ifdef CONFIG_SMP
42 extern struct smp_ops_t smp_85xx_ops;
43#endif
44
Mingkai Hud3133762011-08-26 18:45:03 +080045 if (of_flat_dt_is_compatible(root, "fsl,P2041RDB"))
Mingkai Hu3fce1c02011-06-28 15:52:34 +080046 return 1;
47
48 /* Check if we're running under the Freescale hypervisor */
Mingkai Hud3133762011-08-26 18:45:03 +080049 if (of_flat_dt_is_compatible(root, "fsl,P2041RDB-hv")) {
Mingkai Hu3fce1c02011-06-28 15:52:34 +080050 ppc_md.init_IRQ = ehv_pic_init;
51 ppc_md.get_irq = ehv_pic_get_irq;
52 ppc_md.restart = fsl_hv_restart;
53 ppc_md.power_off = fsl_hv_halt;
54 ppc_md.halt = fsl_hv_halt;
55#ifdef CONFIG_SMP
56 /*
57 * Disable the timebase sync operations because we can't write
58 * to the timebase registers under the hypervisor.
59 */
60 smp_85xx_ops.give_timebase = NULL;
61 smp_85xx_ops.take_timebase = NULL;
62#endif
63 return 1;
64 }
65
66 return 0;
67}
68
Mingkai Hud3133762011-08-26 18:45:03 +080069define_machine(p2041_rdb) {
70 .name = "P2041 RDB",
71 .probe = p2041_rdb_probe,
Mingkai Hu3fce1c02011-06-28 15:52:34 +080072 .setup_arch = corenet_ds_setup_arch,
73 .init_IRQ = corenet_ds_pic_init,
74#ifdef CONFIG_PCI
75 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
76#endif
77 .get_irq = mpic_get_coreint_irq,
78 .restart = fsl_rstcr_restart,
79 .calibrate_decr = generic_calibrate_decr,
80 .progress = udbg_progress,
81 .power_save = e500_idle,
82};
83
Mingkai Hud3133762011-08-26 18:45:03 +080084machine_device_initcall(p2041_rdb, corenet_ds_publish_devices);
Mingkai Hu3fce1c02011-06-28 15:52:34 +080085
86#ifdef CONFIG_SWIOTLB
Mingkai Hud3133762011-08-26 18:45:03 +080087machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
Mingkai Hu3fce1c02011-06-28 15:52:34 +080088#endif