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