blob: 8f991e537df10d8ff48d7783e00bb4aeaa231c79 [file] [log] [blame]
Andy Fleming67431052007-04-23 02:54:25 -05001/*
2 * Copyright 2007 Freescale Semiconductor.
3 *
4 * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 */
24
25#include <common.h>
26#include <pci.h>
27#include <asm/processor.h>
Jon Loeligere6f5b352008-03-18 13:51:05 -050028#include <asm/mmu.h>
Andy Fleming67431052007-04-23 02:54:25 -050029#include <asm/immap_85xx.h>
Kumar Galac8514622009-04-02 13:22:48 -050030#include <asm/fsl_pci.h>
Jon Loeligere6f5b352008-03-18 13:51:05 -050031#include <asm/fsl_ddr_sdram.h>
Jon Loeligera30a5492008-03-04 10:03:03 -060032#include <spd_sdram.h>
Haiying Wangc59e4092007-06-19 14:18:34 -040033#include <i2c.h>
Andy Flemingda9d4612007-08-14 00:14:25 -050034#include <ioports.h>
Kumar Galac4808612007-11-29 01:06:19 -060035#include <libfdt.h>
36#include <fdt_support.h>
Haiying Wang1563f562007-11-14 15:52:06 -050037
Andy Fleming67431052007-04-23 02:54:25 -050038#include "bcsr.h"
39
Andy Flemingda9d4612007-08-14 00:14:25 -050040const qe_iop_conf_t qe_iop_conf_tab[] = {
41 /* GETH1 */
42 {4, 10, 1, 0, 2}, /* TxD0 */
43 {4, 9, 1, 0, 2}, /* TxD1 */
44 {4, 8, 1, 0, 2}, /* TxD2 */
45 {4, 7, 1, 0, 2}, /* TxD3 */
46 {4, 23, 1, 0, 2}, /* TxD4 */
47 {4, 22, 1, 0, 2}, /* TxD5 */
48 {4, 21, 1, 0, 2}, /* TxD6 */
49 {4, 20, 1, 0, 2}, /* TxD7 */
50 {4, 15, 2, 0, 2}, /* RxD0 */
51 {4, 14, 2, 0, 2}, /* RxD1 */
52 {4, 13, 2, 0, 2}, /* RxD2 */
53 {4, 12, 2, 0, 2}, /* RxD3 */
54 {4, 29, 2, 0, 2}, /* RxD4 */
55 {4, 28, 2, 0, 2}, /* RxD5 */
56 {4, 27, 2, 0, 2}, /* RxD6 */
57 {4, 26, 2, 0, 2}, /* RxD7 */
58 {4, 11, 1, 0, 2}, /* TX_EN */
59 {4, 24, 1, 0, 2}, /* TX_ER */
60 {4, 16, 2, 0, 2}, /* RX_DV */
61 {4, 30, 2, 0, 2}, /* RX_ER */
62 {4, 17, 2, 0, 2}, /* RX_CLK */
63 {4, 19, 1, 0, 2}, /* GTX_CLK */
64 {1, 31, 2, 0, 3}, /* GTX125 */
65
66 /* GETH2 */
67 {5, 10, 1, 0, 2}, /* TxD0 */
68 {5, 9, 1, 0, 2}, /* TxD1 */
69 {5, 8, 1, 0, 2}, /* TxD2 */
70 {5, 7, 1, 0, 2}, /* TxD3 */
71 {5, 23, 1, 0, 2}, /* TxD4 */
72 {5, 22, 1, 0, 2}, /* TxD5 */
73 {5, 21, 1, 0, 2}, /* TxD6 */
74 {5, 20, 1, 0, 2}, /* TxD7 */
75 {5, 15, 2, 0, 2}, /* RxD0 */
76 {5, 14, 2, 0, 2}, /* RxD1 */
77 {5, 13, 2, 0, 2}, /* RxD2 */
78 {5, 12, 2, 0, 2}, /* RxD3 */
79 {5, 29, 2, 0, 2}, /* RxD4 */
80 {5, 28, 2, 0, 2}, /* RxD5 */
81 {5, 27, 2, 0, 3}, /* RxD6 */
82 {5, 26, 2, 0, 2}, /* RxD7 */
83 {5, 11, 1, 0, 2}, /* TX_EN */
84 {5, 24, 1, 0, 2}, /* TX_ER */
85 {5, 16, 2, 0, 2}, /* RX_DV */
86 {5, 30, 2, 0, 2}, /* RX_ER */
87 {5, 17, 2, 0, 2}, /* RX_CLK */
88 {5, 19, 1, 0, 2}, /* GTX_CLK */
89 {1, 31, 2, 0, 3}, /* GTX125 */
90 {4, 6, 3, 0, 2}, /* MDIO */
91 {4, 5, 1, 0, 2}, /* MDC */
Anton Vorontsov64d4bcb2007-10-22 19:58:19 +040092
93 /* UART1 */
94 {2, 0, 1, 0, 2}, /* UART_SOUT1 */
95 {2, 1, 1, 0, 2}, /* UART_RTS1 */
96 {2, 2, 2, 0, 2}, /* UART_CTS1 */
97 {2, 3, 2, 0, 2}, /* UART_SIN1 */
98
Andy Flemingda9d4612007-08-14 00:14:25 -050099 {0, 0, 0, 0, QE_IOP_TAB_END}, /* END of table */
100};
101
Andy Fleming67431052007-04-23 02:54:25 -0500102void local_bus_init(void);
103void sdram_init(void);
104
105int board_early_init_f (void)
106{
107 /*
108 * Initialize local bus.
109 */
110 local_bus_init ();
111
112 enable_8568mds_duart();
113 enable_8568mds_flash_write();
Anton Vorontsovad162242007-10-22 18:12:46 +0400114#if defined(CONFIG_UEC_ETH1) || defined(CONFIG_UEC_ETH2)
115 reset_8568mds_uccs();
116#endif
Andy Flemingda9d4612007-08-14 00:14:25 -0500117#if defined(CONFIG_QE) && !defined(CONFIG_eTSEC_MDIO_BUS)
118 enable_8568mds_qe_mdio();
119#endif
Andy Fleming67431052007-04-23 02:54:25 -0500120
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200121#ifdef CONFIG_SYS_I2C2_OFFSET
Haiying Wangc59e4092007-06-19 14:18:34 -0400122 /* Enable I2C2_SCL and I2C2_SDA */
123 volatile struct par_io *port_c;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200124 port_c = (struct par_io*)(CONFIG_SYS_IMMR + 0xe0140);
Haiying Wangc59e4092007-06-19 14:18:34 -0400125 port_c->cpdir2 |= 0x0f000000;
126 port_c->cppar2 &= ~0x0f000000;
127 port_c->cppar2 |= 0x0a000000;
128#endif
129
Andy Fleming67431052007-04-23 02:54:25 -0500130 return 0;
131}
132
133int checkboard (void)
134{
135 printf ("Board: 8568 MDS\n");
136
137 return 0;
138}
139
Becky Bruce9973e3c2008-06-09 16:03:40 -0500140phys_size_t
Andy Fleming67431052007-04-23 02:54:25 -0500141initdram(int board_type)
142{
143 long dram_size = 0;
Andy Fleming67431052007-04-23 02:54:25 -0500144
145 puts("Initializing\n");
146
147#if defined(CONFIG_DDR_DLL)
148 {
149 /*
150 * Work around to stabilize DDR DLL MSYNC_IN.
151 * Errata DDR9 seems to have been fixed.
152 * This is now the workaround for Errata DDR11:
153 * Override DLL = 1, Course Adj = 1, Tap Select = 0
154 */
155
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200156 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
Andy Fleming67431052007-04-23 02:54:25 -0500157
158 gur->ddrdllcr = 0x81000000;
159 asm("sync;isync;msync");
160 udelay(200);
161 }
162#endif
Jon Loeligere6f5b352008-03-18 13:51:05 -0500163
164 dram_size = fsl_ddr_sdram();
165 dram_size = setup_ddr_tlbs(dram_size / 0x100000);
166 dram_size *= 0x100000;
Andy Fleming67431052007-04-23 02:54:25 -0500167
Andy Fleming67431052007-04-23 02:54:25 -0500168 /*
169 * SDRAM Initialization
170 */
171 sdram_init();
172
173 puts(" DDR: ");
174 return dram_size;
175}
176
177/*
178 * Initialize Local Bus
179 */
180void
181local_bus_init(void)
182{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200183 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
184 volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
Andy Fleming67431052007-04-23 02:54:25 -0500185
186 uint clkdiv;
187 uint lbc_hz;
188 sys_info_t sysinfo;
189
190 get_sys_info(&sysinfo);
Trent Piephoa5d212a2008-12-03 15:16:34 -0800191 clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2;
Andy Fleming67431052007-04-23 02:54:25 -0500192 lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
193
194 gur->lbiuiplldcr1 = 0x00078080;
195 if (clkdiv == 16) {
196 gur->lbiuiplldcr0 = 0x7c0f1bf0;
197 } else if (clkdiv == 8) {
198 gur->lbiuiplldcr0 = 0x6c0f1bf0;
199 } else if (clkdiv == 4) {
200 gur->lbiuiplldcr0 = 0x5c0f1bf0;
201 }
202
203 lbc->lcrr |= 0x00030000;
204
205 asm("sync;isync;msync");
206}
207
208/*
209 * Initialize SDRAM memory on the Local Bus.
210 */
211void
212sdram_init(void)
213{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200214#if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
Andy Fleming67431052007-04-23 02:54:25 -0500215
216 uint idx;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200217 volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
218 uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
Andy Fleming67431052007-04-23 02:54:25 -0500219 uint lsdmr_common;
220
221 puts(" SDRAM: ");
222
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200223 print_size (CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
Andy Fleming67431052007-04-23 02:54:25 -0500224
225 /*
226 * Setup SDRAM Base and Option Registers
227 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200228 lbc->or2 = CONFIG_SYS_OR2_PRELIM;
Andy Fleming67431052007-04-23 02:54:25 -0500229 asm("msync");
230
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200231 lbc->br2 = CONFIG_SYS_BR2_PRELIM;
Andy Fleming67431052007-04-23 02:54:25 -0500232 asm("msync");
233
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200234 lbc->lbcr = CONFIG_SYS_LBC_LBCR;
Andy Fleming67431052007-04-23 02:54:25 -0500235 asm("msync");
236
237
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200238 lbc->lsrt = CONFIG_SYS_LBC_LSRT;
239 lbc->mrtpr = CONFIG_SYS_LBC_MRTPR;
Andy Fleming67431052007-04-23 02:54:25 -0500240 asm("msync");
241
242 /*
243 * MPC8568 uses "new" 15-16 style addressing.
244 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200245 lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON;
Kumar Galab0fe93ed2009-03-26 01:34:38 -0500246 lsdmr_common |= LSDMR_BSMA1516;
Andy Fleming67431052007-04-23 02:54:25 -0500247
248 /*
249 * Issue PRECHARGE ALL command.
250 */
Kumar Galab0fe93ed2009-03-26 01:34:38 -0500251 lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL;
Andy Fleming67431052007-04-23 02:54:25 -0500252 asm("sync;msync");
253 *sdram_addr = 0xff;
254 ppcDcbf((unsigned long) sdram_addr);
255 udelay(100);
256
257 /*
258 * Issue 8 AUTO REFRESH commands.
259 */
260 for (idx = 0; idx < 8; idx++) {
Kumar Galab0fe93ed2009-03-26 01:34:38 -0500261 lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH;
Andy Fleming67431052007-04-23 02:54:25 -0500262 asm("sync;msync");
263 *sdram_addr = 0xff;
264 ppcDcbf((unsigned long) sdram_addr);
265 udelay(100);
266 }
267
268 /*
269 * Issue 8 MODE-set command.
270 */
Kumar Galab0fe93ed2009-03-26 01:34:38 -0500271 lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW;
Andy Fleming67431052007-04-23 02:54:25 -0500272 asm("sync;msync");
273 *sdram_addr = 0xff;
274 ppcDcbf((unsigned long) sdram_addr);
275 udelay(100);
276
277 /*
278 * Issue NORMAL OP command.
279 */
Kumar Galab0fe93ed2009-03-26 01:34:38 -0500280 lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL;
Andy Fleming67431052007-04-23 02:54:25 -0500281 asm("sync;msync");
282 *sdram_addr = 0xff;
283 ppcDcbf((unsigned long) sdram_addr);
284 udelay(200); /* Overkill. Must wait > 200 bus cycles */
285
286#endif /* enable SDRAM init */
287}
288
Andy Fleming67431052007-04-23 02:54:25 -0500289#if defined(CONFIG_PCI)
290#ifndef CONFIG_PCI_PNP
291static struct pci_config_table pci_mpc8568mds_config_table[] = {
292 {
293 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
294 pci_cfgfunc_config_device,
295 {PCI_ENET0_IOADDR,
296 PCI_ENET0_MEMADDR,
297 PCI_COMMON_MEMORY | PCI_COMMAND_MASTER}
298 },
299 {}
300};
301#endif
302
Haiying Wang1563f562007-11-14 15:52:06 -0500303static struct pci_controller pci1_hose = {
Andy Fleming67431052007-04-23 02:54:25 -0500304#ifndef CONFIG_PCI_PNP
Haiying Wangc59e4092007-06-19 14:18:34 -0400305 config_table: pci_mpc8568mds_config_table,
Andy Fleming67431052007-04-23 02:54:25 -0500306#endif
Andy Fleming67431052007-04-23 02:54:25 -0500307};
Andy Fleming67431052007-04-23 02:54:25 -0500308#endif /* CONFIG_PCI */
309
Haiying Wang1563f562007-11-14 15:52:06 -0500310#ifdef CONFIG_PCIE1
311static struct pci_controller pcie1_hose;
312#endif /* CONFIG_PCIE1 */
313
314int first_free_busno = 0;
315
Haiying Wangc59e4092007-06-19 14:18:34 -0400316/*
317 * pib_init() -- Initialize the PCA9555 IO expander on the PIB board
318 */
319void
320pib_init(void)
321{
322 u8 val8, orig_i2c_bus;
323 /*
324 * Assign PIB PMC2/3 to PCI bus
325 */
326
327 /*switch temporarily to I2C bus #2 */
328 orig_i2c_bus = i2c_get_bus_num();
329 i2c_set_bus_num(1);
330
331 val8 = 0x00;
332 i2c_write(0x23, 0x6, 1, &val8, 1);
333 i2c_write(0x23, 0x7, 1, &val8, 1);
334 val8 = 0xff;
335 i2c_write(0x23, 0x2, 1, &val8, 1);
336 i2c_write(0x23, 0x3, 1, &val8, 1);
337
338 val8 = 0x00;
339 i2c_write(0x26, 0x6, 1, &val8, 1);
340 val8 = 0x34;
341 i2c_write(0x26, 0x7, 1, &val8, 1);
342 val8 = 0xf9;
343 i2c_write(0x26, 0x2, 1, &val8, 1);
344 val8 = 0xff;
345 i2c_write(0x26, 0x3, 1, &val8, 1);
346
347 val8 = 0x00;
348 i2c_write(0x27, 0x6, 1, &val8, 1);
349 i2c_write(0x27, 0x7, 1, &val8, 1);
350 val8 = 0xff;
351 i2c_write(0x27, 0x2, 1, &val8, 1);
352 val8 = 0xef;
353 i2c_write(0x27, 0x3, 1, &val8, 1);
354
355 asm("eieio");
356}
357
Haiying Wang1563f562007-11-14 15:52:06 -0500358#ifdef CONFIG_PCI
Andy Fleming67431052007-04-23 02:54:25 -0500359void
360pci_init_board(void)
361{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200362 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
Haiying Wang1563f562007-11-14 15:52:06 -0500363 uint io_sel = (gur->pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
364 uint host_agent = (gur->porbmsr & MPC85xx_PORBMSR_HA) >> 16;
365
366#ifdef CONFIG_PCI1
367{
Haiying Wangc59e4092007-06-19 14:18:34 -0400368 pib_init();
Haiying Wang1563f562007-11-14 15:52:06 -0500369
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200370 volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCI1_ADDR;
Haiying Wang1563f562007-11-14 15:52:06 -0500371 struct pci_controller *hose = &pci1_hose;
Kumar Gala2dba0de2008-10-21 08:28:33 -0500372 struct pci_region *r = hose->regions;
Haiying Wang1563f562007-11-14 15:52:06 -0500373
374 uint pci_32 = 1; /* PORDEVSR[15] */
375 uint pci_arb = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_ARB; /* PORDEVSR[14] */
376 uint pci_clk_sel = gur->porpllsr & MPC85xx_PORDEVSR_PCI1_SPD; /* PORPLLSR[16] */
377
378 uint pci_agent = (host_agent == 3) || (host_agent == 4 ) || (host_agent == 6);
379
380 uint pci_speed = 66666000;
381
382 if (!(gur->devdisr & MPC85xx_DEVDISR_PCI1)) {
383 printf (" PCI: %d bit, %s MHz, %s, %s, %s\n",
384 (pci_32) ? 32 : 64,
385 (pci_speed == 33333000) ? "33" :
386 (pci_speed == 66666000) ? "66" : "unknown",
387 pci_clk_sel ? "sync" : "async",
388 pci_agent ? "agent" : "host",
389 pci_arb ? "arbiter" : "external-arbiter"
390 );
391
392 /* inbound */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500393 r += fsl_pci_setup_inbound_windows(r);
Haiying Wang1563f562007-11-14 15:52:06 -0500394
395 /* outbound memory */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500396 pci_set_region(r++,
Kumar Gala10795f42008-12-02 16:08:36 -0600397 CONFIG_SYS_PCI1_MEM_BUS,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200398 CONFIG_SYS_PCI1_MEM_PHYS,
399 CONFIG_SYS_PCI1_MEM_SIZE,
Haiying Wang1563f562007-11-14 15:52:06 -0500400 PCI_REGION_MEM);
401
402 /* outbound io */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500403 pci_set_region(r++,
Kumar Gala5f91ef62008-12-02 16:08:37 -0600404 CONFIG_SYS_PCI1_IO_BUS,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200405 CONFIG_SYS_PCI1_IO_PHYS,
406 CONFIG_SYS_PCI1_IO_SIZE,
Haiying Wang1563f562007-11-14 15:52:06 -0500407 PCI_REGION_IO);
408
Kumar Gala2dba0de2008-10-21 08:28:33 -0500409 hose->region_count = r - hose->regions;
Haiying Wang1563f562007-11-14 15:52:06 -0500410
411 hose->first_busno = first_free_busno;
412 pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
413
414 fsl_pci_init(hose);
415 first_free_busno = hose->last_busno+1;
416 printf ("PCI on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
417 } else {
418 printf (" PCI: disabled\n");
419 }
420}
421#else
422 gur->devdisr |= MPC85xx_DEVDISR_PCI1; /* disable */
423#endif
424
425#ifdef CONFIG_PCIE1
426{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200427 volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE1_ADDR;
Haiying Wang1563f562007-11-14 15:52:06 -0500428 struct pci_controller *hose = &pcie1_hose;
429 int pcie_ep = (host_agent == 0) || (host_agent == 2 ) || (host_agent == 3);
Kumar Gala2dba0de2008-10-21 08:28:33 -0500430 struct pci_region *r = hose->regions;
Haiying Wang1563f562007-11-14 15:52:06 -0500431
432 int pcie_configured = io_sel >= 1;
433
434 if (pcie_configured && !(gur->devdisr & MPC85xx_DEVDISR_PCIE)){
435 printf ("\n PCIE connected to slot as %s (base address %x)",
436 pcie_ep ? "End Point" : "Root Complex",
437 (uint)pci);
438
439 if (pci->pme_msg_det) {
440 pci->pme_msg_det = 0xffffffff;
441 debug (" with errors. Clearing. Now 0x%08x",pci->pme_msg_det);
442 }
443 printf ("\n");
444
445 /* inbound */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500446 r += fsl_pci_setup_inbound_windows(r);
Haiying Wang1563f562007-11-14 15:52:06 -0500447
448 /* outbound memory */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500449 pci_set_region(r++,
Kumar Gala10795f42008-12-02 16:08:36 -0600450 CONFIG_SYS_PCIE1_MEM_BUS,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200451 CONFIG_SYS_PCIE1_MEM_PHYS,
452 CONFIG_SYS_PCIE1_MEM_SIZE,
Haiying Wang1563f562007-11-14 15:52:06 -0500453 PCI_REGION_MEM);
454
455 /* outbound io */
Kumar Gala2dba0de2008-10-21 08:28:33 -0500456 pci_set_region(r++,
Kumar Gala5f91ef62008-12-02 16:08:37 -0600457 CONFIG_SYS_PCIE1_IO_BUS,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200458 CONFIG_SYS_PCIE1_IO_PHYS,
459 CONFIG_SYS_PCIE1_IO_SIZE,
Haiying Wang1563f562007-11-14 15:52:06 -0500460 PCI_REGION_IO);
461
Kumar Gala2dba0de2008-10-21 08:28:33 -0500462 hose->region_count = r - hose->regions;
Haiying Wang1563f562007-11-14 15:52:06 -0500463
464 hose->first_busno=first_free_busno;
465 pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data);
466
467 fsl_pci_init(hose);
468 printf ("PCIE on bus %02x - %02x\n",hose->first_busno,hose->last_busno);
469
470 first_free_busno=hose->last_busno+1;
471
472 } else {
473 printf (" PCIE: disabled\n");
474 }
475}
476#else
477 gur->devdisr |= MPC85xx_DEVDISR_PCIE; /* disable */
Andy Fleming67431052007-04-23 02:54:25 -0500478#endif
479}
Haiying Wang1563f562007-11-14 15:52:06 -0500480#endif /* CONFIG_PCI */
481
Kumar Galac4808612007-11-29 01:06:19 -0600482#if defined(CONFIG_OF_BOARD_SETUP)
Kumar Gala2dba0de2008-10-21 08:28:33 -0500483void ft_board_setup(void *blob, bd_t *bd)
484{
Haiying Wang1563f562007-11-14 15:52:06 -0500485 ft_cpu_setup(blob, bd);
Haiying Wang1563f562007-11-14 15:52:06 -0500486
487#ifdef CONFIG_PCI1
Kumar Gala2dba0de2008-10-21 08:28:33 -0500488 ft_fsl_pci_setup(blob, "pci0", &pci1_hose);
Haiying Wang1563f562007-11-14 15:52:06 -0500489#endif
Haiying Wang1563f562007-11-14 15:52:06 -0500490#ifdef CONFIG_PCIE1
Kumar Gala2dba0de2008-10-21 08:28:33 -0500491 ft_fsl_pci_setup(blob, "pci1", &pcie1_hose);
Haiying Wang1563f562007-11-14 15:52:06 -0500492#endif
493}
494#endif