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#include <common.h>
29#include <ppc4xx.h>
30#include <asm/processor.h>
31#include <asm/io.h>
32
33DECLARE_GLOBAL_DATA_PTR;
34
35
36extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
37
38int board_early_init_f(void)
39{
40 register uint reg;
41
42
43
44
45 mfebc(xbcfg, reg);
46 mtebc(xbcfg, reg | 0x04000000);
47
48
49
50
51
52
53 out32(GPIO0_OSRL, in32(GPIO0_OSRL) | 0x54000000);
54 out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x54000000);
55 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x54000000);
56
57
58 out32(GPIO0_TCR, in32(GPIO0_TCR) | 0xC080);
59 out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x40);
60 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x55);
61 out32(GPIO0_OSRH, in32(GPIO0_OSRH) | 0x50004000);
62 out32(GPIO0_ISR1H, in32(GPIO0_ISR1H) | 0x00440000);
63
64
65 out32(GPIO1_TCR, in32(GPIO1_TCR) | 0x16000000);
66 out32(GPIO1_OSRL, in32(GPIO1_OSRL) | 0x02180000);
67 out32(GPIO1_ISR1L, in32(GPIO1_ISR1L) | 0x00400000);
68 out32(GPIO1_ISR2L, in32(GPIO1_ISR2L) | 0x04010000);
69
70
71 out32(GPIO0_OSRL, in32(GPIO0_OSRL) & ~0x00C00000);
72 out32(GPIO0_TSRL, in32(GPIO0_TSRL) & ~0x00C00000);
73 out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) & ~0x00C00000);
74 out32(GPIO0_TCR, in32(GPIO0_TCR) | 0x08000000);
75 out32(GPIO0_OR, in32(GPIO0_OR) & ~0x08000000);
76
77
78 out32(GPIO1_TCR, in32(GPIO1_TCR) & ~0x00f00000);
79 out32(GPIO1_TSRL, in32(GPIO1_TSRL) & ~0x00005500);
80 out32(GPIO1_ISR1L, in32(GPIO1_ISR1L) | 0x00005500);
81
82
83
84
85
86 mtdcr(uic0sr, 0xffffffff);
87 mtdcr(uic0er, 0x00000000);
88 mtdcr(uic0cr, 0x00000009);
89 mtdcr(uic0pr, 0xfffffe13);
90 mtdcr(uic0tr, 0x01c00008);
91 mtdcr(uic0vr, 0x00000001);
92 mtdcr(uic0sr, 0xffffffff);
93
94 mtdcr(uic1sr, 0xffffffff);
95 mtdcr(uic1er, 0x00000000);
96 mtdcr(uic1cr, 0x00000000);
97 mtdcr(uic1pr, 0xffffe0ff);
98 mtdcr(uic1tr, 0x00ffc000);
99 mtdcr(uic1vr, 0x00000001);
100 mtdcr(uic1sr, 0xffffffff);
101
102
103
104
105 mfsdr(sdr_pci0, reg);
106 mtsdr(sdr_pci0, 0x80000000 | reg);
107 mtsdr(sdr_pfc0, 0x00003e00);
108 mtsdr(sdr_pfc1, 0x00048000);
109
110 return 0;
111}
112
113int misc_init_r(void)
114{
115 uint pbcr;
116 int size_val;
117 uint sz;
118
119
120 mfebc(pb0cr, pbcr);
121
122 if (gd->bd->bi_flashsize > 0x08000000)
123 panic("Max. flash banksize is 128 MB!\n");
124
125 for (sz = gd->bd->bi_flashsize, size_val = 7;
126 ((sz & 0x08000000) == 0) && (size_val > 0); --size_val)
127 sz <<= 1;
128
129 pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
130 mtebc(pb0cr, pbcr);
131
132
133 gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
134 gd->bd->bi_flashoffset = 0;
135
136
137 (void)flash_protect(FLAG_PROTECT_SET,
138 -CONFIG_SYS_MONITOR_LEN,
139 0xffffffff,
140 &flash_info[0]);
141
142 return 0;
143}
144
145int checkboard(void)
146{
147 char *s = getenv("serial#");
148
149 printf("Board: GDPPC440ETX - G&D PPC440EP/GR ETX-module");
150
151 if (s != NULL) {
152 puts(", serial# ");
153 puts(s);
154 }
155 putc('\n');
156
157 return 0;
158}
159
160
161
162
163
164
165
166
167
168
169
170
171
172#if defined(CONFIG_PCI)
173int pci_pre_init(struct pci_controller *hose)
174{
175 unsigned long addr;
176
177
178
179
180
181 mfsdr(sdr_amp1, addr);
182 mtsdr(sdr_amp1, (addr & 0x000000FF) | 0x0000FF00);
183 addr = mfdcr(plb3_acr);
184 mtdcr(plb3_acr, addr | 0x80000000);
185
186
187
188
189 mfsdr(sdr_amp0, addr);
190 mtsdr(sdr_amp0, (addr & 0x000000FF) | 0x0000FF00);
191 addr = mfdcr(plb4_acr) | 0xa0000000;
192 mtdcr(plb4_acr, addr);
193
194
195
196
197
198 addr = (mfdcr(plb0_acr) & ~plb0_acr_ppm_mask) | plb0_acr_ppm_fair;
199 addr = (addr & ~plb0_acr_hbu_mask) | plb0_acr_hbu_enabled;
200 addr = (addr & ~plb0_acr_rdp_mask) | plb0_acr_rdp_4deep;
201 addr = (addr & ~plb0_acr_wrp_mask) | plb0_acr_wrp_2deep;
202 mtdcr(plb0_acr, addr);
203
204
205 addr = (mfdcr(plb1_acr) & ~plb1_acr_ppm_mask) | plb1_acr_ppm_fair;
206 addr = (addr & ~plb1_acr_hbu_mask) | plb1_acr_hbu_enabled;
207 addr = (addr & ~plb1_acr_rdp_mask) | plb1_acr_rdp_4deep;
208 addr = (addr & ~plb1_acr_wrp_mask) | plb1_acr_wrp_2deep;
209 mtdcr(plb1_acr, addr);
210
211
212 out32(GPIO1_TCR, in32(GPIO1_TCR) | 0x00008000);
213 out32(GPIO1_OR, in32(GPIO1_OR) | 0x00008000);
214
215 return 1;
216}
217#endif
218
219
220
221
222
223
224
225
226
227#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_TARGET_INIT)
228void pci_target_init(struct pci_controller *hose)
229{
230
231
232
233
234
235
236
237
238
239
240
241
242 out32r(PCIX0_PMM0MA, 0x00000000);
243 out32r(PCIX0_PMM0LA, CONFIG_SYS_PCI_MEMBASE);
244 out32r(PCIX0_PMM0PCILA, CONFIG_SYS_PCI_MEMBASE);
245 out32r(PCIX0_PMM0PCIHA, 0x00000000);
246 out32r(PCIX0_PMM0MA, 0xE0000001);
247
248 out32r(PCIX0_PMM1MA, 0x00000000);
249 out32r(PCIX0_PMM1LA, CONFIG_SYS_PCI_MEMBASE2);
250 out32r(PCIX0_PMM1PCILA, CONFIG_SYS_PCI_MEMBASE2);
251 out32r(PCIX0_PMM1PCIHA, 0x00000000);
252 out32r(PCIX0_PMM1MA, 0xE0000001);
253
254 out32r(PCIX0_PTM1MS, 0x00000001);
255 out32r(PCIX0_PTM1LA, 0);
256 out32r(PCIX0_PTM2MS, 0);
257 out32r(PCIX0_PTM2LA, 0);
258
259
260
261
262
263
264 pci_write_config_word(0, PCI_SUBSYSTEM_VENDOR_ID,
265 CONFIG_SYS_PCI_SUBSYS_VENDORID);
266 pci_write_config_word(0, PCI_SUBSYSTEM_ID, CONFIG_SYS_PCI_SUBSYS_ID);
267
268
269 pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER);
270
271
272 pci_write_config_word(0, PCI_LATENCY_TIMER, 1);
273
274
275 pci_write_config_word(0, PCI_ERREN, 0);
276
277 pci_write_config_dword(0, PCI_BRDGOPT2, 0x00000101);
278
279}
280#endif
281
282
283
284
285
286#if defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT)
287void pci_master_init(struct pci_controller *hose)
288{
289 unsigned short temp_short;
290
291
292
293
294
295
296 pci_read_config_word(0, PCI_COMMAND, &temp_short);
297 pci_write_config_word(0, PCI_COMMAND,
298 temp_short | PCI_COMMAND_MASTER |
299 PCI_COMMAND_MEMORY);
300}
301#endif
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318#if defined(CONFIG_PCI)
319int is_pci_host(struct pci_controller *hose)
320{
321 return 1;
322}
323#endif
324