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 <mpc8xx.h>
27#include <commproc.h>
28
29
30
31static long int dram_size (long int, long int *, long int);
32
33
34
35#define _NOT_USED_ 0xFFFFFFFF
36
37const uint sharc_table[] = {
38
39
40
41 0x0FF3FC04, 0x0FF3EC00, 0x7FFFEC04, 0xFFFFEC04,
42 0xFFFFEC05,
43 _NOT_USED_, _NOT_USED_, _NOT_USED_,
44
45
46
47
48 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
49 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
50 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
51 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
52
53
54
55 0x0FAFFC04, 0x0FAFEC00, 0x7FFFEC04, 0xFFFFEC04,
56 0xFFFFEC05,
57 _NOT_USED_, _NOT_USED_, _NOT_USED_,
58
59
60
61
62 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
63 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
64 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
65 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
66
67
68
69
70 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
71 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
72 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
73
74
75
76 0x7FFFFC07,
77 _NOT_USED_, _NOT_USED_, _NOT_USED_,
78};
79
80
81const uint sdram_table[] = {
82
83
84
85 0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
86 0x1FF77C47,
87
88
89
90
91
92
93
94
95 0x1FF77C35, 0xEFEABC34, 0x1FB57C35,
96
97
98
99 0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
100 0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47,
101 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
102 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
103
104
105
106 0x1F27FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47,
107 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
108
109
110
111 0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
112 0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47,
113 _NOT_USED_,
114 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
115 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
116
117
118
119 0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
120 0xFFFFFC84, 0xFFFFFC07,
121 _NOT_USED_, _NOT_USED_,
122 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
123
124
125
126 0x7FFFFC07,
127 _NOT_USED_, _NOT_USED_, _NOT_USED_,
128};
129
130
131
132
133
134
135
136
137
138int checkboard (void)
139{
140 puts ("Board: SPD823TS\n");
141 return (0);
142}
143
144
145
146phys_size_t initdram (int board_type)
147{
148 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
149 volatile memctl8xx_t *memctl = &immap->im_memctl;
150 long int size_b0;
151
152#if 0
153
154
155
156 memctl->memc_or2 = CONFIG_SYS_OR2;
157 memctl->memc_br2 = CONFIG_SYS_BR2;
158#endif
159
160
161
162
163 memctl->memc_or4 = CONFIG_SYS_OR4;
164 memctl->memc_br4 = CONFIG_SYS_BR4;
165
166#if 0
167
168 upmconfig (UPMA, (uint *) sharc_table,
169 sizeof (sharc_table) / sizeof (uint));
170
171 memctl->memc_or5 = CONFIG_SYS_OR5;
172 memctl->memc_br5 = CONFIG_SYS_BR5;
173#endif
174
175 memctl->memc_mamr = 0x00001000;
176
177
178 upmconfig (UPMB, (uint *) sdram_table,
179 sizeof (sdram_table) / sizeof (uint));
180
181 memctl->memc_mptpr = CONFIG_SYS_MPTPR_1BK_8K;
182
183 memctl->memc_mar = 0x00000088;
184
185
186
187
188 memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
189 memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
190
191 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL;
192
193 udelay (200);
194 memctl->memc_mcr = 0x80806105;
195 udelay (1);
196 memctl->memc_mcr = 0x80806130;
197 udelay (1);
198 memctl->memc_mcr = 0x80806130;
199 udelay (1);
200 memctl->memc_mcr = 0x80806106;
201
202 memctl->memc_mbmr |= MBMR_PTBE;
203
204
205
206
207 size_b0 =
208 dram_size (CONFIG_SYS_MBMR_8COL, SDRAM_BASE3_PRELIM,
209 SDRAM_MAX_SIZE);
210
211 memctl->memc_mbmr = CONFIG_SYS_MBMR_8COL | MBMR_PTBE;
212
213 return (size_b0);
214}
215
216
217
218
219
220
221
222
223
224
225
226static long int dram_size (long int mamr_value, long int *base,
227 long int maxsize)
228{
229 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
230 volatile memctl8xx_t *memctl = &immap->im_memctl;
231
232 memctl->memc_mbmr = mamr_value;
233
234 return (get_ram_size (base, maxsize));
235}
236
237
238
239void reset_phy (void)
240{
241 immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
242 ushort sreg;
243
244
245 immr->im_ioport.iop_papar &= ~(PA_ENET_MDC | PA_ENET_MDIO);
246
247 sreg = immr->im_ioport.iop_padir;
248 sreg |= PA_ENET_MDC;
249 sreg &= ~(PA_ENET_MDIO);
250 immr->im_ioport.iop_padir = sreg;
251
252 immr->im_ioport.iop_padat &= ~(PA_ENET_MDC);
253
254
255
256
257
258
259
260
261
262
263 immr->im_ioport.iop_pcpar &= ~(PC_ENET_RESET);
264 immr->im_ioport.iop_pcdir |= PC_ENET_RESET;
265
266 immr->im_ioport.iop_pcdat &= ~(PC_ENET_RESET);
267 udelay (10);
268
269 immr->im_ioport.iop_pcdat |= PC_ENET_RESET;
270 udelay (10);
271}
272
273
274
275void ide_set_reset (int on)
276{
277 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
278
279
280
281
282 if (on) {
283 immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET);
284 } else {
285 immr->im_ioport.iop_pcdat |= CONFIG_SYS_PC_IDE_RESET;
286 }
287
288
289 immr->im_ioport.iop_pcpar &= ~(CONFIG_SYS_PC_IDE_RESET);
290 immr->im_ioport.iop_pcso &= ~(CONFIG_SYS_PC_IDE_RESET);
291 immr->im_ioport.iop_pcdir |= CONFIG_SYS_PC_IDE_RESET;
292}
293
294
295