1
2
3
4
5
6
7
8
9
10
11
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>
20#include <sysdev/fsl_soc.h>
21#include <sysdev/fsl_pci.h>
22
23#include "mpc83xx.h"
24
25static void mpc837x_rdb_sd_cfg(void)
26{
27 void __iomem *im;
28
29 im = ioremap(get_immrbase(), 0x1000);
30 if (!im) {
31 WARN_ON(1);
32 return;
33 }
34
35
36
37
38
39 clrsetbits_be32(im + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USBB_MASK,
40 MPC837X_SICRL_SD);
41 clrsetbits_be32(im + MPC83XX_SICRH_OFFS, MPC837X_SICRH_SPI_MASK,
42 MPC837X_SICRH_SD);
43 iounmap(im);
44}
45
46
47
48
49
50
51static void __init mpc837x_rdb_setup_arch(void)
52{
53#ifdef CONFIG_PCI
54 struct device_node *np;
55#endif
56
57 if (ppc_md.progress)
58 ppc_md.progress("mpc837x_rdb_setup_arch()", 0);
59
60#ifdef CONFIG_PCI
61 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
62 mpc83xx_add_bridge(np);
63 for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
64 mpc83xx_add_bridge(np);
65#endif
66 mpc837x_usb_cfg();
67 mpc837x_rdb_sd_cfg();
68}
69
70static struct of_device_id mpc837x_ids[] = {
71 { .type = "soc", },
72 { .compatible = "soc", },
73 { .compatible = "simple-bus", },
74 { .compatible = "gianfar", },
75 {},
76};
77
78static int __init mpc837x_declare_of_platform_devices(void)
79{
80
81 of_platform_bus_probe(NULL, mpc837x_ids, NULL);
82
83 return 0;
84}
85machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices);
86
87static void __init mpc837x_rdb_init_IRQ(void)
88{
89 struct device_node *np;
90
91 np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
92 if (!np)
93 return;
94
95 ipic_init(np, 0);
96
97
98
99
100 ipic_set_default_priority();
101}
102
103
104
105
106static int __init mpc837x_rdb_probe(void)
107{
108 unsigned long root = of_get_flat_dt_root();
109
110 return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") ||
111 of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") ||
112 of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") ||
113 of_flat_dt_is_compatible(root, "fsl,mpc8377wlan");
114}
115
116define_machine(mpc837x_rdb) {
117 .name = "MPC837x RDB/WLAN",
118 .probe = mpc837x_rdb_probe,
119 .setup_arch = mpc837x_rdb_setup_arch,
120 .init_IRQ = mpc837x_rdb_init_IRQ,
121 .get_irq = ipic_get_irq,
122 .restart = mpc83xx_restart,
123 .time_init = mpc83xx_time_init,
124 .calibrate_decr = generic_calibrate_decr,
125 .progress = udbg_progress,
126};
127