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
32#include <common.h>
33#include <pci.h>
34#include <asm/processor.h>
35#include <asm/mmu.h>
36#include <asm/immap_85xx.h>
37#include <asm/fsl_ddr_sdram.h>
38#include <ioports.h>
39#include <asm/io.h>
40#include <spd_sdram.h>
41#include <miiphy.h>
42
43long int fixed_sdram (void);
44
45
46
47
48
49
50
51
52const iop_conf_t iop_conf_tab[4][32] = {
53
54
55 {
56 { 0, 1, 0, 1, 0, 0 },
57 { 0, 1, 0, 0, 0, 0 },
58 { 0, 1, 0, 1, 0, 0 },
59 { 0, 1, 0, 1, 0, 0 },
60 { 0, 1, 0, 0, 0, 0 },
61 { 0, 1, 0, 0, 0, 0 },
62 { 0, 1, 0, 1, 0, 0 },
63 { 0, 1, 0, 1, 0, 0 },
64 { 0, 1, 0, 1, 0, 0 },
65 { 0, 1, 0, 1, 0, 0 },
66 { 0, 1, 0, 1, 0, 0 },
67 { 0, 1, 0, 1, 0, 0 },
68 { 0, 1, 0, 1, 0, 0 },
69 { 0, 1, 0, 1, 0, 0 },
70 { 0, 1, 0, 0, 0, 0 },
71 { 0, 1, 0, 0, 0, 0 },
72 { 0, 1, 0, 0, 0, 0 },
73 { 0, 1, 0, 0, 0, 0 },
74 { 0, 1, 0, 0, 0, 0 },
75 { 0, 1, 0, 0, 0, 0 },
76 { 0, 1, 0, 0, 0, 0 },
77 { 0, 1, 0, 0, 0, 0 },
78 { 0, 1, 1, 1, 0, 0 },
79 { 0, 1, 1, 0, 0, 0 },
80 { 0, 0, 0, 1, 0, 0 },
81 { 0, 1, 1, 1, 0, 0 },
82 { 0, 0, 0, 1, 0, 0 },
83 { 0, 0, 0, 1, 0, 0 },
84 { 0, 0, 0, 1, 0, 0 },
85 { 0, 0, 0, 1, 0, 0 },
86 { 1, 0, 0, 0, 0, 0 },
87 { 0, 0, 0, 1, 0, 0 }
88 },
89
90
91 {
92 { 1, 1, 0, 1, 0, 0 },
93 { 1, 1, 0, 0, 0, 0 },
94 { 1, 1, 1, 1, 0, 0 },
95 { 1, 1, 0, 0, 0, 0 },
96 { 1, 1, 0, 0, 0, 0 },
97 { 1, 1, 0, 0, 0, 0 },
98 { 1, 1, 0, 1, 0, 0 },
99 { 1, 1, 0, 1, 0, 0 },
100 { 1, 1, 0, 1, 0, 0 },
101 { 1, 1, 0, 1, 0, 0 },
102 { 1, 1, 0, 0, 0, 0 },
103 { 1, 1, 0, 0, 0, 0 },
104 { 1, 1, 0, 0, 0, 0 },
105 { 1, 1, 0, 0, 0, 0 },
106 { 0, 1, 0, 0, 0, 0 },
107 { 0, 1, 0, 0, 0, 0 },
108 { 0, 1, 0, 1, 0, 0 },
109 { 0, 1, 0, 1, 0, 0 },
110 { 0, 1, 0, 0, 0, 0 },
111 { 0, 1, 0, 0, 0, 0 },
112 { 0, 1, 0, 0, 0, 0 },
113 { 0, 1, 0, 0, 0, 0 },
114 { 0, 1, 0, 0, 0, 0 },
115 { 0, 1, 0, 0, 0, 0 },
116 { 0, 1, 0, 1, 0, 0 },
117 { 0, 1, 0, 1, 0, 0 },
118 { 0, 1, 0, 1, 0, 0 },
119 { 0, 1, 0, 1, 0, 0 },
120 { 0, 0, 0, 0, 0, 0 },
121 { 0, 0, 0, 0, 0, 0 },
122 { 0, 0, 0, 0, 0, 0 },
123 { 0, 0, 0, 0, 0, 0 }
124 },
125
126
127 {
128 { 0, 0, 0, 1, 0, 0 },
129 { 0, 0, 0, 1, 0, 0 },
130 { 0, 1, 1, 0, 0, 0 },
131 { 0, 0, 0, 1, 0, 0 },
132 { 0, 0, 0, 1, 0, 0 },
133 { 0, 0, 0, 1, 0, 0 },
134 { 0, 0, 0, 1, 0, 0 },
135 { 0, 0, 0, 1, 0, 0 },
136 { 0, 1, 0, 1, 0, 0 },
137 { 0, 1, 0, 0, 0, 0 },
138 { 0, 1, 0, 0, 0, 0 },
139 { 0, 1, 0, 0, 0, 0 },
140 { 1, 1, 0, 0, 0, 0 },
141 { 1, 1, 0, 0, 0, 0 },
142 { 0, 0, 0, 1, 0, 0 },
143 { 0, 1, 0, 0, 0, 0 },
144 { 0, 1, 0, 0, 0, 0 },
145 { 0, 1, 0, 0, 0, 0 },
146 { 0, 0, 0, 1, 0, 0 },
147 { 0, 1, 0, 1, 0, 0 },
148 { 0, 0, 0, 1, 0, 0 },
149 { 0, 0, 0, 1, 0, 0 },
150 { 0, 0, 0, 0, 0, 0 },
151 { 0, 0, 0, 1, 0, 0 },
152 { 0, 0, 0, 1, 0, 0 },
153 { 0, 0, 0, 1, 0, 0 },
154 { 0, 0, 0, 1, 0, 0 },
155 { 0, 0, 0, 1, 0, 0 },
156 { 0, 0, 0, 1, 0, 0 },
157 { 0, 0, 0, 1, 0, 1 },
158 { 0, 0, 0, 1, 0, 0 },
159 { 0, 0, 0, 1, 0, 0 },
160 },
161
162
163 {
164 { 0, 1, 0, 0, 0, 0 },
165 { 0, 1, 1, 1, 0, 0 },
166 { 0, 1, 0, 1, 0, 0 },
167 { 1, 1, 0, 0, 0, 0 },
168 { 1, 1, 0, 1, 0, 0 },
169 { 0, 0, 0, 1, 0, 0 },
170 { 0, 0, 0, 1, 0, 0 },
171 { 0, 0, 0, 1, 0, 0 },
172 { 0, 0, 0, 1, 0, 0 },
173 { 0, 0, 0, 1, 0, 0 },
174 { 0, 0, 0, 1, 0, 0 },
175 { 0, 0, 0, 1, 0, 0 },
176 { 0, 0, 0, 1, 0, 0 },
177 { 0, 0, 0, 1, 0, 0 },
178 { 0, 1, 0, 0, 0, 0 },
179 { 0, 1, 0, 1, 0, 0 },
180 { 1, 1, 1, 0, 1, 0 },
181 { 1, 1, 1, 0, 0, 0 },
182 { 0, 0, 0, 0, 0, 0 },
183 { 0, 0, 0, 0, 0, 0 },
184 { 0, 0, 0, 0, 0, 0 },
185 { 0, 0, 0, 0, 0, 0 },
186 { 0, 1, 0, 1, 0, 0 },
187 { 0, 1, 0, 0, 0, 0 },
188 { 0, 0, 0, 1, 0, 1 },
189 { 0, 0, 0, 1, 0, 1 },
190 { 0, 0, 0, 1, 0, 1 },
191 { 0, 0, 0, 1, 0, 1 },
192 { 0, 0, 0, 0, 0, 0 },
193 { 0, 0, 0, 0, 0, 0 },
194 { 0, 0, 0, 0, 0, 0 },
195 { 0, 0, 0, 0, 0, 0 }
196 }
197};
198
199static uint64_t next_led_update;
200static uint led_bit;
201
202int
203board_early_init_f(void)
204{
205#if defined(CONFIG_PCI)
206 volatile ccsr_pcix_t *pci = (void *)(CONFIG_SYS_MPC85xx_PCIX_ADDR);
207
208 pci->peer &= 0xfffffffdf;
209#endif
210 return 0;
211}
212
213void
214reset_phy(void)
215{
216 volatile uint *blatch;
217
218 blatch = (volatile uint *)CONFIG_SYS_LBC_LCLDEVS_BASE;
219
220
221
222 *blatch &= ~0x000000c0;
223 udelay(100);
224 *blatch = 0x000000c1;
225 udelay(1000);
226
227#if 0
228
229#if (CONFIG_ETHER_INDEX == 2)
230 bcsr->bcsr2 &= ~FETH2_RST;
231 udelay(2);
232 bcsr->bcsr2 |= FETH2_RST;
233 udelay(1000);
234#elif (CONFIG_ETHER_INDEX == 3)
235 bcsr->bcsr3 &= ~FETH3_RST;
236 udelay(2);
237 bcsr->bcsr3 |= FETH3_RST;
238 udelay(1000);
239#endif
240#if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
241
242 miiphy_reset("FCC1", 0x0);
243
244
245 bb_miiphy_write(NULL, 0, PHY_MIPSCR, 0xf028);
246
247 bb_miiphy_write(NULL, 0x02, PHY_BMCR,
248 PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
249#endif
250#endif
251}
252
253int
254checkboard(void)
255{
256 printf ("Board: Silicon Tx GPPP 8560 Board\n");
257 return (0);
258}
259
260
261
262void
263show_activity(int flag)
264{
265 volatile uint *blatch;
266
267 if (next_led_update > get_ticks())
268 return;
269
270 blatch = (volatile uint *)CONFIG_SYS_LBC_LCLDEVS_BASE;
271
272 led_bit >>= 1;
273 if (led_bit == 0)
274 led_bit = 0x08;
275 *blatch = (0xc0 | led_bit);
276 eieio();
277 next_led_update += (get_tbclk() / 4);
278}
279
280phys_size_t
281initdram (int board_type)
282{
283 long dram_size = 0;
284
285#if defined(CONFIG_DDR_DLL)
286 {
287 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
288 uint temp_ddrdll = 0;
289
290
291 temp_ddrdll = gur->ddrdllcr;
292 gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000;
293 asm("sync;isync;msync");
294 }
295#endif
296
297 dram_size = fsl_ddr_sdram();
298 dram_size = setup_ddr_tlbs(dram_size / 0x100000);
299 dram_size *= 0x100000;
300
301#if defined(CONFIG_DDR_ECC)
302
303
304 ddr_enable_ecc(dram_size);
305#endif
306
307 return dram_size;
308}
309
310
311#if defined(CONFIG_SYS_DRAM_TEST)
312int testdram (void)
313{
314 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
315 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
316 uint *p;
317
318 printf("SDRAM test phase 1:\n");
319 for (p = pstart; p < pend; p++)
320 *p = 0xaaaaaaaa;
321
322 for (p = pstart; p < pend; p++) {
323 if (*p != 0xaaaaaaaa) {
324 printf ("SDRAM test fails at: %08x\n", (uint) p);
325 return 1;
326 }
327 }
328
329 printf("SDRAM test phase 2:\n");
330 for (p = pstart; p < pend; p++)
331 *p = 0x55555555;
332
333 for (p = pstart; p < pend; p++) {
334 if (*p != 0x55555555) {
335 printf ("SDRAM test fails at: %08x\n", (uint) p);
336 return 1;
337 }
338 }
339
340 printf("SDRAM test passed.\n");
341 return 0;
342}
343#endif
344
345#if defined(CONFIG_PCI)
346
347
348
349
350
351#ifndef CONFIG_PCI_PNP
352static struct pci_config_table pci_stxgp3_config_table[] = {
353 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
354 PCI_IDSEL_NUMBER, PCI_ANY_ID,
355 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
356 PCI_ENET0_MEMADDR,
357 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
358 } },
359 { }
360};
361#endif
362
363
364static struct pci_controller hose = {
365#ifndef CONFIG_PCI_PNP
366 config_table: pci_stxgp3_config_table,
367#endif
368};
369
370#endif
371
372
373void
374pci_init_board(void)
375{
376#ifdef CONFIG_PCI
377 pci_mpc85xx_init(&hose);
378#endif
379}
380