1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/stddef.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/reboot.h>
19#include <linux/pci.h>
20#include <linux/kdev_t.h>
21#include <linux/major.h>
22#include <linux/console.h>
23#include <linux/delay.h>
24#include <linux/seq_file.h>
25#include <linux/root_dev.h>
26#include <linux/initrd.h>
27#include <linux/of_platform.h>
28#include <linux/of_device.h>
29
30#include <linux/atomic.h>
31#include <linux/time.h>
32#include <linux/io.h>
33#include <asm/machdep.h>
34#include <asm/ipic.h>
35#include <asm/irq.h>
36#include <asm/prom.h>
37#include <asm/udbg.h>
38#include <sysdev/fsl_soc.h>
39#include <sysdev/fsl_pci.h>
40#include <asm/qe.h>
41#include <asm/qe_ic.h>
42
43#include "mpc83xx.h"
44
45#define SVR_REV(svr) (((svr) >> 0) & 0xFFFF)
46
47static void quirk_mpc8360e_qe_enet10(void)
48{
49
50
51
52
53 uint svid = mfspr(SPRN_SVR);
54 struct device_node *np_par;
55 struct resource res;
56 void __iomem *base;
57 int ret;
58
59 np_par = of_find_node_by_name(NULL, "par_io");
60 if (np_par == NULL) {
61 pr_warn("%s couldn;t find par_io node\n", __func__);
62 return;
63 }
64
65 ret = of_address_to_resource(np_par, 0, &res);
66 if (ret) {
67 pr_warn("%s couldn;t map par_io registers\n", __func__);
68 return;
69 }
70
71 base = ioremap(res.start, res.end - res.start + 1);
72
73
74
75
76
77
78
79
80
81 clrsetbits_be32((base + 0xa8), 0x0c00f000, 0x04005000);
82
83
84
85
86
87
88
89
90
91 clrsetbits_be32((base + 0xac), 0x0000cff0, 0x00004550);
92
93 if (SVR_REV(svid) == 0x0021) {
94
95
96
97
98 clrsetbits_be32((base + 0xac), 0x000000f0, 0x000000a0);
99 } else if (SVR_REV(svid) == 0x0020) {
100
101
102
103
104 setbits32((base + 0xa8), 0x00003000);
105
106
107
108
109
110 setbits32((base + 0xa8), 0x0c000000);
111
112
113
114
115
116 setbits32((base + 0xac), 0x0000c000);
117 }
118 iounmap(base);
119 of_node_put(np_par);
120}
121
122
123
124
125
126
127static void __init mpc83xx_km_setup_arch(void)
128{
129#ifdef CONFIG_QUICC_ENGINE
130 struct device_node *np;
131#endif
132
133 if (ppc_md.progress)
134 ppc_md.progress("kmpbec83xx_setup_arch()", 0);
135
136 mpc83xx_setup_pci();
137
138#ifdef CONFIG_QUICC_ENGINE
139 qe_reset();
140
141 np = of_find_node_by_name(NULL, "par_io");
142 if (np != NULL) {
143 par_io_init(np);
144 of_node_put(np);
145
146 for_each_node_by_name(np, "spi")
147 par_io_of_config(np);
148
149 for_each_node_by_name(np, "ucc")
150 par_io_of_config(np);
151
152
153 np = of_find_compatible_node(NULL, "network", "ucc_geth");
154 if (np != NULL) {
155 quirk_mpc8360e_qe_enet10();
156 of_node_put(np);
157 }
158 }
159#endif
160}
161
162machine_device_initcall(mpc83xx_km, mpc83xx_declare_of_platform_devices);
163
164
165static char *board[] __initdata = {
166 "Keymile,KMETER1",
167 "Keymile,kmpbec8321",
168 NULL
169};
170
171
172
173
174static int __init mpc83xx_km_probe(void)
175{
176 unsigned long node = of_get_flat_dt_root();
177 int i = 0;
178
179 while (board[i]) {
180 if (of_flat_dt_is_compatible(node, board[i]))
181 break;
182 i++;
183 }
184 return (board[i] != NULL);
185}
186
187define_machine(mpc83xx_km) {
188 .name = "mpc83xx-km-platform",
189 .probe = mpc83xx_km_probe,
190 .setup_arch = mpc83xx_km_setup_arch,
191 .init_IRQ = mpc83xx_ipic_and_qe_init_IRQ,
192 .get_irq = ipic_get_irq,
193 .restart = mpc83xx_restart,
194 .time_init = mpc83xx_time_init,
195 .calibrate_decr = generic_calibrate_decr,
196 .progress = udbg_progress,
197};
198