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 "mpc8xx.h"
26#include <linux/mtd/doc2000.h>
27
28extern int kbd_init(void);
29extern int drv_kbd_init(void);
30
31
32
33static long int dram_size (long int, long int *, long int);
34
35
36
37#define _NOT_USED_ 0xFFFFFFFF
38
39const uint sdram_table[] =
40{
41
42
43
44 0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
45 0x1FF77C47,
46
47
48
49
50
51
52
53
54 0x1FF77C34, 0xEFEABC34, 0x1FB57C35,
55
56
57
58 0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
59 0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47,
60 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
61 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
62
63
64
65 0x1F27FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47,
66 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
67
68
69
70 0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
71 0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47,
72 _NOT_USED_,
73 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
74 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
75
76
77
78 0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
79 0xFFFFFC84, 0xFFFFFC07,
80 _NOT_USED_, _NOT_USED_,
81 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
82
83
84
85 0x1FF7FC07,
86 _NOT_USED_, _NOT_USED_, _NOT_USED_,
87};
88
89const uint static_table[] =
90{
91
92
93
94 0x0FFFFC04, 0x0FF3FC04, 0x0FF3CC04, 0x0FF3CC04,
95 0x0FF3EC04, 0x0FF3CC00, 0x0FF7FC04, 0x3FFFFC04,
96 0xFFFFFC04, 0xFFFFFC05,
97 _NOT_USED_, _NOT_USED_,
98 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
99 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
100 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
101
102
103
104 0x0FFFFC04, 0x00FFFC04, 0x00FFFC04, 0x00FFFC04,
105 0x01FFFC00, 0x3FFFFC04, 0xFFFFFC04, 0xFFFFFC05,
106 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
107 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
108 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
109 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
110 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
111 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
112 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
113 _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
114};
115
116
117
118
119
120
121
122
123
124
125
126
127
128int checkboard (void)
129{
130 char *s = getenv ("serial#");
131
132 if (!s || strncmp (s, "TQM8", 4)) {
133 printf ("### No HW ID - assuming RBC823\n");
134 return (0);
135 }
136
137 puts (s);
138 putc ('\n');
139
140 return (0);
141}
142
143
144
145phys_size_t initdram (int board_type)
146{
147 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
148 volatile memctl8xx_t *memctl = &immap->im_memctl;
149 long int size_b0, size8, size9;
150
151 upmconfig (UPMA, (uint *) sdram_table,
152 sizeof (sdram_table) / sizeof (uint));
153
154
155
156
157 memctl->memc_mptpr = CONFIG_SYS_MPTPR_1BK_4K;
158 memctl->memc_mar = 0x00000088;
159
160
161
162
163 memctl->memc_or4 = CONFIG_SYS_OR4_PRELIM;
164 memctl->memc_br4 = CONFIG_SYS_BR4_PRELIM;
165 memctl->memc_mamr = CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE));
166 udelay (200);
167
168
169
170
171 memctl->memc_mcr = 0x80008105;
172 udelay (1);
173 memctl->memc_mamr = (CONFIG_SYS_MAMR_8COL & ~(MAMR_TLFA_MSK)) | MAMR_TLFA_8X;
174 udelay (200);
175 memctl->memc_mcr = 0x80008130;
176 udelay (1);
177 memctl->memc_mamr = (CONFIG_SYS_MAMR_8COL & ~(MAMR_TLFA_MSK)) | MAMR_TLFA_4X;
178 udelay (200);
179
180 memctl->memc_mamr |= MAMR_PTAE;
181 udelay (1000);
182
183
184
185
186
187
188
189 memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
190
191
192
193
194
195
196 size8 = dram_size (CONFIG_SYS_MAMR_8COL, (long *) SDRAM_BASE4_PRELIM,
197 SDRAM_MAX_SIZE);
198 udelay (1000);
199
200
201
202
203 size9 = dram_size (CONFIG_SYS_MAMR_9COL, (long *) SDRAM_BASE4_PRELIM,
204 SDRAM_MAX_SIZE);
205
206 if (size8 < size9) {
207 size_b0 = size9;
208
209 } else {
210 size_b0 = size8;
211 memctl->memc_mamr = CONFIG_SYS_MAMR_8COL;
212 udelay (500);
213
214 }
215
216 udelay (1000);
217
218
219
220
221
222 if ((size_b0 < 0x02000000)) {
223
224 memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
225 udelay (1000);
226 }
227
228
229
230 memctl->memc_or4 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
231 memctl->memc_br4 = (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
232
233 udelay (10000);
234
235 return (size_b0);
236}
237
238
239
240
241
242
243
244
245
246
247
248static long int dram_size (long int mamr_value, long int *base,
249 long int maxsize)
250{
251 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
252 volatile memctl8xx_t *memctl = &immap->im_memctl;
253
254 memctl->memc_mamr = mamr_value;
255
256 return (get_ram_size (base, maxsize));
257}
258
259#ifdef CONFIG_CMD_DOC
260void doc_init (void)
261{
262 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
263 volatile memctl8xx_t *memctl = &immap->im_memctl;
264
265 upmconfig (UPMB, (uint *) static_table,
266 sizeof (static_table) / sizeof (uint));
267 memctl->memc_mbmr = MAMR_DSA_1_CYCL;
268
269 doc_probe (FLASH_BASE1_PRELIM);
270}
271#endif
272