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
43
44
45
46
47
48
49
50const iop_conf_t iop_conf_tab[4][32] = {
51
52
53 {
54 { 0, 1, 0, 1, 0, 0 },
55 { 0, 1, 0, 0, 0, 0 },
56 { 0, 1, 0, 1, 0, 0 },
57 { 0, 1, 0, 1, 0, 0 },
58 { 0, 1, 0, 0, 0, 0 },
59 { 0, 1, 0, 0, 0, 0 },
60 { 0, 1, 0, 1, 0, 0 },
61 { 0, 1, 0, 1, 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, 0, 0, 0 },
69 { 0, 1, 0, 0, 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, 1, 1, 0, 0 },
77 { 0, 1, 1, 0, 0, 0 },
78 { 0, 0, 0, 1, 0, 0 },
79 { 0, 1, 1, 1, 0, 0 },
80 { 0, 0, 0, 1, 0, 0 },
81 { 0, 0, 0, 1, 0, 0 },
82 { 0, 0, 0, 1, 0, 0 },
83 { 0, 0, 0, 1, 0, 0 },
84 { 1, 0, 0, 0, 0, 0 },
85 { 0, 0, 0, 1, 0, 0 }
86 },
87
88
89 {
90 { 1, 1, 0, 1, 0, 0 },
91 { 1, 1, 0, 0, 0, 0 },
92 { 1, 1, 1, 1, 0, 0 },
93 { 1, 1, 0, 0, 0, 0 },
94 { 1, 1, 0, 0, 0, 0 },
95 { 1, 1, 0, 0, 0, 0 },
96 { 1, 1, 0, 1, 0, 0 },
97 { 1, 1, 0, 1, 0, 0 },
98 { 1, 1, 0, 1, 0, 0 },
99 { 1, 1, 0, 1, 0, 0 },
100 { 1, 1, 0, 0, 0, 0 },
101 { 1, 1, 0, 0, 0, 0 },
102 { 1, 1, 0, 0, 0, 0 },
103 { 1, 1, 0, 0, 0, 0 },
104 { 0, 1, 0, 0, 0, 0 },
105 { 0, 1, 0, 0, 0, 0 },
106 { 0, 1, 0, 1, 0, 0 },
107 { 0, 1, 0, 1, 0, 0 },
108 { 0, 1, 0, 0, 0, 0 },
109 { 0, 1, 0, 0, 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, 1, 0, 0 },
115 { 0, 1, 0, 1, 0, 0 },
116 { 0, 1, 0, 1, 0, 0 },
117 { 0, 1, 0, 1, 0, 0 },
118 { 0, 0, 0, 0, 0, 0 },
119 { 0, 0, 0, 0, 0, 0 },
120 { 0, 0, 0, 0, 0, 0 },
121 { 0, 0, 0, 0, 0, 0 }
122 },
123
124
125 {
126 { 0, 0, 0, 1, 0, 0 },
127 { 0, 0, 0, 1, 0, 0 },
128 { 0, 1, 1, 0, 0, 0 },
129 { 0, 0, 0, 1, 0, 0 },
130 { 0, 0, 0, 1, 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, 1, 0, 1, 0, 0 },
135 { 0, 1, 0, 0, 0, 0 },
136 { 0, 1, 0, 0, 0, 0 },
137 { 0, 1, 0, 0, 0, 0 },
138 { 1, 1, 0, 0, 0, 0 },
139 { 1, 1, 0, 0, 0, 0 },
140 { 0, 0, 0, 1, 0, 0 },
141 { 0, 1, 0, 0, 0, 0 },
142 { 0, 1, 0, 0, 0, 0 },
143 { 0, 1, 0, 0, 0, 0 },
144 { 0, 0, 0, 1, 0, 0 },
145 { 0, 1, 0, 1, 0, 0 },
146 { 0, 0, 0, 1, 0, 0 },
147 { 0, 0, 0, 1, 0, 0 },
148 { 0, 0, 0, 0, 0, 0 },
149 { 0, 0, 0, 1, 0, 0 },
150 { 0, 0, 0, 1, 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, 1 },
156 { 0, 0, 0, 1, 0, 0 },
157 { 0, 0, 0, 1, 0, 0 },
158 },
159
160
161 {
162 { 0, 1, 0, 0, 0, 0 },
163 { 0, 1, 1, 1, 0, 0 },
164 { 0, 1, 0, 1, 0, 0 },
165 { 1, 1, 0, 0, 0, 0 },
166 { 1, 1, 0, 1, 0, 0 },
167 { 0, 0, 0, 1, 0, 0 },
168 { 0, 0, 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, 1, 0, 0, 0, 0 },
177 { 0, 1, 0, 1, 0, 0 },
178 { 1, 1, 1, 0, 1, 0 },
179 { 1, 1, 1, 0, 0, 0 },
180 { 0, 0, 0, 0, 0, 0 },
181 { 0, 0, 0, 0, 0, 0 },
182 { 0, 0, 0, 0, 0, 0 },
183 { 0, 0, 0, 0, 0, 0 },
184 { 0, 1, 0, 1, 0, 0 },
185 { 0, 1, 0, 0, 0, 0 },
186 { 0, 0, 0, 1, 0, 1 },
187 { 0, 0, 0, 1, 0, 1 },
188 { 0, 0, 0, 1, 0, 1 },
189 { 0, 0, 0, 1, 0, 1 },
190 { 0, 0, 0, 0, 0, 0 },
191 { 0, 0, 0, 0, 0, 0 },
192 { 0, 0, 0, 0, 0, 0 },
193 { 0, 0, 0, 0, 0, 0 }
194 }
195};
196
197static uint64_t next_led_update;
198static uint led_bit;
199
200int
201board_early_init_f(void)
202{
203#if defined(CONFIG_PCI)
204 volatile ccsr_pcix_t *pci = (void *)(CONFIG_SYS_MPC85xx_PCIX_ADDR);
205
206 pci->peer &= 0xfffffffdf;
207#endif
208 return 0;
209}
210
211void
212reset_phy(void)
213{
214 volatile uint *blatch;
215
216 blatch = (volatile uint *)CONFIG_SYS_LBC_LCLDEVS_BASE;
217
218
219
220 *blatch &= ~0x000000c0;
221 udelay(100);
222 *blatch = 0x000000c1;
223 udelay(1000);
224
225#if 0
226
227#if (CONFIG_ETHER_INDEX == 2)
228 bcsr->bcsr2 &= ~FETH2_RST;
229 udelay(2);
230 bcsr->bcsr2 |= FETH2_RST;
231 udelay(1000);
232#elif (CONFIG_ETHER_INDEX == 3)
233 bcsr->bcsr3 &= ~FETH3_RST;
234 udelay(2);
235 bcsr->bcsr3 |= FETH3_RST;
236 udelay(1000);
237#endif
238#if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
239
240 miiphy_reset("FCC1", 0x0);
241
242
243 bb_miiphy_write(NULL, 0, MII_MIPSCR, 0xf028);
244
245 bb_miiphy_write(NULL, 0x02, MII_BMCR,
246 BMCR_ANENABLE | BMCR_ANRESTART);
247#endif
248#endif
249}
250
251int
252checkboard(void)
253{
254 printf ("Board: Silicon Tx GPPP 8560 Board\n");
255 return (0);
256}
257
258
259
260void
261show_activity(int flag)
262{
263 volatile uint *blatch;
264
265 if (next_led_update > get_ticks())
266 return;
267
268 blatch = (volatile uint *)CONFIG_SYS_LBC_LCLDEVS_BASE;
269
270 led_bit >>= 1;
271 if (led_bit == 0)
272 led_bit = 0x08;
273 *blatch = (0xc0 | led_bit);
274 eieio();
275 next_led_update += (get_tbclk() / 4);
276}
277
278
279#if defined(CONFIG_SYS_DRAM_TEST)
280int testdram (void)
281{
282 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
283 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
284 uint *p;
285
286 printf("SDRAM test phase 1:\n");
287 for (p = pstart; p < pend; p++)
288 *p = 0xaaaaaaaa;
289
290 for (p = pstart; p < pend; p++) {
291 if (*p != 0xaaaaaaaa) {
292 printf ("SDRAM test fails at: %08x\n", (uint) p);
293 return 1;
294 }
295 }
296
297 printf("SDRAM test phase 2:\n");
298 for (p = pstart; p < pend; p++)
299 *p = 0x55555555;
300
301 for (p = pstart; p < pend; p++) {
302 if (*p != 0x55555555) {
303 printf ("SDRAM test fails at: %08x\n", (uint) p);
304 return 1;
305 }
306 }
307
308 printf("SDRAM test passed.\n");
309 return 0;
310}
311#endif
312
313#if defined(CONFIG_PCI)
314
315
316
317
318
319#ifndef CONFIG_PCI_PNP
320static struct pci_config_table pci_stxgp3_config_table[] = {
321 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
322 PCI_IDSEL_NUMBER, PCI_ANY_ID,
323 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
324 PCI_ENET0_MEMADDR,
325 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
326 } },
327 { }
328};
329#endif
330
331
332static struct pci_controller hose = {
333#ifndef CONFIG_PCI_PNP
334 config_table: pci_stxgp3_config_table,
335#endif
336};
337
338#endif
339
340
341void
342pci_init_board(void)
343{
344#ifdef CONFIG_PCI
345 pci_mpc85xx_init(&hose);
346#endif
347}
348