Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 1 | /* |
Zhao Chenhui | b092072 | 2011-08-24 13:20:05 +0800 | [diff] [blame] | 2 | * Copyright 2007,2009-2011 Freescale Semiconductor, Inc. |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 3 | * |
| 4 | * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com> |
| 5 | * |
Wolfgang Denk | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <pci.h> |
| 11 | #include <asm/processor.h> |
Jon Loeliger | e6f5b35 | 2008-03-18 13:51:05 -0500 | [diff] [blame] | 12 | #include <asm/mmu.h> |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 13 | #include <asm/immap_85xx.h> |
Kumar Gala | c851462 | 2009-04-02 13:22:48 -0500 | [diff] [blame] | 14 | #include <asm/fsl_pci.h> |
Jon Loeliger | e6f5b35 | 2008-03-18 13:51:05 -0500 | [diff] [blame] | 15 | #include <asm/fsl_ddr_sdram.h> |
Kumar Gala | 5d27e02 | 2010-12-15 04:55:20 -0600 | [diff] [blame] | 16 | #include <asm/fsl_serdes.h> |
Jon Loeliger | a30a549 | 2008-03-04 10:03:03 -0600 | [diff] [blame] | 17 | #include <spd_sdram.h> |
Haiying Wang | c59e409 | 2007-06-19 14:18:34 -0400 | [diff] [blame] | 18 | #include <i2c.h> |
Andy Fleming | da9d461 | 2007-08-14 00:14:25 -0500 | [diff] [blame] | 19 | #include <ioports.h> |
Kumar Gala | c480861 | 2007-11-29 01:06:19 -0600 | [diff] [blame] | 20 | #include <libfdt.h> |
| 21 | #include <fdt_support.h> |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 22 | |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 23 | #include "bcsr.h" |
| 24 | |
Andy Fleming | da9d461 | 2007-08-14 00:14:25 -0500 | [diff] [blame] | 25 | const qe_iop_conf_t qe_iop_conf_tab[] = { |
| 26 | /* GETH1 */ |
| 27 | {4, 10, 1, 0, 2}, /* TxD0 */ |
| 28 | {4, 9, 1, 0, 2}, /* TxD1 */ |
| 29 | {4, 8, 1, 0, 2}, /* TxD2 */ |
| 30 | {4, 7, 1, 0, 2}, /* TxD3 */ |
| 31 | {4, 23, 1, 0, 2}, /* TxD4 */ |
| 32 | {4, 22, 1, 0, 2}, /* TxD5 */ |
| 33 | {4, 21, 1, 0, 2}, /* TxD6 */ |
| 34 | {4, 20, 1, 0, 2}, /* TxD7 */ |
| 35 | {4, 15, 2, 0, 2}, /* RxD0 */ |
| 36 | {4, 14, 2, 0, 2}, /* RxD1 */ |
| 37 | {4, 13, 2, 0, 2}, /* RxD2 */ |
| 38 | {4, 12, 2, 0, 2}, /* RxD3 */ |
| 39 | {4, 29, 2, 0, 2}, /* RxD4 */ |
| 40 | {4, 28, 2, 0, 2}, /* RxD5 */ |
| 41 | {4, 27, 2, 0, 2}, /* RxD6 */ |
| 42 | {4, 26, 2, 0, 2}, /* RxD7 */ |
| 43 | {4, 11, 1, 0, 2}, /* TX_EN */ |
| 44 | {4, 24, 1, 0, 2}, /* TX_ER */ |
| 45 | {4, 16, 2, 0, 2}, /* RX_DV */ |
| 46 | {4, 30, 2, 0, 2}, /* RX_ER */ |
| 47 | {4, 17, 2, 0, 2}, /* RX_CLK */ |
| 48 | {4, 19, 1, 0, 2}, /* GTX_CLK */ |
| 49 | {1, 31, 2, 0, 3}, /* GTX125 */ |
| 50 | |
| 51 | /* GETH2 */ |
| 52 | {5, 10, 1, 0, 2}, /* TxD0 */ |
| 53 | {5, 9, 1, 0, 2}, /* TxD1 */ |
| 54 | {5, 8, 1, 0, 2}, /* TxD2 */ |
| 55 | {5, 7, 1, 0, 2}, /* TxD3 */ |
| 56 | {5, 23, 1, 0, 2}, /* TxD4 */ |
| 57 | {5, 22, 1, 0, 2}, /* TxD5 */ |
| 58 | {5, 21, 1, 0, 2}, /* TxD6 */ |
| 59 | {5, 20, 1, 0, 2}, /* TxD7 */ |
| 60 | {5, 15, 2, 0, 2}, /* RxD0 */ |
| 61 | {5, 14, 2, 0, 2}, /* RxD1 */ |
| 62 | {5, 13, 2, 0, 2}, /* RxD2 */ |
| 63 | {5, 12, 2, 0, 2}, /* RxD3 */ |
| 64 | {5, 29, 2, 0, 2}, /* RxD4 */ |
| 65 | {5, 28, 2, 0, 2}, /* RxD5 */ |
| 66 | {5, 27, 2, 0, 3}, /* RxD6 */ |
| 67 | {5, 26, 2, 0, 2}, /* RxD7 */ |
| 68 | {5, 11, 1, 0, 2}, /* TX_EN */ |
| 69 | {5, 24, 1, 0, 2}, /* TX_ER */ |
| 70 | {5, 16, 2, 0, 2}, /* RX_DV */ |
| 71 | {5, 30, 2, 0, 2}, /* RX_ER */ |
| 72 | {5, 17, 2, 0, 2}, /* RX_CLK */ |
| 73 | {5, 19, 1, 0, 2}, /* GTX_CLK */ |
| 74 | {1, 31, 2, 0, 3}, /* GTX125 */ |
| 75 | {4, 6, 3, 0, 2}, /* MDIO */ |
| 76 | {4, 5, 1, 0, 2}, /* MDC */ |
Anton Vorontsov | 64d4bcb | 2007-10-22 19:58:19 +0400 | [diff] [blame] | 77 | |
| 78 | /* UART1 */ |
| 79 | {2, 0, 1, 0, 2}, /* UART_SOUT1 */ |
| 80 | {2, 1, 1, 0, 2}, /* UART_RTS1 */ |
| 81 | {2, 2, 2, 0, 2}, /* UART_CTS1 */ |
| 82 | {2, 3, 2, 0, 2}, /* UART_SIN1 */ |
| 83 | |
Andy Fleming | da9d461 | 2007-08-14 00:14:25 -0500 | [diff] [blame] | 84 | {0, 0, 0, 0, QE_IOP_TAB_END}, /* END of table */ |
| 85 | }; |
| 86 | |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 87 | void local_bus_init(void); |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 88 | |
| 89 | int board_early_init_f (void) |
| 90 | { |
| 91 | /* |
| 92 | * Initialize local bus. |
| 93 | */ |
| 94 | local_bus_init (); |
| 95 | |
| 96 | enable_8568mds_duart(); |
| 97 | enable_8568mds_flash_write(); |
Anton Vorontsov | ad16224 | 2007-10-22 18:12:46 +0400 | [diff] [blame] | 98 | #if defined(CONFIG_UEC_ETH1) || defined(CONFIG_UEC_ETH2) |
| 99 | reset_8568mds_uccs(); |
| 100 | #endif |
Andy Fleming | da9d461 | 2007-08-14 00:14:25 -0500 | [diff] [blame] | 101 | #if defined(CONFIG_QE) && !defined(CONFIG_eTSEC_MDIO_BUS) |
| 102 | enable_8568mds_qe_mdio(); |
| 103 | #endif |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 104 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | #ifdef CONFIG_SYS_I2C2_OFFSET |
Haiying Wang | c59e409 | 2007-06-19 14:18:34 -0400 | [diff] [blame] | 106 | /* Enable I2C2_SCL and I2C2_SDA */ |
| 107 | volatile struct par_io *port_c; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 108 | port_c = (struct par_io*)(CONFIG_SYS_IMMR + 0xe0140); |
Haiying Wang | c59e409 | 2007-06-19 14:18:34 -0400 | [diff] [blame] | 109 | port_c->cpdir2 |= 0x0f000000; |
| 110 | port_c->cppar2 &= ~0x0f000000; |
| 111 | port_c->cppar2 |= 0x0a000000; |
| 112 | #endif |
| 113 | |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | int checkboard (void) |
| 118 | { |
| 119 | printf ("Board: 8568 MDS\n"); |
| 120 | |
| 121 | return 0; |
| 122 | } |
| 123 | |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 124 | /* |
| 125 | * Initialize Local Bus |
| 126 | */ |
| 127 | void |
| 128 | local_bus_init(void) |
| 129 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 130 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 131 | volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 132 | |
| 133 | uint clkdiv; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 134 | sys_info_t sysinfo; |
| 135 | |
| 136 | get_sys_info(&sysinfo); |
Trent Piepho | a5d212a | 2008-12-03 15:16:34 -0800 | [diff] [blame] | 137 | clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 138 | |
| 139 | gur->lbiuiplldcr1 = 0x00078080; |
| 140 | if (clkdiv == 16) { |
| 141 | gur->lbiuiplldcr0 = 0x7c0f1bf0; |
| 142 | } else if (clkdiv == 8) { |
| 143 | gur->lbiuiplldcr0 = 0x6c0f1bf0; |
| 144 | } else if (clkdiv == 4) { |
| 145 | gur->lbiuiplldcr0 = 0x5c0f1bf0; |
| 146 | } |
| 147 | |
| 148 | lbc->lcrr |= 0x00030000; |
| 149 | |
| 150 | asm("sync;isync;msync"); |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * Initialize SDRAM memory on the Local Bus. |
| 155 | */ |
Becky Bruce | 70961ba | 2010-12-17 17:17:57 -0600 | [diff] [blame] | 156 | void lbc_sdram_init(void) |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 157 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 158 | #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM) |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 159 | |
| 160 | uint idx; |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 161 | volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 162 | uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 163 | uint lsdmr_common; |
| 164 | |
Becky Bruce | 7ea3871 | 2010-12-17 17:17:59 -0600 | [diff] [blame] | 165 | puts("LBC SDRAM: "); |
| 166 | print_size(CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, |
| 167 | "\n "); |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 168 | |
| 169 | /* |
| 170 | * Setup SDRAM Base and Option Registers |
| 171 | */ |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 172 | set_lbc_or(2, CONFIG_SYS_OR2_PRELIM); |
| 173 | set_lbc_br(2, CONFIG_SYS_BR2_PRELIM); |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 174 | asm("msync"); |
| 175 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 176 | lbc->lbcr = CONFIG_SYS_LBC_LBCR; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 177 | asm("msync"); |
| 178 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 179 | lbc->lsrt = CONFIG_SYS_LBC_LSRT; |
| 180 | lbc->mrtpr = CONFIG_SYS_LBC_MRTPR; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 181 | asm("msync"); |
| 182 | |
| 183 | /* |
| 184 | * MPC8568 uses "new" 15-16 style addressing. |
| 185 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 186 | lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON; |
Kumar Gala | b0fe93ed | 2009-03-26 01:34:38 -0500 | [diff] [blame] | 187 | lsdmr_common |= LSDMR_BSMA1516; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 188 | |
| 189 | /* |
| 190 | * Issue PRECHARGE ALL command. |
| 191 | */ |
Kumar Gala | b0fe93ed | 2009-03-26 01:34:38 -0500 | [diff] [blame] | 192 | lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 193 | asm("sync;msync"); |
| 194 | *sdram_addr = 0xff; |
| 195 | ppcDcbf((unsigned long) sdram_addr); |
| 196 | udelay(100); |
| 197 | |
| 198 | /* |
| 199 | * Issue 8 AUTO REFRESH commands. |
| 200 | */ |
| 201 | for (idx = 0; idx < 8; idx++) { |
Kumar Gala | b0fe93ed | 2009-03-26 01:34:38 -0500 | [diff] [blame] | 202 | lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 203 | asm("sync;msync"); |
| 204 | *sdram_addr = 0xff; |
| 205 | ppcDcbf((unsigned long) sdram_addr); |
| 206 | udelay(100); |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | * Issue 8 MODE-set command. |
| 211 | */ |
Kumar Gala | b0fe93ed | 2009-03-26 01:34:38 -0500 | [diff] [blame] | 212 | lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 213 | asm("sync;msync"); |
| 214 | *sdram_addr = 0xff; |
| 215 | ppcDcbf((unsigned long) sdram_addr); |
| 216 | udelay(100); |
| 217 | |
| 218 | /* |
| 219 | * Issue NORMAL OP command. |
| 220 | */ |
Kumar Gala | b0fe93ed | 2009-03-26 01:34:38 -0500 | [diff] [blame] | 221 | lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 222 | asm("sync;msync"); |
| 223 | *sdram_addr = 0xff; |
| 224 | ppcDcbf((unsigned long) sdram_addr); |
| 225 | udelay(200); /* Overkill. Must wait > 200 bus cycles */ |
| 226 | |
| 227 | #endif /* enable SDRAM init */ |
| 228 | } |
| 229 | |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 230 | #if defined(CONFIG_PCI) |
| 231 | #ifndef CONFIG_PCI_PNP |
| 232 | static struct pci_config_table pci_mpc8568mds_config_table[] = { |
| 233 | { |
| 234 | PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 235 | pci_cfgfunc_config_device, |
| 236 | {PCI_ENET0_IOADDR, |
| 237 | PCI_ENET0_MEMADDR, |
| 238 | PCI_COMMON_MEMORY | PCI_COMMAND_MASTER} |
| 239 | }, |
| 240 | {} |
| 241 | }; |
| 242 | #endif |
| 243 | |
Zhao Chenhui | b092072 | 2011-08-24 13:20:05 +0800 | [diff] [blame] | 244 | static struct pci_controller pci1_hose; |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 245 | #endif /* CONFIG_PCI */ |
| 246 | |
Haiying Wang | c59e409 | 2007-06-19 14:18:34 -0400 | [diff] [blame] | 247 | /* |
| 248 | * pib_init() -- Initialize the PCA9555 IO expander on the PIB board |
| 249 | */ |
| 250 | void |
| 251 | pib_init(void) |
| 252 | { |
| 253 | u8 val8, orig_i2c_bus; |
| 254 | /* |
| 255 | * Assign PIB PMC2/3 to PCI bus |
| 256 | */ |
| 257 | |
| 258 | /*switch temporarily to I2C bus #2 */ |
| 259 | orig_i2c_bus = i2c_get_bus_num(); |
| 260 | i2c_set_bus_num(1); |
| 261 | |
| 262 | val8 = 0x00; |
| 263 | i2c_write(0x23, 0x6, 1, &val8, 1); |
| 264 | i2c_write(0x23, 0x7, 1, &val8, 1); |
| 265 | val8 = 0xff; |
| 266 | i2c_write(0x23, 0x2, 1, &val8, 1); |
| 267 | i2c_write(0x23, 0x3, 1, &val8, 1); |
| 268 | |
| 269 | val8 = 0x00; |
| 270 | i2c_write(0x26, 0x6, 1, &val8, 1); |
| 271 | val8 = 0x34; |
| 272 | i2c_write(0x26, 0x7, 1, &val8, 1); |
| 273 | val8 = 0xf9; |
| 274 | i2c_write(0x26, 0x2, 1, &val8, 1); |
| 275 | val8 = 0xff; |
| 276 | i2c_write(0x26, 0x3, 1, &val8, 1); |
| 277 | |
| 278 | val8 = 0x00; |
| 279 | i2c_write(0x27, 0x6, 1, &val8, 1); |
| 280 | i2c_write(0x27, 0x7, 1, &val8, 1); |
| 281 | val8 = 0xff; |
| 282 | i2c_write(0x27, 0x2, 1, &val8, 1); |
| 283 | val8 = 0xef; |
| 284 | i2c_write(0x27, 0x3, 1, &val8, 1); |
| 285 | |
| 286 | asm("eieio"); |
Kumar Gala | 502dd36 | 2011-11-09 10:03:01 -0600 | [diff] [blame] | 287 | i2c_set_bus_num(orig_i2c_bus); |
Haiying Wang | c59e409 | 2007-06-19 14:18:34 -0400 | [diff] [blame] | 288 | } |
| 289 | |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 290 | #ifdef CONFIG_PCI |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 291 | void pci_init_board(void) |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 292 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 293 | volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); |
Kumar Gala | 3f6f9d7 | 2010-12-17 10:13:19 -0600 | [diff] [blame] | 294 | int first_free_busno = 0; |
| 295 | #ifdef CONFIG_PCI1 |
| 296 | struct fsl_pci_info pci_info; |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 297 | u32 devdisr, pordevsr, io_sel; |
| 298 | u32 porpllsr, pci_agent, pci_speed, pci_32, pci_arb, pci_clk_sel; |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 299 | |
| 300 | devdisr = in_be32(&gur->devdisr); |
| 301 | pordevsr = in_be32(&gur->pordevsr); |
| 302 | porpllsr = in_be32(&gur->porpllsr); |
| 303 | io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19; |
| 304 | |
| 305 | debug (" pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 306 | |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 307 | pci_speed = 66666000; |
| 308 | pci_32 = 1; |
| 309 | pci_arb = pordevsr & MPC85xx_PORDEVSR_PCI1_ARB; |
| 310 | pci_clk_sel = porpllsr & MPC85xx_PORDEVSR_PCI1_SPD; |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 311 | |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 312 | if (!(devdisr & MPC85xx_DEVDISR_PCI1)) { |
Kumar Gala | 3f6f9d7 | 2010-12-17 10:13:19 -0600 | [diff] [blame] | 313 | SET_STD_PCI_INFO(pci_info, 1); |
| 314 | set_next_law(pci_info.mem_phys, |
| 315 | law_size_bits(pci_info.mem_size), pci_info.law); |
| 316 | set_next_law(pci_info.io_phys, |
| 317 | law_size_bits(pci_info.io_size), pci_info.law); |
| 318 | |
| 319 | pci_agent = fsl_setup_hose(&pci1_hose, pci_info.regs); |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 320 | printf("PCI: %d bit, %s MHz, %s, %s, %s (base address %lx)\n", |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 321 | (pci_32) ? 32 : 64, |
| 322 | (pci_speed == 33333000) ? "33" : |
| 323 | (pci_speed == 66666000) ? "66" : "unknown", |
| 324 | pci_clk_sel ? "sync" : "async", |
| 325 | pci_agent ? "agent" : "host", |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 326 | pci_arb ? "arbiter" : "external-arbiter", |
Kumar Gala | 3f6f9d7 | 2010-12-17 10:13:19 -0600 | [diff] [blame] | 327 | pci_info.regs); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 328 | |
Zhao Chenhui | b092072 | 2011-08-24 13:20:05 +0800 | [diff] [blame] | 329 | #ifndef CONFIG_PCI_PNP |
| 330 | pci1_hose.config_table = pci_mpc8568mds_config_table; |
| 331 | #endif |
Kumar Gala | 3f6f9d7 | 2010-12-17 10:13:19 -0600 | [diff] [blame] | 332 | first_free_busno = fsl_pci_init_port(&pci_info, |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 333 | &pci1_hose, first_free_busno); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 334 | } else { |
Peter Tyser | 8ca78f2 | 2010-10-29 17:59:24 -0500 | [diff] [blame] | 335 | printf("PCI: disabled\n"); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 336 | } |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 337 | |
| 338 | puts("\n"); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 339 | #else |
Kumar Gala | 4681457 | 2009-11-04 10:31:53 -0600 | [diff] [blame] | 340 | setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1); /* disable */ |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 341 | #endif |
| 342 | |
Kumar Gala | 3f6f9d7 | 2010-12-17 10:13:19 -0600 | [diff] [blame] | 343 | fsl_pcie_init_board(first_free_busno); |
Andy Fleming | 6743105 | 2007-04-23 02:54:25 -0500 | [diff] [blame] | 344 | } |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 345 | #endif /* CONFIG_PCI */ |
| 346 | |
Kumar Gala | c480861 | 2007-11-29 01:06:19 -0600 | [diff] [blame] | 347 | #if defined(CONFIG_OF_BOARD_SETUP) |
Kumar Gala | 2dba0de | 2008-10-21 08:28:33 -0500 | [diff] [blame] | 348 | void ft_board_setup(void *blob, bd_t *bd) |
| 349 | { |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 350 | ft_cpu_setup(blob, bd); |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 351 | |
Kumar Gala | 6525d51 | 2010-07-08 22:37:44 -0500 | [diff] [blame] | 352 | FT_FSL_PCI_SETUP; |
Haiying Wang | 1563f56 | 2007-11-14 15:52:06 -0500 | [diff] [blame] | 353 | } |
| 354 | #endif |