1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25#include <mpc8260.h>
26#include <ioports.h>
27
28#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
29#include <libfdt.h>
30#endif
31
32
33
34
35
36
37
38const iop_conf_t iop_conf_tab[4][32] = {
39
40
41 {
42 { 0, 0, 0, 0, 0, 0 },
43 { 0, 0, 0, 0, 0, 0 },
44 { 1, 1, 1, 1, 0, 0 },
45 { 1, 1, 1, 1, 0, 0 },
46 { 1, 1, 1, 0, 0, 0 },
47 { 1, 1, 1, 0, 0, 0 },
48 { 1, 0, 0, 1, 0, 0 },
49 { 1, 0, 0, 1, 0, 1 },
50 { 0, 0, 0, 0, 0, 0 },
51 { 0, 0, 0, 0, 0, 0 },
52 { 1, 1, 0, 1, 0, 0 },
53 { 1, 1, 0, 1, 0, 0 },
54 { 1, 1, 0, 1, 0, 0 },
55 { 1, 1, 0, 1, 0, 0 },
56 { 1, 1, 0, 0, 0, 0 },
57 { 1, 1, 0, 0, 0, 0 },
58 { 1, 1, 0, 0, 0, 0 },
59 { 1, 1, 0, 0, 0, 0 },
60 { 0, 0, 0, 0, 0, 0 },
61 { 1, 0, 0, 1, 0, 0 },
62 { 0, 0, 0, 0, 0, 0 },
63 { 1, 0, 0, 1, 0, 0 },
64 { 1, 0, 0, 1, 0, 0 },
65 { 1, 1, 0, 0, 0, 0 },
66 { 0, 0, 0, 0, 0, 0 },
67 { 0, 0, 0, 0, 0, 0 },
68 { 0, 0, 0, 0, 0, 0 },
69 { 0, 0, 0, 0, 0, 0 },
70 { 0, 0, 0, 0, 0, 0 },
71 { 0, 0, 0, 0, 0, 0 },
72 { 0, 0, 0, 0, 0, 0 },
73 { 0, 0, 0, 0, 0, 0 }
74 },
75
76
77 {
78 { 0, 0, 0, 0, 0, 0 },
79 { 0, 0, 0, 0, 0, 0 },
80 { 0, 0, 0, 0, 0, 0 },
81 { 1, 1, 1, 1, 0, 0 },
82 { 0, 0, 0, 0, 0, 0 },
83 { 0, 0, 0, 0, 0, 0 },
84 { 0, 0, 0, 0, 0, 0 },
85 { 0, 0, 0, 0, 0, 0 },
86 { 0, 0, 0, 0, 0, 0 },
87 { 0, 0, 0, 0, 0, 0 },
88 { 0, 0, 0, 0, 0, 0 },
89 { 0, 0, 0, 0, 0, 0 },
90 { 0, 0, 0, 0, 0, 0 },
91 { 0, 0, 0, 0, 0, 0 },
92 { 0, 0, 0, 0, 0, 0 },
93 { 0, 0, 0, 0, 0, 0 },
94 { 1, 1, 0, 0, 0, 0 },
95 { 1, 1, 0, 0, 0, 0 },
96 { 0, 0, 0, 0, 0, 0 },
97 { 1, 1, 1, 1, 0, 0 },
98 { 0, 0, 0, 0, 0, 0 },
99 { 0, 0, 0, 0, 0, 0 },
100 { 0, 0, 0, 0, 0, 0 },
101 { 1, 1, 1, 1, 0, 0 },
102 { 0, 0, 0, 0, 0, 0 },
103 { 0, 0, 0, 0, 0, 0 },
104 { 0, 0, 0, 0, 0, 0 },
105 { 0, 0, 0, 0, 0, 0 },
106 { 0, 0, 0, 0, 0, 0 },
107 { 0, 0, 0, 0, 0, 0 },
108 { 0, 0, 0, 0, 0, 0 },
109 { 0, 0, 0, 0, 0, 0 }
110 },
111
112
113 {
114 { 0, 0, 0, 0, 0, 0 },
115 { 1, 1, 1, 1, 0, 0 },
116 { 0, 0, 0, 0, 0, 0 },
117 { 0, 0, 0, 0, 0, 0 },
118 { 0, 0, 0, 0, 0, 0 },
119 { 0, 0, 0, 0, 0, 0 },
120 { 0, 0, 0, 0, 0, 0 },
121 { 0, 0, 0, 0, 0, 0 },
122 { 0, 0, 0, 0, 0, 0 },
123 { 0, 0, 0, 0, 0, 0 },
124 { 1, 1, 0, 0, 0, 0 },
125 { 1, 1, 0, 0, 0, 0 },
126 { 0, 0, 0, 0, 0, 0 },
127 { 0, 0, 0, 0, 0, 0 },
128 { 0, 0, 0, 0, 0, 0 },
129 { 0, 0, 0, 0, 0, 0 },
130 { 1, 1, 0, 1, 0, 0 },
131 { 0, 0, 0, 0, 0, 0 },
132 { 0, 0, 0, 0, 0, 0 },
133 { 1, 0, 0, 1, 0, 0 },
134 { 1, 0, 0, 1, 0, 0 },
135 { 0, 0, 0, 0, 0, 0 },
136 { 1, 0, 0, 1, 0, 1 },
137 { 0, 0, 0, 0, 0, 0 },
138 { 0, 0, 0, 0, 0, 0 },
139 { 0, 0, 0, 0, 0, 0 },
140 { 0, 0, 0, 0, 0, 0 },
141 { 0, 0, 0, 0, 0, 0 },
142 { 0, 0, 0, 0, 0, 0 },
143 { 0, 0, 0, 0, 0, 0 },
144 { 0, 0, 0, 0, 0, 0 },
145 { 0, 0, 0, 0, 0, 0 },
146 },
147
148
149 {
150 { 1, 1, 0, 0, 0, 0 },
151 { 0, 0, 0, 0, 0, 0 },
152 { 0, 0, 0, 0, 0, 0 },
153 { 0, 0, 0, 0, 0, 0 },
154 { 0, 0, 0, 0, 0, 0 },
155 { 0, 0, 0, 0, 0, 0 },
156 { 0, 0, 0, 0, 0, 0 },
157 { 0, 0, 0, 0, 0, 0 },
158 { 0, 0, 0, 0, 0, 0 },
159 { 1, 1, 0, 0, 0, 0 },
160 { 1, 1, 0, 1, 0, 0 },
161 { 0, 0, 0, 0, 0, 0 },
162 { 0, 0, 0, 0, 0, 0 },
163 { 0, 0, 0, 0, 0, 0 },
164 { 0, 0, 0, 0, 0, 0 },
165 { 0, 0, 0, 0, 0, 0 },
166#if defined(CONFIG_HARD_I2C)
167 { 1, 1, 1, 0, 1, 0 },
168 { 1, 1, 1, 0, 1, 0 },
169#else
170 { 1, 0, 0, 0, 1, 1 },
171 { 1, 0, 0, 1, 1, 1 },
172#endif
173 { 0, 0, 0, 0, 0, 0 },
174 { 0, 0, 0, 0, 0, 0 },
175 { 0, 0, 0, 0, 0, 0 },
176 { 0, 0, 0, 0, 0, 0 },
177 { 1, 1, 0, 1, 0, 0 },
178 { 1, 1, 0, 0, 0, 0 },
179 { 0, 0, 0, 0, 0, 0 },
180 { 0, 0, 0, 0, 0, 0 },
181 { 0, 0, 0, 0, 0, 0 },
182 { 0, 0, 0, 0, 0, 0 },
183 { 0, 0, 0, 0, 0, 0 },
184 { 0, 0, 0, 0, 0, 0 },
185 { 0, 0, 0, 0, 0, 0 },
186 { 0, 0, 0, 0, 0, 0 }
187 }
188};
189
190
191
192
193
194
195
196
197static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
198 ulong orx, volatile uchar * base)
199{
200 volatile uchar c = 0xff;
201 volatile uint *sdmr_ptr;
202 volatile uint *orx_ptr;
203 ulong maxsize, size;
204 int i;
205
206
207
208
209
210
211 maxsize = (1 + (~orx | 0x7fff));
212
213 sdmr_ptr = &memctl->memc_psdmr;
214 orx_ptr = &memctl->memc_or1;
215
216 *orx_ptr = orx;
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238 *sdmr_ptr = sdmr | PSDMR_OP_PREA;
239 *base = c;
240
241 *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
242 for (i = 0; i < 8; i++)
243 *base = c;
244
245 *sdmr_ptr = sdmr | PSDMR_OP_MRW;
246 *(base + CONFIG_SYS_MRS_OFFS) = c;
247
248 *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
249 *base = c;
250
251 size = get_ram_size ((long *)base, maxsize);
252 *orx_ptr = orx | ~(size - 1);
253
254 return (size);
255}
256
257phys_size_t initdram (int board_type)
258{
259 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
260 volatile memctl8260_t *memctl = &immap->im_memctl;
261 long psize;
262#ifndef CONFIG_SYS_RAMBOOT
263 long sizelittle, sizebig;
264#endif
265
266 memctl->memc_psrt = CONFIG_SYS_PSRT;
267 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
268
269#ifndef CONFIG_SYS_RAMBOOT
270
271
272 sizelittle = try_init (memctl, CONFIG_SYS_PSDMR_LITTLE, CONFIG_SYS_OR1_LITTLE,
273 (uchar *) CONFIG_SYS_SDRAM_BASE);
274 sizebig = try_init (memctl, CONFIG_SYS_PSDMR_BIG, CONFIG_SYS_OR1_BIG,
275 (uchar *) CONFIG_SYS_SDRAM_BASE);
276 if (sizelittle < sizebig) {
277 psize = sizebig;
278 } else {
279 psize = try_init (memctl, CONFIG_SYS_PSDMR_LITTLE, CONFIG_SYS_OR1_LITTLE,
280 (uchar *) CONFIG_SYS_SDRAM_BASE);
281 }
282#endif
283
284 icache_enable ();
285
286 return (psize);
287}
288
289int checkboard (void)
290{
291 puts ("Board: MUAS3001\n");
292
293 return 0;
294}
295
296
297
298
299int board_early_init_r (void)
300{
301 return 0;
302}
303
304#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
305
306
307
308void ft_blob_update (void *blob, bd_t *bd)
309{
310 int ret, nodeoffset = 0;
311 ulong flash_data[4] = {0};
312 ulong speed = 0;
313
314
315 flash_data[2] = cpu_to_be32 (CONFIG_SYS_FLASH_BASE);
316 flash_data[3] = cpu_to_be32 (CONFIG_SYS_FLASH_SIZE);
317 nodeoffset = fdt_path_offset (blob, "/localbus");
318 if (nodeoffset >= 0) {
319 ret = fdt_setprop (blob, nodeoffset, "ranges", flash_data,
320 sizeof (flash_data));
321 if (ret < 0)
322 printf ("ft_blob_update): cannot set /localbus/ranges "
323 "property err:%s\n", fdt_strerror(ret));
324 } else {
325
326 printf ("ft_blob_update(): cannot find /localbus node "
327 "err:%s\n", fdt_strerror (nodeoffset));
328 }
329
330
331 nodeoffset = fdt_path_offset (blob, "/soc/cpm/serial");
332 if (nodeoffset >= 0) {
333 speed = cpu_to_be32 (bd->bi_baudrate);
334 ret = fdt_setprop (blob, nodeoffset, "current-speed", &speed,
335 sizeof (unsigned long));
336 if (ret < 0)
337 printf ("ft_blob_update): cannot set /soc/cpm/serial/current-speed "
338 "property err:%s\n", fdt_strerror (ret));
339 } else {
340
341 printf ("ft_blob_update(): cannot find /soc/cpm/smc2/current-speed node "
342 "err:%s\n", fdt_strerror (nodeoffset));
343 }
344}
345
346void ft_board_setup (void *blob, bd_t *bd)
347{
348 ft_cpu_setup (blob, bd);
349 ft_blob_update (blob, bd);
350}
351#endif
352