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 <virtex2.h>
26#include <common.h>
27#include <mpc8xx.h>
28#include <asm/8xx_immap.h>
29#include "beeper.h"
30#include "fpga.h"
31#include "ioport.h"
32
33DECLARE_GLOBAL_DATA_PTR;
34
35#ifdef CONFIG_STATUS_LED
36#include <status_led.h>
37#endif
38
39#if defined(CONFIG_CMD_MII) && defined(CONFIG_MII)
40#include <net.h>
41#endif
42
43#if 0
44#define GEN860T_DEBUG
45#endif
46
47#ifdef GEN860T_DEBUG
48#define PRINTF(fmt,args...) printf (fmt ,##args)
49#else
50#define PRINTF(fmt,args...)
51#endif
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67#define UPMA_NOP_ADDR 0x5
68#define UPMA_PRECHARGE_ADDR 0x6
69#define UPMA_MRS_ADDR 0x12
70
71#define UPM_SINGLE_READ_ADDR 0x00
72#define UPM_BURST_READ_ADDR 0x08
73#define UPM_SINGLE_WRITE_ADDR 0x18
74#define UPM_BURST_WRITE_ADDR 0x20
75#define UPM_REFRESH_ADDR 0x30
76
77const uint sdram_upm_table[] = {
78
79 0x0e0fdc04, 0x01adfc04, 0x0fbffc00, 0x1fff5c05,
80 0xffffffff, 0x0fffffcd, 0x0fff0fce, 0xefcfffff,
81
82 0x0f0fdc04, 0x00fdfc04, 0xf0fffc00, 0xf0fffc00,
83 0xf1fffc00, 0xfffffc00, 0xfffffc05, 0xffffffff,
84 0xffffffff, 0xffffffff, 0x0ffffff4, 0x1f3d5ff4,
85 0xfffffff4, 0xfffffff5, 0xffffffff, 0xffffffff,
86
87 0x0f0fdc04, 0x00ad3c00, 0x1fff5c05, 0xffffffff,
88 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
89
90 0x0f0fdc00, 0x10fd7c00, 0xf0fffc00, 0xf0fffc00,
91 0xf1fffc04, 0xfffffc05, 0xffffffff, 0xffffffff,
92 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff7ff,
93 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
94
95 0x1ffddc84, 0xfffffc04, 0xfffffc04, 0xfffffc84,
96 0xfffffc05, 0xffffffff, 0xffffffff, 0xffffffff,
97 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
98
99};
100
101const uint selectmap_upm_table[] = {
102
103 0x88fffc06, 0x00fff404, 0x00fffc04, 0x33fffc00,
104 0xfffffc05, 0xffffffff, 0xffffffff, 0xffffffff,
105
106 0xfffffc04, 0xfffffc05, 0xffffffff, 0xffffffff,
107 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
108 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
109 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
110
111 0x88fffc04, 0x00fff400, 0x77fffc05, 0xffffffff,
112 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
113
114 0xfffffc04, 0xfffffc05, 0xffffffff, 0xffffffff,
115 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
116 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
117 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
118
119 0xfffffc04, 0xfffffc05, 0xffffffff, 0xffffffff,
120 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
121 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
122
123 0xfffffc05, 0xffffffff, 0xffffffff, 0xffffffff
124};
125
126
127
128
129int checkboard (void)
130{
131 char *s;
132 char buf[64];
133 int i;
134
135 i = getenv_f("board_id", buf, sizeof (buf));
136 s = (i > 0) ? buf : NULL;
137
138 if (s) {
139 printf ("%s ", s);
140 } else {
141 printf ("<unknown> ");
142 }
143
144 i = getenv_f("serial#", buf, sizeof (buf));
145 s = (i > 0) ? buf : NULL;
146
147 if (s) {
148 printf ("S/N %s\n", s);
149 } else {
150 printf ("S/N <unknown>\n");
151 }
152
153 printf ("CPU at %s MHz, ", strmhz (buf, gd->cpu_clk));
154 printf ("local bus at %s MHz\n", strmhz (buf, gd->bus_clk));
155 return (0);
156}
157
158
159
160
161phys_size_t initdram (int board_type)
162{
163 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
164 volatile memctl8xx_t *memctl = &immr->im_memctl;
165
166 upmconfig (UPMA,
167 (uint *) sdram_upm_table,
168 sizeof (sdram_upm_table) / sizeof (uint)
169 );
170
171
172
173
174 memctl->memc_mptpr = CONFIG_SYS_MPTPR_1BK_8K;
175 memctl->memc_mamr = CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE));
176
177
178
179
180 memctl->memc_or1 = CONFIG_SYS_OR1;
181 memctl->memc_br1 = CONFIG_SYS_BR1;
182
183
184
185
186
187
188
189
190
191
192
193
194 memctl->memc_mar = 0x00000000;
195 memctl->memc_mcr = MCR_UPM_A | MCR_OP_RUN | MCR_MB_CS1 |
196 MCR_MLCF (0) | UPMA_NOP_ADDR;
197 udelay (200);
198 memctl->memc_mar = 0x00000000;
199 memctl->memc_mcr = MCR_UPM_A | MCR_OP_RUN | MCR_MB_CS1 |
200 MCR_MLCF (4) | UPMA_PRECHARGE_ADDR;
201
202 memctl->memc_mar = 0x00000000;
203 memctl->memc_mcr = MCR_UPM_A | MCR_OP_RUN | MCR_MB_CS1 |
204 MCR_MLCF (2) | UPM_REFRESH_ADDR;
205
206 memctl->memc_mar = 0x00000088;
207 memctl->memc_mcr = MCR_UPM_A | MCR_OP_RUN | MCR_MB_CS1 |
208 MCR_MLCF (1) | UPMA_MRS_ADDR;
209
210 memctl->memc_mar = 0x00000000;
211 memctl->memc_mcr = MCR_UPM_A | MCR_OP_RUN | MCR_MB_CS1 |
212 MCR_MLCF (0) | UPMA_NOP_ADDR;
213
214
215
216 memctl->memc_mamr |= MAMR_PTAE;
217
218 return (SDRAM_SIZE);
219}
220
221
222
223
224
225#if defined(CONFIG_CMD_DOC)
226void doc_init (void)
227{
228 printf ("Probing at 0x%.8x: ", DOC_BASE);
229 doc_probe (DOC_BASE);
230}
231#endif
232
233
234
235
236int misc_init_r (void)
237{
238 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
239 volatile memctl8xx_t *memctl = &immr->im_memctl;
240
241
242
243
244 upmconfig (UPMB, (uint *) selectmap_upm_table,
245 sizeof (selectmap_upm_table) / sizeof (uint));
246
247 memctl->memc_mbmr = 0x0;
248
249 config_mpc8xx_ioports (immr);
250
251#if defined(CONFIG_CMD_MII)
252 mii_init ();
253#endif
254
255#if defined(CONFIG_FPGA)
256 gen860t_init_fpga ();
257#endif
258 return 0;
259}
260
261
262
263
264int last_stage_init (void)
265{
266#if !defined(CONFIG_SC)
267 char buf[256];
268 int i;
269
270
271
272
273 set_beeper_volume (-64);
274 init_beeper ();
275
276
277
278
279 i = getenv_f("beeper", buf, sizeof (buf));
280 if (i > 0) {
281 do_beeper (buf);
282 }
283#endif
284 return 0;
285}
286
287
288
289
290void board_poweroff (void)
291{
292 puts ("### Please power off the board ###\n");
293 while (1);
294}
295