1 /*
2  * arch/powerpc/platforms/83xx/mpc830x_rdb.c
3  *
4  * Description: MPC830x RDB board specific routines.
5  * This file is based on mpc831x_rdb.c
6  *
7  * Copyright (C) Freescale Semiconductor, Inc. 2009. All rights reserved.
8  * Copyright (C) 2010. Ilya Yanok, Emcraft Systems, yanok@emcraft.com
9  *
10  * This program is free software; you can redistribute  it and/or modify it
11  * under  the terms of  the GNU General  Public License as published by the
12  * Free Software Foundation;  either version 2 of the  License, or (at your
13  * option) any later version.
14  */
15 
16 #include <linux/pci.h>
17 #include <linux/of_platform.h>
18 #include <asm/time.h>
19 #include <asm/ipic.h>
20 #include <asm/udbg.h>
21 #include <sysdev/fsl_pci.h>
22 #include <sysdev/fsl_soc.h>
23 #include "mpc83xx.h"
24 
25 /*
26  * Setup the architecture
27  */
28 static void __init mpc830x_rdb_setup_arch(void)
29 {
30 #ifdef CONFIG_PCI
31 	struct device_node *np;
32 #endif
33 
34 	if (ppc_md.progress)
35 		ppc_md.progress("mpc830x_rdb_setup_arch()", 0);
36 
37 #ifdef CONFIG_PCI
38 	for_each_compatible_node(np, "pci", "fsl,mpc8308-pcie")
39 		mpc83xx_add_bridge(np);
40 #endif
41 	mpc831x_usb_cfg();
42 }
43 
44 static void __init mpc830x_rdb_init_IRQ(void)
45 {
46 	struct device_node *np;
47 
48 	np = of_find_node_by_type(NULL, "ipic");
49 	if (!np)
50 		return;
51 
52 	ipic_init(np, 0);
53 
54 	/* Initialize the default interrupt mapping priorities,
55 	 * in case the boot rom changed something on us.
56 	 */
57 	ipic_set_default_priority();
58 }
59 
60 static const char *board[] __initdata = {
61 	"MPC8308RDB",
62 	"fsl,mpc8308rdb",
63 	"denx,mpc8308_p1m",
64 	NULL
65 };
66 
67 /*
68  * Called very early, MMU is off, device-tree isn't unflattened
69  */
70 static int __init mpc830x_rdb_probe(void)
71 {
72 	return of_flat_dt_match(of_get_flat_dt_root(), board);
73 }
74 
75 static struct of_device_id __initdata of_bus_ids[] = {
76 	{ .compatible = "simple-bus" },
77 	{ .compatible = "gianfar" },
78 	{},
79 };
80 
81 static int __init declare_of_platform_devices(void)
82 {
83 	of_platform_bus_probe(NULL, of_bus_ids, NULL);
84 	return 0;
85 }
86 machine_device_initcall(mpc830x_rdb, declare_of_platform_devices);
87 
88 define_machine(mpc830x_rdb) {
89 	.name			= "MPC830x RDB",
90 	.probe			= mpc830x_rdb_probe,
91 	.setup_arch		= mpc830x_rdb_setup_arch,
92 	.init_IRQ		= mpc830x_rdb_init_IRQ,
93 	.get_irq		= ipic_get_irq,
94 	.restart		= mpc83xx_restart,
95 	.time_init		= mpc83xx_time_init,
96 	.calibrate_decr		= generic_calibrate_decr,
97 	.progress		= udbg_progress,
98 };
99