blob: 286bdc1f21dd23bd8a9e5fa8615495d424cbb996 [file] [log] [blame]
Stefan Roese4745aca2007-02-20 10:57:08 +01001/*
2 * (C) Copyright 2007
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 */
24
25#include <common.h>
26#include <ppc4xx.h>
27#include <asm/processor.h>
28#include <i2c.h>
29#include <asm-ppc/io.h>
Stefan Roese0d974d52007-03-24 15:57:09 +010030#include <asm-ppc/gpio.h>
Stefan Roese4745aca2007-02-20 10:57:08 +010031
Stefan Roese4745aca2007-02-20 10:57:08 +010032#include "../cpu/ppc4xx/440spe_pcie.h"
33
34#undef PCIE_ENDPOINT
35/* #define PCIE_ENDPOINT 1 */
36
37int ppc440spe_init_pcie_rootport(int port);
38void ppc440spe_setup_pcie(struct pci_controller *hose, int port);
39
40int board_early_init_f (void)
41{
42 unsigned long mfr;
Stefan Roese4745aca2007-02-20 10:57:08 +010043
44 /*----------------------------------------------------------------------+
45 * Interrupt controller setup for the Katmai 440SPe Evaluation board.
46 *-----------------------------------------------------------------------+
47 *-----------------------------------------------------------------------+
48 * Interrupt | Source | Pol. | Sensi.| Crit. |
49 *-----------+-----------------------------------+-------+-------+-------+
50 * IRQ 00 | UART0 | High | Level | Non |
51 * IRQ 01 | UART1 | High | Level | Non |
52 * IRQ 02 | IIC0 | High | Level | Non |
53 * IRQ 03 | IIC1 | High | Level | Non |
54 * IRQ 04 | PCI0X0 MSG IN | High | Level | Non |
55 * IRQ 05 | PCI0X0 CMD Write | High | Level | Non |
56 * IRQ 06 | PCI0X0 Power Mgt | High | Level | Non |
57 * IRQ 07 | PCI0X0 VPD Access | Rising| Edge | Non |
58 * IRQ 08 | PCI0X0 MSI level 0 | High | Lvl/ed| Non |
59 * IRQ 09 | External IRQ 15 - (PCI-Express) | pgm H | Pgm | Non |
60 * IRQ 10 | UIC2 Non-critical Int. | NA | NA | Non |
61 * IRQ 11 | UIC2 Critical Interrupt | NA | NA | Crit |
62 * IRQ 12 | PCI Express MSI Level 0 | Rising| Edge | Non |
63 * IRQ 13 | PCI Express MSI Level 1 | Rising| Edge | Non |
64 * IRQ 14 | PCI Express MSI Level 2 | Rising| Edge | Non |
65 * IRQ 15 | PCI Express MSI Level 3 | Rising| Edge | Non |
66 * IRQ 16 | UIC3 Non-critical Int. | NA | NA | Non |
67 * IRQ 17 | UIC3 Critical Interrupt | NA | NA | Crit |
68 * IRQ 18 | External IRQ 14 - (PCI-Express) | Pgm | Pgm | Non |
69 * IRQ 19 | DMA Channel 0 FIFO Full | High | Level | Non |
70 * IRQ 20 | DMA Channel 0 Stat FIFO | High | Level | Non |
71 * IRQ 21 | DMA Channel 1 FIFO Full | High | Level | Non |
72 * IRQ 22 | DMA Channel 1 Stat FIFO | High | Level | Non |
73 * IRQ 23 | I2O Inbound Doorbell | High | Level | Non |
74 * IRQ 24 | Inbound Post List FIFO Not Empt | High | Level | Non |
75 * IRQ 25 | I2O Region 0 LL PLB Write | High | Level | Non |
76 * IRQ 26 | I2O Region 1 LL PLB Write | High | Level | Non |
77 * IRQ 27 | I2O Region 0 HB PLB Write | High | Level | Non |
78 * IRQ 28 | I2O Region 1 HB PLB Write | High | Level | Non |
79 * IRQ 29 | GPT Down Count Timer | Rising| Edge | Non |
80 * IRQ 30 | UIC1 Non-critical Int. | NA | NA | Non |
81 * IRQ 31 | UIC1 Critical Interrupt | NA | NA | Crit. |
82 *------------------------------------------------------------------------
83 * IRQ 32 | Ext. IRQ 13 - (PCI-Express) |pgm (H)|pgm/Lvl| Non |
84 * IRQ 33 | MAL Serr | High | Level | Non |
85 * IRQ 34 | MAL Txde | High | Level | Non |
86 * IRQ 35 | MAL Rxde | High | Level | Non |
87 * IRQ 36 | DMC CE or DMC UE | High | Level | Non |
88 * IRQ 37 | EBC or UART2 | High |Lvl Edg| Non |
89 * IRQ 38 | MAL TX EOB | High | Level | Non |
90 * IRQ 39 | MAL RX EOB | High | Level | Non |
91 * IRQ 40 | PCIX0 MSI Level 1 | High |Lvl Edg| Non |
92 * IRQ 41 | PCIX0 MSI level 2 | High |Lvl Edg| Non |
93 * IRQ 42 | PCIX0 MSI level 3 | High |Lvl Edg| Non |
94 * IRQ 43 | L2 Cache | Risin | Edge | Non |
95 * IRQ 44 | GPT Compare Timer 0 | Risin | Edge | Non |
96 * IRQ 45 | GPT Compare Timer 1 | Risin | Edge | Non |
97 * IRQ 46 | GPT Compare Timer 2 | Risin | Edge | Non |
98 * IRQ 47 | GPT Compare Timer 3 | Risin | Edge | Non |
99 * IRQ 48 | GPT Compare Timer 4 | Risin | Edge | Non |
100 * IRQ 49 | Ext. IRQ 12 - PCI-X |pgm/Fal|pgm/Lvl| Non |
101 * IRQ 50 | Ext. IRQ 11 - |pgm (H)|pgm/Lvl| Non |
102 * IRQ 51 | Ext. IRQ 10 - |pgm (H)|pgm/Lvl| Non |
103 * IRQ 52 | Ext. IRQ 9 |pgm (H)|pgm/Lvl| Non |
104 * IRQ 53 | Ext. IRQ 8 |pgm (H)|pgm/Lvl| Non |
105 * IRQ 54 | DMA Error | High | Level | Non |
106 * IRQ 55 | DMA I2O Error | High | Level | Non |
107 * IRQ 56 | Serial ROM | High | Level | Non |
108 * IRQ 57 | PCIX0 Error | High | Edge | Non |
109 * IRQ 58 | Ext. IRQ 7- |pgm (H)|pgm/Lvl| Non |
110 * IRQ 59 | Ext. IRQ 6- |pgm (H)|pgm/Lvl| Non |
111 * IRQ 60 | EMAC0 Interrupt | High | Level | Non |
112 * IRQ 61 | EMAC0 Wake-up | High | Level | Non |
113 * IRQ 62 | Reserved | High | Level | Non |
114 * IRQ 63 | XOR | High | Level | Non |
115 *-----------------------------------------------------------------------
116 * IRQ 64 | PE0 AL | High | Level | Non |
117 * IRQ 65 | PE0 VPD Access | Risin | Edge | Non |
118 * IRQ 66 | PE0 Hot Reset Request | Risin | Edge | Non |
119 * IRQ 67 | PE0 Hot Reset Request | Falli | Edge | Non |
120 * IRQ 68 | PE0 TCR | High | Level | Non |
121 * IRQ 69 | PE0 BusMaster VCO | Falli | Edge | Non |
122 * IRQ 70 | PE0 DCR Error | High | Level | Non |
123 * IRQ 71 | Reserved | N/A | N/A | Non |
124 * IRQ 72 | PE1 AL | High | Level | Non |
125 * IRQ 73 | PE1 VPD Access | Risin | Edge | Non |
126 * IRQ 74 | PE1 Hot Reset Request | Risin | Edge | Non |
127 * IRQ 75 | PE1 Hot Reset Request | Falli | Edge | Non |
128 * IRQ 76 | PE1 TCR | High | Level | Non |
129 * IRQ 77 | PE1 BusMaster VCO | Falli | Edge | Non |
130 * IRQ 78 | PE1 DCR Error | High | Level | Non |
131 * IRQ 79 | Reserved | N/A | N/A | Non |
132 * IRQ 80 | PE2 AL | High | Level | Non |
133 * IRQ 81 | PE2 VPD Access | Risin | Edge | Non |
134 * IRQ 82 | PE2 Hot Reset Request | Risin | Edge | Non |
135 * IRQ 83 | PE2 Hot Reset Request | Falli | Edge | Non |
136 * IRQ 84 | PE2 TCR | High | Level | Non |
137 * IRQ 85 | PE2 BusMaster VCO | Falli | Edge | Non |
138 * IRQ 86 | PE2 DCR Error | High | Level | Non |
139 * IRQ 87 | Reserved | N/A | N/A | Non |
140 * IRQ 88 | External IRQ(5) | Progr | Progr | Non |
141 * IRQ 89 | External IRQ 4 - Ethernet | Progr | Progr | Non |
142 * IRQ 90 | External IRQ 3 - PCI-X | Progr | Progr | Non |
143 * IRQ 91 | External IRQ 2 - PCI-X | Progr | Progr | Non |
144 * IRQ 92 | External IRQ 1 - PCI-X | Progr | Progr | Non |
145 * IRQ 93 | External IRQ 0 - PCI-X | Progr | Progr | Non |
146 * IRQ 94 | Reserved | N/A | N/A | Non |
147 * IRQ 95 | Reserved | N/A | N/A | Non |
148 *-----------------------------------------------------------------------
149 * IRQ 96 | PE0 INTA | High | Level | Non |
150 * IRQ 97 | PE0 INTB | High | Level | Non |
151 * IRQ 98 | PE0 INTC | High | Level | Non |
152 * IRQ 99 | PE0 INTD | High | Level | Non |
153 * IRQ 100 | PE1 INTA | High | Level | Non |
154 * IRQ 101 | PE1 INTB | High | Level | Non |
155 * IRQ 102 | PE1 INTC | High | Level | Non |
156 * IRQ 103 | PE1 INTD | High | Level | Non |
157 * IRQ 104 | PE2 INTA | High | Level | Non |
158 * IRQ 105 | PE2 INTB | High | Level | Non |
159 * IRQ 106 | PE2 INTC | High | Level | Non |
160 * IRQ 107 | PE2 INTD | Risin | Edge | Non |
161 * IRQ 108 | PCI Express MSI Level 4 | Risin | Edge | Non |
162 * IRQ 109 | PCI Express MSI Level 5 | Risin | Edge | Non |
163 * IRQ 110 | PCI Express MSI Level 6 | Risin | Edge | Non |
164 * IRQ 111 | PCI Express MSI Level 7 | Risin | Edge | Non |
165 * IRQ 116 | PCI Express MSI Level 12 | Risin | Edge | Non |
166 * IRQ 112 | PCI Express MSI Level 8 | Risin | Edge | Non |
167 * IRQ 113 | PCI Express MSI Level 9 | Risin | Edge | Non |
168 * IRQ 114 | PCI Express MSI Level 10 | Risin | Edge | Non |
169 * IRQ 115 | PCI Express MSI Level 11 | Risin | Edge | Non |
170 * IRQ 117 | PCI Express MSI Level 13 | Risin | Edge | Non |
171 * IRQ 118 | PCI Express MSI Level 14 | Risin | Edge | Non |
172 * IRQ 119 | PCI Express MSI Level 15 | Risin | Edge | Non |
173 * IRQ 120 | PCI Express MSI Level 16 | Risin | Edge | Non |
174 * IRQ 121 | PCI Express MSI Level 17 | Risin | Edge | Non |
175 * IRQ 122 | PCI Express MSI Level 18 | Risin | Edge | Non |
176 * IRQ 123 | PCI Express MSI Level 19 | Risin | Edge | Non |
177 * IRQ 124 | PCI Express MSI Level 20 | Risin | Edge | Non |
178 * IRQ 125 | PCI Express MSI Level 21 | Risin | Edge | Non |
179 * IRQ 126 | PCI Express MSI Level 22 | Risin | Edge | Non |
180 * IRQ 127 | PCI Express MSI Level 23 | Risin | Edge | Non |
181 *-----------+-----------------------------------+-------+-------+-------+ */
182 /*-------------------------------------------------------------------------+
183 * Put UICs in PowerPC440SPemode.
184 * Initialise UIC registers. Clear all interrupts. Disable all interrupts.
185 * Set critical interrupt values. Set interrupt polarities. Set interrupt
186 * trigger levels. Make bit 0 High priority. Clear all interrupts again.
187 *------------------------------------------------------------------------*/
188 mtdcr (uic3sr, 0xffffffff); /* Clear all interrupts */
189 mtdcr (uic3er, 0x00000000); /* disable all interrupts */
190 mtdcr (uic3cr, 0x00000000); /* Set Critical / Non Critical interrupts: */
191 mtdcr (uic3pr, 0xffffffff); /* Set Interrupt Polarities*/
192 mtdcr (uic3tr, 0x001fffff); /* Set Interrupt Trigger Levels */
193 mtdcr (uic3vr, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
194 mtdcr (uic3sr, 0x00000000); /* clear all interrupts*/
195 mtdcr (uic3sr, 0xffffffff); /* clear all interrupts*/
196
197
198 mtdcr (uic2sr, 0xffffffff); /* Clear all interrupts */
199 mtdcr (uic2er, 0x00000000); /* disable all interrupts*/
200 mtdcr (uic2cr, 0x00000000); /* Set Critical / Non Critical interrupts*/
201 mtdcr (uic2pr, 0xebebebff); /* Set Interrupt Polarities*/
202 mtdcr (uic2tr, 0x74747400); /* Set Interrupt Trigger Levels */
203 mtdcr (uic2vr, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
204 mtdcr (uic2sr, 0x00000000); /* clear all interrupts */
205 mtdcr (uic2sr, 0xffffffff); /* clear all interrupts */
206
207 mtdcr (uic1sr, 0xffffffff); /* Clear all interrupts*/
208 mtdcr (uic1er, 0x00000000); /* disable all interrupts*/
209 mtdcr (uic1cr, 0x00000000); /* Set Critical / Non Critical interrupts*/
210 mtdcr (uic1pr, 0xffffffff); /* Set Interrupt Polarities */
211 mtdcr (uic1tr, 0x001f8040); /* Set Interrupt Trigger Levels*/
212 mtdcr (uic1vr, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
213 mtdcr (uic1sr, 0x00000000); /* clear all interrupts*/
214 mtdcr (uic1sr, 0xffffffff); /* clear all interrupts*/
215
216 mtdcr (uic0sr, 0xffffffff); /* Clear all interrupts */
217 mtdcr (uic0er, 0x00000000); /* disable all interrupts excepted cascade to be checked */
218 mtdcr (uic0cr, 0x00104001); /* Set Critical / Non Critical interrupts*/
219 mtdcr (uic0pr, 0xffffffff); /* Set Interrupt Polarities*/
220 mtdcr (uic0tr, 0x010f0004); /* Set Interrupt Trigger Levels */
221 mtdcr (uic0vr, 0x00000001); /* Set Vect base=0,INT31 Highest priority */
222 mtdcr (uic0sr, 0x00000000); /* clear all interrupts*/
223 mtdcr (uic0sr, 0xffffffff); /* clear all interrupts*/
224
225/* SDR0_MFR should be part of Ethernet init */
226 mfsdr (sdr_mfr, mfr);
227 mfr &= ~SDR0_MFR_ECS_MASK;
228/* mtsdr(sdr_mfr, mfr); */
229
Stefan Roeseba58e4c2007-03-01 21:11:36 +0100230 mtsdr(SDR0_PFC0, CFG_PFC0);
Stefan Roese4745aca2007-02-20 10:57:08 +0100231
Stefan Roeseba58e4c2007-03-01 21:11:36 +0100232 out32(GPIO0_OR, CFG_GPIO_OR);
233 out32(GPIO0_ODR, CFG_GPIO_ODR);
234 out32(GPIO0_TCR, CFG_GPIO_TCR);
Stefan Roese4745aca2007-02-20 10:57:08 +0100235
236 return 0;
237}
238
239int checkboard (void)
240{
241 char *s = getenv("serial#");
242
243 printf("Board: Katmai - AMCC 440SPe Evaluation Board");
244 if (s != NULL) {
245 puts(", serial# ");
246 puts(s);
247 }
248 putc('\n');
249
250 return 0;
251}
252
253#if defined(CFG_DRAM_TEST)
254int testdram (void)
255{
256 uint *pstart = (uint *) 0x00000000;
257 uint *pend = (uint *) 0x08000000;
258 uint *p;
259
260 for (p = pstart; p < pend; p++)
261 *p = 0xaaaaaaaa;
262
263 for (p = pstart; p < pend; p++) {
264 if (*p != 0xaaaaaaaa) {
265 printf ("SDRAM test fails at: %08x\n", (uint) p);
266 return 1;
267 }
268 }
269
270 for (p = pstart; p < pend; p++)
271 *p = 0x55555555;
272
273 for (p = pstart; p < pend; p++) {
274 if (*p != 0x55555555) {
275 printf ("SDRAM test fails at: %08x\n", (uint) p);
276 return 1;
277 }
278 }
279 return 0;
280}
281#endif
282
283/*************************************************************************
284 * pci_pre_init
285 *
286 * This routine is called just prior to registering the hose and gives
287 * the board the opportunity to check things. Returning a value of zero
288 * indicates that things are bad & PCI initialization should be aborted.
289 *
290 * Different boards may wish to customize the pci controller structure
291 * (add regions, override default access routines, etc) or perform
292 * certain pre-initialization actions.
293 *
294 ************************************************************************/
295#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
296int pci_pre_init(struct pci_controller * hose )
297{
298 unsigned long strap;
299
300 /*-------------------------------------------------------------------+
301 * The katmai board is always configured as the host & requires the
302 * PCI arbiter to be enabled.
303 *-------------------------------------------------------------------*/
304 mfsdr(sdr_sdstp1, strap);
305 if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ) {
306 printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
307 return 0;
308 }
309
310 return 1;
311}
312#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
313
314/*************************************************************************
315 * pci_target_init
316 *
317 * The bootstrap configuration provides default settings for the pci
318 * inbound map (PIM). But the bootstrap config choices are limited and
319 * may not be sufficient for a given board.
320 *
321 ************************************************************************/
322#if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
323void pci_target_init(struct pci_controller * hose )
324{
325 DECLARE_GLOBAL_DATA_PTR;
326
327 /*-------------------------------------------------------------------+
328 * Disable everything
329 *-------------------------------------------------------------------*/
330 out32r( PCIX0_PIM0SA, 0 ); /* disable */
331 out32r( PCIX0_PIM1SA, 0 ); /* disable */
332 out32r( PCIX0_PIM2SA, 0 ); /* disable */
333 out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
334
335 /*-------------------------------------------------------------------+
336 * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440
337 * strapping options to not support sizes such as 128/256 MB.
338 *-------------------------------------------------------------------*/
339 out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
340 out32r( PCIX0_PIM0LAH, 0 );
341 out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
342 out32r( PCIX0_BAR0, 0 );
343
344 /*-------------------------------------------------------------------+
345 * Program the board's subsystem id/vendor id
346 *-------------------------------------------------------------------*/
347 out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
348 out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
349
350 out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
351}
352#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
353
354#if defined(CONFIG_PCI)
355/*************************************************************************
356 * is_pci_host
357 *
358 * This routine is called to determine if a pci scan should be
359 * performed. With various hardware environments (especially cPCI and
360 * PPMC) it's insufficient to depend on the state of the arbiter enable
361 * bit in the strap register, or generic host/adapter assumptions.
362 *
363 * Rather than hard-code a bad assumption in the general 440 code, the
364 * 440 pci code requires the board to decide at runtime.
365 *
366 * Return 0 for adapter mode, non-zero for host (monarch) mode.
367 *
368 *
369 ************************************************************************/
370int is_pci_host(struct pci_controller *hose)
371{
372 /* The katmai board is always configured as host. */
373 return 1;
374}
375
Stefan Roeseba58e4c2007-03-01 21:11:36 +0100376int katmai_pcie_card_present(int port)
377{
378 u32 val;
379
380 val = in32(GPIO0_IR);
381 switch (port) {
382 case 0:
383 return !(val & GPIO_VAL(CFG_GPIO_PCIE_PRESENT0));
384 case 1:
385 return !(val & GPIO_VAL(CFG_GPIO_PCIE_PRESENT1));
386 case 2:
387 return !(val & GPIO_VAL(CFG_GPIO_PCIE_PRESENT2));
388 default:
389 return 0;
390 }
391}
392
Stefan Roese4745aca2007-02-20 10:57:08 +0100393static struct pci_controller pcie_hose[3] = {{0},{0},{0}};
394
395void pcie_setup_hoses(void)
396{
397 struct pci_controller *hose;
398 int i, bus;
399
400 /*
401 * assume we're called after the PCIX hose is initialized, which takes
402 * bus ID 0 and therefore start numbering PCIe's from 1.
403 */
404 bus = 1;
405 for (i = 0; i <= 2; i++) {
Stefan Roeseba58e4c2007-03-01 21:11:36 +0100406 /* Check for katmai card presence */
407 if (!katmai_pcie_card_present(i))
408 continue;
409
Stefan Roese4745aca2007-02-20 10:57:08 +0100410#ifdef PCIE_ENDPOINT
411 if (ppc440spe_init_pcie_endport(i)) {
412#else
413 if (ppc440spe_init_pcie_rootport(i)) {
414#endif
415 printf("PCIE%d: initialization failed\n", i);
416 continue;
417 }
418
419 hose = &pcie_hose[i];
420 hose->first_busno = bus;
421 hose->last_busno = bus;
422 bus++;
423
424 /* setup mem resource */
425 pci_set_region(hose->regions + 0,
426 CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE,
427 CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE,
428 CFG_PCIE_MEMSIZE,
429 PCI_REGION_MEM
430 );
431 hose->region_count = 1;
432 pci_register_hose(hose);
433
434#ifdef PCIE_ENDPOINT
435 ppc440spe_setup_pcie_endpoint(hose, i);
436 /*
437 * Reson for no scanning is endpoint can not generate
438 * upstream configuration accesses.
439 */
440#else
441 ppc440spe_setup_pcie_rootpoint(hose, i);
442 /*
443 * Config access can only go down stream
444 */
445 hose->last_busno = pci_hose_scan(hose);
446#endif
447 }
448}
449#endif /* defined(CONFIG_PCI) */
450
451int misc_init_f (void)
452{
453 uint reg;
454#if defined(CONFIG_STRESS)
455 uint i ;
456 uint disp;
457#endif
458
459 /* minimal init for PCIe */
460#if 0 /* test-only: test endpoint at some time, for now rootpoint only */
461 /* pci express 0 Endpoint Mode */
462 mfsdr(SDR0_PE0DLPSET, reg);
463 reg &= (~0x00400000);
464 mtsdr(SDR0_PE0DLPSET, reg);
465#else
466 /* pci express 0 Rootpoint Mode */
467 mfsdr(SDR0_PE0DLPSET, reg);
468 reg |= 0x00400000;
469 mtsdr(SDR0_PE0DLPSET, reg);
470#endif
471 /* pci express 1 Rootpoint Mode */
472 mfsdr(SDR0_PE1DLPSET, reg);
473 reg |= 0x00400000;
474 mtsdr(SDR0_PE1DLPSET, reg);
475 /* pci express 2 Rootpoint Mode */
476 mfsdr(SDR0_PE2DLPSET, reg);
477 reg |= 0x00400000;
478 mtsdr(SDR0_PE2DLPSET, reg);
479
480#if defined(CONFIG_STRESS)
481 /*
482 * All this setting done by linux only needed by stress an charac. test
483 * procedure
484 * PCIe 1 Rootpoint PCIe2 Endpoint
485 * PCIe 0 FIR Pre-emphasis Filter Coefficients & Transmit Driver Power Level
486 */
487 for (i=0,disp=0; i<8; i++,disp+=3) {
488 mfsdr(SDR0_PE0HSSSET1L0+disp, reg);
489 reg |= 0x33000000;
490 mtsdr(SDR0_PE0HSSSET1L0+disp, reg);
491 }
492
493 /*PCIe 1 FIR Pre-emphasis Filter Coefficients & Transmit Driver Power Level */
494 for (i=0,disp=0; i<4; i++,disp+=3) {
495 mfsdr(SDR0_PE1HSSSET1L0+disp, reg);
496 reg |= 0x33000000;
497 mtsdr(SDR0_PE1HSSSET1L0+disp, reg);
498 }
499
500 /*PCIE 2 FIR Pre-emphasis Filter Coefficients & Transmit Driver Power Level */
501 for (i=0,disp=0; i<4; i++,disp+=3) {
502 mfsdr(SDR0_PE2HSSSET1L0+disp, reg);
503 reg |= 0x33000000;
504 mtsdr(SDR0_PE2HSSSET1L0+disp, reg);
505 }
506
507 reg = 0x21242222;
508 mtsdr(SDR0_PE2UTLSET1, reg);
509 reg = 0x11000000;
510 mtsdr(SDR0_PE2UTLSET2, reg);
511 /* pci express 1 Endpoint Mode */
512 reg = 0x00004000;
513 mtsdr(SDR0_PE2DLPSET, reg);
514
515 mtsdr(SDR0_UART1, 0x2080005a); /* patch for TG */
516#endif
517
518 return 0;
519}
520
521#ifdef CONFIG_POST
522/*
523 * Returns 1 if keys pressed to start the power-on long-running tests
524 * Called from board_init_f().
525 */
526int post_hotkeys_pressed(void)
527{
528 return (ctrlc());
529}
530#endif