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_pci.h>
38#include <asm/fsl_ddr_sdram.h>
39#include <ioports.h>
40#include <asm/io.h>
41#include <spd_sdram.h>
42#include <miiphy.h>
43#include <netdev.h>
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
202void
203reset_phy(void)
204{
205 volatile uint *blatch;
206#if 0
207 int i;
208#endif
209 blatch = (volatile uint *)CONFIG_SYS_LBC_CFGLATCH_BASE;
210
211
212
213#if 1
214 *blatch &= ~0x000000c0;
215 udelay(100);
216#else
217 *blatch = 0;
218 asm("eieio");
219 for (i=0; i<1000; i++)
220 udelay(1000);
221#endif
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
251#ifdef CONFIG_OF_BOARD_SETUP
252void ft_board_setup(void *blob, bd_t *bd)
253{
254 ft_cpu_setup (blob, bd);
255}
256#endif
257
258int
259board_early_init_f(void)
260{
261#if defined(CONFIG_PCI)
262 volatile ccsr_pcix_t *pci = (void *)(CONFIG_SYS_MPC85xx_PCIX_ADDR);
263
264 pci->peer &= 0xffffffdf;
265#endif
266
267
268
269
270
271 reset_phy();
272
273 return 0;
274}
275
276int
277checkboard(void)
278{
279 printf ("Board: Silicon Tx GPPP SSA Board\n");
280 return (0);
281}
282
283
284
285void
286show_activity(int flag)
287{
288 volatile uint *blatch;
289
290 if (next_led_update > get_ticks())
291 return;
292
293 blatch = (volatile uint *)CONFIG_SYS_LBC_CFGLATCH_BASE;
294
295 led_bit >>= 1;
296 if (led_bit == 0)
297 led_bit = 0x08;
298 *blatch = (0xc0 | led_bit);
299 eieio();
300 next_led_update += (get_tbclk() / 4);
301}
302
303#if defined(CONFIG_SYS_DRAM_TEST)
304int testdram (void)
305{
306 uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
307 uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
308 uint *p;
309
310 printf("SDRAM test phase 1:\n");
311 for (p = pstart; p < pend; p++)
312 *p = 0xaaaaaaaa;
313
314 for (p = pstart; p < pend; p++) {
315 if (*p != 0xaaaaaaaa) {
316 printf ("SDRAM test fails at: %08x\n", (uint) p);
317 return 1;
318 }
319 }
320
321 printf("SDRAM test phase 2:\n");
322 for (p = pstart; p < pend; p++)
323 *p = 0x55555555;
324
325 for (p = pstart; p < pend; p++) {
326 if (*p != 0x55555555) {
327 printf ("SDRAM test fails at: %08x\n", (uint) p);
328 return 1;
329 }
330 }
331
332 printf("SDRAM test passed.\n");
333 return 0;
334}
335#endif
336
337#if defined(CONFIG_PCI)
338
339
340
341
342
343#ifndef CONFIG_PCI_PNP
344static struct pci_config_table pci_stxgp3_config_table[] = {
345 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
346 PCI_IDSEL_NUMBER, PCI_ANY_ID,
347 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
348 PCI_ENET0_MEMADDR,
349 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
350 } },
351 { }
352};
353#endif
354
355
356static struct pci_controller hose[] = {
357#ifndef CONFIG_PCI_PNP
358 { config_table: pci_stxgp3_config_table,},
359#else
360 {},
361#endif
362#ifdef CONFIG_MPC85XX_PCI2
363 {},
364#endif
365};
366
367#endif
368
369
370void
371pci_init_board(void)
372{
373#ifdef CONFIG_PCI
374 extern void pci_mpc85xx_init(struct pci_controller *hose);
375
376 pci_mpc85xx_init(hose);
377#endif
378}
379
380int board_eth_init(bd_t *bis)
381{
382 cpu_eth_init(bis);
383 return pci_eth_init(bis);
384}
385