1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include <common.h>
26#include <ioports.h>
27#include <mpc8260.h>
28#include <i2c.h>
29#include <bcd.h>
30
31
32#undef INIT_LOCAL_BUS_SDRAM
33
34
35#define PPC8260_I2C_ADR 0x30
36#define LM84_PPC_I2C_ADR 0x2A
37#define LM84_SHARC_I2C_ADR 0x29
38#define VIRTEX_I2C_ADR 0x25
39#define X24645_PPC_I2C_ADR 0x00
40#define RS5C372_PPC_I2C_ADR 0x32
41
42
43
44
45
46
47
48
49const iop_conf_t iop_conf_tab[4][32] = {
50
51
52 {
53 { 0, 0, 0, 0, 0, 0 },
54 { 0, 0, 0, 0, 0, 0 },
55 { 0, 0, 0, 0, 0, 0 },
56 { 0, 0, 0, 0, 0, 0 },
57 { 0, 0, 0, 0, 0, 0 },
58 { 0, 0, 0, 0, 0, 0 },
59 { 0, 0, 0, 0, 0, 0 },
60 { 0, 0, 0, 0, 0, 0 },
61 { 0, 0, 0, 0, 0, 0 },
62 { 0, 0, 0, 0, 0, 0 },
63 { 0, 0, 0, 0, 0, 0 },
64 { 0, 0, 0, 0, 0, 0 },
65 { 0, 0, 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 { 0, 0, 0, 0, 0, 0 },
75 { 0, 0, 0, 0, 0, 0 },
76 { 0, 0, 0, 0, 0, 0 },
77 { 0, 0, 0, 0, 0, 0 },
78 { 0, 0, 0, 0, 0, 0 },
79 { 0, 0, 0, 0, 0, 0 },
80 { 0, 0, 0, 0, 0, 0 },
81 { 0, 0, 0, 0, 0, 0 },
82 { 0, 0, 0, 0, 0, 0 },
83 { 0, 0, 0, 0, 0, 0 },
84 { 0, 0, 0, 0, 0, 0 }
85 },
86
87
88 {
89 { 1, 1, 0, 1, 0, 0 },
90 { 1, 1, 0, 0, 0, 0 },
91 { 1, 1, 1, 1, 0, 0 },
92 { 1, 1, 0, 0, 0, 0 },
93 { 1, 1, 0, 0, 0, 0 },
94 { 1, 1, 0, 0, 0, 0 },
95 { 1, 1, 0, 1, 0, 0 },
96 { 1, 1, 0, 1, 0, 0 },
97 { 1, 1, 0, 1, 0, 0 },
98 { 1, 1, 0, 1, 0, 0 },
99 { 1, 1, 0, 0, 0, 0 },
100 { 1, 1, 0, 0, 0, 0 },
101 { 1, 1, 0, 0, 0, 0 },
102 { 1, 1, 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 { 0, 0, 0, 0, 0, 0 },
111 { 0, 0, 0, 0, 0, 0 },
112 { 0, 0, 0, 0, 0, 0 },
113 { 0, 0, 0, 0, 0, 0 },
114 { 0, 0, 0, 0, 0, 0 },
115 { 0, 0, 0, 0, 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 },
122
123
124 {
125 { 0, 0, 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 { 0, 0, 0, 0, 0, 0 },
131 { 0, 0, 0, 0, 0, 0 },
132 { 0, 0, 0, 0, 0, 0 },
133 { 0, 0, 0, 0, 0, 0 },
134 { 0, 0, 0, 0, 0, 0 },
135 { 0, 0, 0, 0, 0, 0 },
136 { 0, 0, 0, 0, 0, 0 },
137 { 1, 1, 0, 0, 0, 0 },
138 { 1, 1, 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 { 1, 1, 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 { 1, 0, 0, 1, 0, 0 },
147 { 1, 0, 0, 1, 0, 0 },
148 { 0, 0, 0, 0, 0, 0 },
149 { 0, 0, 0, 0, 0, 0 },
150 { 0, 0, 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 },
158
159
160 {
161 { 1, 1, 0, 0, 0, 0 },
162 { 1, 1, 1, 1, 0, 0 },
163 { 0, 0, 0, 0, 0, 0 },
164 { 0, 0, 0, 0, 0, 0 },
165 { 0, 0, 0, 0, 0, 0 },
166 { 0, 0, 0, 0, 0, 0 },
167 { 0, 0, 0, 0, 0, 0 },
168 { 0, 0, 0, 0, 0, 0 },
169 { 0, 0, 0, 0, 0, 0 },
170 { 0, 0, 0, 0, 0, 0 },
171 { 0, 0, 0, 0, 0, 0 },
172 { 0, 0, 0, 0, 0, 0 },
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, 1, 0, 1, 0 },
178 { 1, 1, 1, 0, 1, 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 { 0, 0, 0, 0, 0, 0 },
188 { 0, 0, 0, 0, 0, 0 },
189 { 0, 0, 0, 0, 0, 0 },
190 { 0, 0, 0, 0, 0, 0 },
191 { 0, 0, 0, 0, 0, 0 },
192 { 0, 0, 0, 0, 0, 0 }
193 }
194};
195
196
197
198struct tm {
199 unsigned int tm_sec;
200 unsigned int tm_min;
201 unsigned int tm_hour;
202 unsigned int tm_wday;
203 unsigned int tm_mday;
204 unsigned int tm_mon;
205 unsigned int tm_year;
206};
207
208void read_RS5C372_time (struct tm *timedate)
209{
210 unsigned char buffer[8];
211
212 if (! i2c_read (RS5C372_PPC_I2C_ADR, 0, 1, buffer, sizeof (buffer))) {
213 timedate->tm_sec = bcd2bin (buffer[0]);
214 timedate->tm_min = bcd2bin (buffer[1]);
215 timedate->tm_hour = bcd2bin (buffer[2]);
216 timedate->tm_wday = bcd2bin (buffer[3]);
217 timedate->tm_mday = bcd2bin (buffer[4]);
218 timedate->tm_mon = bcd2bin (buffer[5]);
219 timedate->tm_year = bcd2bin (buffer[6]) + 2000;
220 } else {
221
222 memset (timedate, 0, sizeof (struct tm));
223 }
224}
225
226
227
228int read_LM84_temp (int address)
229{
230 unsigned char buffer[8];
231
232
233 if (! i2c_read (address, 0, 1, buffer, 1)) {
234 return (int) buffer[0];
235 } else {
236
237 return -42;
238 }
239}
240
241
242
243
244
245
246
247int checkboard (void)
248{
249 struct tm timedate;
250 unsigned int ppctemp, prottemp;
251
252 puts ("Board: Rohde & Schwarz 8260 Protocol Board\n");
253
254
255 i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
256
257 read_RS5C372_time (&timedate);
258 printf (" Time: %02d:%02d:%02d\n",
259 timedate.tm_hour, timedate.tm_min, timedate.tm_sec);
260 printf (" Date: %02d-%02d-%04d\n",
261 timedate.tm_mday, timedate.tm_mon, timedate.tm_year);
262 ppctemp = read_LM84_temp (LM84_PPC_I2C_ADR);
263 prottemp = read_LM84_temp (LM84_SHARC_I2C_ADR);
264 printf (" Temp: PPC %d C, Protocol Board %d C\n",
265 ppctemp, prottemp);
266
267 return 0;
268}
269
270
271
272
273
274
275
276
277int misc_init_f (void)
278{
279 return 0;
280}
281
282
283
284phys_size_t initdram (int board_type)
285{
286 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
287 volatile memctl8260_t *memctl = &immap->im_memctl;
288
289#ifdef INIT_LOCAL_BUS_SDRAM
290 volatile uchar *ramaddr8;
291#endif
292 volatile ulong *ramaddr32;
293 ulong sdmr;
294 int i;
295
296
297
298
299
300 if ((ulong) initdram & 0xff000000) {
301 immap->im_siu_conf.sc_ppc_acr = 0x02;
302 immap->im_siu_conf.sc_ppc_alrh = 0x01267893;
303 immap->im_siu_conf.sc_ppc_alrl = 0x89ABCDEF;
304 immap->im_siu_conf.sc_lcl_acr = 0x02;
305 immap->im_siu_conf.sc_lcl_alrh = 0x01234567;
306 immap->im_siu_conf.sc_lcl_alrl = 0x89ABCDEF;
307
308
309
310
311 immap->im_siu_conf.sc_tescr1 = 0x00040000;
312 immap->im_siu_conf.sc_ltescr1 = 0x00040000;
313
314
315
316
317
318
319
320
321 memctl->memc_mptpr = 0x2000;
322 memctl->memc_mar = 0x0200;
323#ifdef INIT_LOCAL_BUS_SDRAM
324
325
326
327
328
329 memctl->memc_lsrt = 0x0b;
330 memctl->memc_lurt = 0x00;
331 ramaddr = (uchar *) PHYS_SDRAM_LOCAL;
332 sdmr = CONFIG_SYS_LSDMR & ~(PSDMR_OP_MSK | PSDMR_RFEN | PSDMR_PBI);
333 memctl->memc_lsdmr = sdmr | PSDMR_OP_PREA;
334 *ramaddr = 0xff;
335 for (i = 0; i < 8; i++) {
336 memctl->memc_lsdmr = sdmr | PSDMR_OP_CBRR;
337 *ramaddr = 0xff;
338 }
339 memctl->memc_lsdmr = sdmr | PSDMR_OP_MRW;
340 *ramaddr = 0xff;
341 memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_NORM;
342#endif
343
344 memctl->memc_psrt = 0x0b;
345 memctl->memc_purt = 0x08;
346 ramaddr32 = (ulong *) PHYS_SDRAM_60X;
347 sdmr = CONFIG_SYS_PSDMR & ~(PSDMR_OP_MSK | PSDMR_RFEN | PSDMR_PBI);
348 memctl->memc_psdmr = sdmr | PSDMR_OP_PREA;
349 ramaddr32[0] = 0x00ff00ff;
350 ramaddr32[1] = 0x00ff00ff;
351 memctl->memc_psdmr = sdmr | PSDMR_OP_CBRR;
352 for (i = 0; i < 8; i++) {
353 ramaddr32[0] = 0x00ff00ff;
354 ramaddr32[1] = 0x00ff00ff;
355 }
356 memctl->memc_psdmr = sdmr | PSDMR_OP_MRW;
357 ramaddr32[0] = 0x00ff00ff;
358 ramaddr32[1] = 0x00ff00ff;
359 memctl->memc_psdmr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
360 }
361
362
363 return PHYS_SDRAM_60X_SIZE;
364}
365
366
367
368
369
370
371
372
373int misc_init_r (void)
374{
375 printf ("misc_init_r\n");
376 return (0);
377}
378