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