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