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