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
26
27
28
29
30#include <common.h>
31#include <asm/u-boot.h>
32#include <commproc.h>
33#include "mpc8xx.h"
34
35
36
37static long int dram_size (long int, long int *, long int);
38
39
40
41const uint sdram_table[] =
42{
43
44
45
46 0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
47 0x1FF77C47, 0x1FF77C35, 0xEFEABC34, 0x1FB57C35,
48
49
50
51 0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
52 0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47,
53 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
54 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
55
56
57
58 0x1F27FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47,
59 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
60
61
62
63 0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
64 0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47, 0xFFFFEC04,
65 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
66 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
67
68
69
70 0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
71 0xFFFFFC84, 0xFFFFFC07, 0xFFFFEC04, 0xFFFFEC04,
72 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04,
73
74
75
76 0x7FFFFC07, 0xFFFFEC04, 0xFFFFEC04, 0xFFFFEC04
77};
78
79
80
81
82
83
84
85
86
87
88
89
90int checkboard (void)
91{
92 char *s, *e;
93 char buf[64];
94 int i;
95
96 i = getenv_f("serial#", buf, sizeof(buf));
97 s = (i>0) ? buf : NULL;
98
99 if (!s || strncmp(s, "QS860T", 6)) {
100 puts ("### No HW ID - assuming QS860T");
101 } else {
102 for (e=s; *e; ++e) {
103 if (*e == ' ')
104 break;
105 }
106
107 for ( ; s<e; ++s) {
108 putc (*s);
109 }
110 }
111 putc ('\n');
112
113 return (0);
114}
115
116
117
118phys_size_t initdram (int board_type)
119{
120 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
121 volatile memctl8xx_t *memctl = &immap->im_memctl;
122 long int size;
123
124 upmconfig(UPMB, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
125
126
127
128
129 memctl->memc_mptpr = 0x0400;
130
131
132
133
134 memctl->memc_or2 = CONFIG_SYS_OR2;
135 memctl->memc_br2 = CONFIG_SYS_BR2;
136 udelay(200);
137
138
139 memctl->memc_mbmr = CONFIG_SYS_16M_MBMR;
140 udelay(100);
141
142 memctl->memc_mar = 0x00000088;
143 memctl->memc_mcr = 0x80804105;
144 udelay(1);
145
146
147 memctl->memc_mbmr = 0x18802118;
148 memctl->memc_mcr = 0x80804130;
149 memctl->memc_mbmr = 0x18802114;
150 memctl->memc_mcr = 0x80804106;
151
152 udelay (1000);
153
154#if 0
155
156
157
158 size = dram_size (CONFIG_SYS_64M_MBMR, (ulong *)SDRAM_BASE, SDRAM_64M_MAX_SIZE);
159 udelay (1000);
160
161
162
163
164 if (size != SDRAM_64M_MAX_SIZE) {
165#endif
166 size = dram_size (CONFIG_SYS_16M_MBMR, (long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
167 udelay (1000);
168#if 0
169 }
170
171 memctl->memc_or2 = ((-size) & 0xFFFF0000) | SDRAM_TIMING;
172#endif
173
174
175 udelay(10000);
176
177
178#if 0
179
180
181
182
183
184
185
186
187 memctl->memc_or1 = CONFIG_SYS_OR1;
188 memctl->memc_br1 = CONFIG_SYS_BR1;
189
190
191
192
193
194
195 memctl->memc_or3 = CONFIG_SYS_OR3;
196 memctl->memc_br3 = CONFIG_SYS_BR3;
197
198
199
200
201 memctl->memc_or4 = CONFIG_SYS_OR4;
202 memctl->memc_br4 = CONFIG_SYS_BR4;
203
204 memctl->memc_or5 = CONFIG_SYS_OR5;
205 memctl->memc_br5 = CONFIG_SYS_BR5;
206
207 memctl->memc_or6 = CONFIG_SYS_OR6;
208 memctl->memc_br6 = CONFIG_SYS_BR6;
209
210 memctl->memc_or7 = CONFIG_SYS_OR7;
211 memctl->memc_br7 = CONFIG_SYS_BR7;
212
213#endif
214
215 return (size);
216}
217
218
219
220
221
222
223
224
225
226
227
228static long int dram_size (long int mbmr_value, long int *base, long int maxsize)
229{
230 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
231 volatile memctl8xx_t *memctl = &immap->im_memctl;
232
233 memctl->memc_mbmr = mbmr_value;
234
235 return (get_ram_size(base, maxsize));
236}
237