blob: 76f3b32a155ed4c9da1bf7a99d95d7629fe26ea3 [file] [log] [blame]
Kim Phillips38f66f92008-01-24 20:47:11 -06001/*
2 * arch/powerpc/platforms/83xx/mpc837x_rdb.c
3 *
4 * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved.
5 *
6 * MPC837x RDB board specific routines
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/pci.h>
15#include <linux/of_platform.h>
16
17#include <asm/time.h>
18#include <asm/ipic.h>
19#include <asm/udbg.h>
John Rigby76fe1ff2008-06-26 11:07:57 -060020#include <sysdev/fsl_pci.h>
Kim Phillips38f66f92008-01-24 20:47:11 -060021
22#include "mpc83xx.h"
23
Kim Phillips38f66f92008-01-24 20:47:11 -060024/* ************************************************************************
25 *
26 * Setup the architecture
27 *
28 */
29static void __init mpc837x_rdb_setup_arch(void)
30{
31#ifdef CONFIG_PCI
32 struct device_node *np;
33#endif
34
35 if (ppc_md.progress)
36 ppc_md.progress("mpc837x_rdb_setup_arch()", 0);
37
38#ifdef CONFIG_PCI
39 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
40 mpc83xx_add_bridge(np);
Anton Vorontsov0585a152009-01-08 04:31:41 +030041 for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
42 mpc83xx_add_bridge(np);
Kim Phillips38f66f92008-01-24 20:47:11 -060043#endif
44 mpc837x_usb_cfg();
45}
46
47static struct of_device_id mpc837x_ids[] = {
48 { .type = "soc", },
49 { .compatible = "soc", },
Anton Vorontsov9c432792008-03-18 18:43:59 +030050 { .compatible = "simple-bus", },
Anton Vorontsov70b3adb2009-03-19 21:01:45 +030051 { .compatible = "gianfar", },
Kim Phillips38f66f92008-01-24 20:47:11 -060052 {},
53};
54
55static int __init mpc837x_declare_of_platform_devices(void)
56{
57 /* Publish of_device */
58 of_platform_bus_probe(NULL, mpc837x_ids, NULL);
59
60 return 0;
61}
62machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices);
63
64static void __init mpc837x_rdb_init_IRQ(void)
65{
66 struct device_node *np;
67
68 np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
69 if (!np)
70 return;
71
72 ipic_init(np, 0);
73
74 /* Initialize the default interrupt mapping priorities,
75 * in case the boot rom changed something on us.
76 */
77 ipic_set_default_priority();
78}
79
80/*
81 * Called very early, MMU is off, device-tree isn't unflattened
82 */
83static int __init mpc837x_rdb_probe(void)
84{
85 unsigned long root = of_get_flat_dt_root();
86
87 return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") ||
88 of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") ||
89 of_flat_dt_is_compatible(root, "fsl,mpc8379rdb");
90}
91
92define_machine(mpc837x_rdb) {
93 .name = "MPC837x RDB",
94 .probe = mpc837x_rdb_probe,
95 .setup_arch = mpc837x_rdb_setup_arch,
96 .init_IRQ = mpc837x_rdb_init_IRQ,
97 .get_irq = ipic_get_irq,
98 .restart = mpc83xx_restart,
99 .time_init = mpc83xx_time_init,
100 .calibrate_decr = generic_calibrate_decr,
101 .progress = udbg_progress,
102};