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 <config.h>
26#include <mpc8xx.h>
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43#define _not_used_ 0xffffffff
44
45const uint sdram_table[] = {
46
47 0x1f07fc04, 0xeeaefc04, 0x11adfc04, 0xefbbbc00,
48 0x1ff77c47,
49
50
51
52 0x1ff77c34, 0xefeabc34, 0x1fb57c35,
53
54
55 0x1f07fc04, 0xeeaefc04, 0x10adfc04, 0xf0affc00,
56 0xf0affc00, 0xf1affc00, 0xefbbbc00, 0x1ff77c47,
57 _not_used_, _not_used_, _not_used_, _not_used_,
58 _not_used_, _not_used_, _not_used_, _not_used_,
59
60
61 0x1f27fc04, 0xeeaebc00, 0x01b93c04, 0x1ff77c47,
62 _not_used_, _not_used_, _not_used_, _not_used_,
63
64
65 0x1f07fc04, 0xeeaebc00, 0x10ad7c00, 0xf0affc00,
66 0xf0affc00, 0xe1bbbc04, 0x1ff77c47, _not_used_,
67 _not_used_, _not_used_, _not_used_, _not_used_,
68 _not_used_, _not_used_, _not_used_, _not_used_,
69
70
71 0x1ff5fc84, 0xfffffc04, 0xfffffc04, 0xfffffc04,
72 0xfffffc84, 0xfffffc07, _not_used_, _not_used_,
73 _not_used_, _not_used_, _not_used_, _not_used_,
74
75
76 0x7ffffc07, _not_used_, _not_used_, _not_used_
77};
78
79
80
81
82
83
84
85int checkboard (void)
86{
87 puts ("Board: ICU862 Board\n");
88 return 0;
89}
90
91
92
93static long int dram_size (long int, long int *, long int);
94
95
96
97phys_size_t initdram (int board_type)
98{
99 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
100 volatile memctl8xx_t *memctl = &immap->im_memctl;
101 long int size8, size9;
102 long int size_b0 = 0;
103 unsigned long reg;
104
105 upmconfig (UPMA, (uint *) sdram_table,
106 sizeof (sdram_table) / sizeof (uint));
107
108
109
110
111
112
113
114 memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_8K;
115
116 memctl->memc_mar = 0x00000088;
117
118
119
120
121
122
123 memctl->memc_or1 = CONFIG_SYS_OR1_PRELIM;
124 memctl->memc_br1 = CONFIG_SYS_BR1_PRELIM;
125
126 memctl->memc_mamr = CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE));
127
128 udelay (200);
129
130
131
132 memctl->memc_mcr = 0x80002105;
133 udelay (200);
134 memctl->memc_mcr = 0x80002230;
135 udelay (200);
136
137 memctl->memc_mamr |= MAMR_PTAE;
138
139 udelay (1000);
140
141
142
143
144
145
146 size8 = dram_size (CONFIG_SYS_MAMR_8COL, SDRAM_BASE1_PRELIM,
147 SDRAM_MAX_SIZE);
148
149 udelay (1000);
150
151
152
153
154 size9 = dram_size (CONFIG_SYS_MAMR_9COL, SDRAM_BASE1_PRELIM,
155 SDRAM_MAX_SIZE);
156
157 if (size8 < size9) {
158 size_b0 = size9;
159
160 } else {
161 size_b0 = size8;
162 memctl->memc_mamr = CONFIG_SYS_MAMR_8COL;
163 udelay (500);
164
165 }
166
167 udelay (1000);
168
169
170
171
172
173 if ((size_b0 < 0x02000000)) {
174
175 memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
176 udelay (1000);
177 }
178
179
180
181
182
183 memctl->memc_or1 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
184 memctl->memc_br1 = (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
185
186
187 reg = memctl->memc_mptpr;
188 reg >>= 1;
189 memctl->memc_mptpr = reg;
190
191 udelay (10000);
192
193 return (size_b0);
194}
195
196
197
198
199
200
201
202
203
204
205
206static long int dram_size (long int mamr_value, long int *base,
207 long int maxsize)
208{
209 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
210 volatile memctl8xx_t *memctl = &immap->im_memctl;
211
212 memctl->memc_mamr = mamr_value;
213
214 return (get_ram_size(base, maxsize));
215}
216