Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2007 Wind River Systemes, Inc. <www.windriver.com> |
| 3 | * Copyright 2007 Embedded Specialties, Inc. |
| 4 | * Joe Hamman joe.hamman@embeddedspecialties.com |
| 5 | * |
| 6 | * Copyright 2004 Freescale Semiconductor. |
| 7 | * Jeff Brown |
| 8 | * Srikanth Srinivasan (srikanth.srinivasan@freescale.com) |
| 9 | * |
| 10 | * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com> |
| 11 | * |
| 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 28 | * MA 02111-1307 USA |
| 29 | */ |
| 30 | |
| 31 | #include <common.h> |
| 32 | #include <command.h> |
| 33 | #include <pci.h> |
| 34 | #include <asm/processor.h> |
| 35 | #include <asm/immap_86xx.h> |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 36 | #include <asm/immap_fsl_pci.h> |
Kumar Gala | 9bd4e59 | 2008-08-26 15:01:37 -0500 | [diff] [blame] | 37 | #include <asm/fsl_ddr_sdram.h> |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 38 | #include <libfdt.h> |
| 39 | #include <fdt_support.h> |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 40 | |
| 41 | #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) |
| 42 | extern void ddr_enable_ecc (unsigned int dram_size); |
| 43 | #endif |
| 44 | |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 45 | long int fixed_sdram (void); |
| 46 | |
| 47 | int board_early_init_f (void) |
| 48 | { |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | int checkboard (void) |
| 53 | { |
| 54 | puts ("Board: Wind River SBC8641D\n"); |
| 55 | |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 56 | return 0; |
| 57 | } |
| 58 | |
Becky Bruce | 9973e3c | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 59 | phys_size_t initdram (int board_type) |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 60 | { |
| 61 | long dram_size = 0; |
| 62 | |
| 63 | #if defined(CONFIG_SPD_EEPROM) |
Kumar Gala | 9bd4e59 | 2008-08-26 15:01:37 -0500 | [diff] [blame] | 64 | dram_size = fsl_ddr_sdram(); |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 65 | #else |
| 66 | dram_size = fixed_sdram (); |
| 67 | #endif |
| 68 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | #if defined(CONFIG_SYS_RAMBOOT) |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 70 | puts (" DDR: "); |
| 71 | return dram_size; |
| 72 | #endif |
| 73 | |
| 74 | #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) |
| 75 | /* |
| 76 | * Initialize and enable DDR ECC. |
| 77 | */ |
| 78 | ddr_enable_ecc (dram_size); |
| 79 | #endif |
| 80 | |
| 81 | puts (" DDR: "); |
| 82 | return dram_size; |
| 83 | } |
| 84 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 85 | #if defined(CONFIG_SYS_DRAM_TEST) |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 86 | int testdram (void) |
| 87 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 88 | uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START; |
| 89 | uint *pend = (uint *) CONFIG_SYS_MEMTEST_END; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 90 | uint *p; |
| 91 | |
| 92 | puts ("SDRAM test phase 1:\n"); |
| 93 | for (p = pstart; p < pend; p++) |
| 94 | *p = 0xaaaaaaaa; |
| 95 | |
| 96 | for (p = pstart; p < pend; p++) { |
| 97 | if (*p != 0xaaaaaaaa) { |
| 98 | printf ("SDRAM test fails at: %08x\n", (uint) p); |
| 99 | return 1; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | puts ("SDRAM test phase 2:\n"); |
| 104 | for (p = pstart; p < pend; p++) |
| 105 | *p = 0x55555555; |
| 106 | |
| 107 | for (p = pstart; p < pend; p++) { |
| 108 | if (*p != 0x55555555) { |
| 109 | printf ("SDRAM test fails at: %08x\n", (uint) p); |
| 110 | return 1; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | puts ("SDRAM test passed.\n"); |
| 115 | return 0; |
| 116 | } |
| 117 | #endif |
| 118 | |
| 119 | #if !defined(CONFIG_SPD_EEPROM) |
| 120 | /* |
| 121 | * Fixed sdram init -- doesn't use serial presence detect. |
| 122 | */ |
| 123 | long int fixed_sdram (void) |
| 124 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 125 | #if !defined(CONFIG_SYS_RAMBOOT) |
| 126 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 127 | volatile ccsr_ddr_t *ddr = &immap->im_ddr1; |
| 128 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 129 | ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS; |
| 130 | ddr->cs1_bnds = CONFIG_SYS_DDR_CS1_BNDS; |
| 131 | ddr->cs2_bnds = CONFIG_SYS_DDR_CS2_BNDS; |
| 132 | ddr->cs3_bnds = CONFIG_SYS_DDR_CS3_BNDS; |
| 133 | ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG; |
| 134 | ddr->cs1_config = CONFIG_SYS_DDR_CS1_CONFIG; |
| 135 | ddr->cs2_config = CONFIG_SYS_DDR_CS2_CONFIG; |
| 136 | ddr->cs3_config = CONFIG_SYS_DDR_CS3_CONFIG; |
| 137 | ddr->timing_cfg_3 = CONFIG_SYS_DDR_TIMING_3; |
| 138 | ddr->timing_cfg_0 = CONFIG_SYS_DDR_TIMING_0; |
| 139 | ddr->timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1; |
| 140 | ddr->timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2; |
| 141 | ddr->sdram_cfg_1 = CONFIG_SYS_DDR_CFG_1A; |
| 142 | ddr->sdram_cfg_2 = CONFIG_SYS_DDR_CFG_2; |
| 143 | ddr->sdram_mode_1 = CONFIG_SYS_DDR_MODE_1; |
| 144 | ddr->sdram_mode_2 = CONFIG_SYS_DDR_MODE_2; |
| 145 | ddr->sdram_mode_cntl = CONFIG_SYS_DDR_MODE_CTL; |
| 146 | ddr->sdram_interval = CONFIG_SYS_DDR_INTERVAL; |
| 147 | ddr->sdram_data_init = CONFIG_SYS_DDR_DATA_INIT; |
| 148 | ddr->sdram_clk_cntl = CONFIG_SYS_DDR_CLK_CTRL; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 149 | |
| 150 | asm ("sync;isync"); |
| 151 | |
| 152 | udelay (500); |
| 153 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 154 | ddr->sdram_cfg_1 = CONFIG_SYS_DDR_CFG_1B; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 155 | asm ("sync; isync"); |
| 156 | |
| 157 | udelay (500); |
| 158 | ddr = &immap->im_ddr2; |
| 159 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 160 | ddr->cs0_bnds = CONFIG_SYS_DDR2_CS0_BNDS; |
| 161 | ddr->cs1_bnds = CONFIG_SYS_DDR2_CS1_BNDS; |
| 162 | ddr->cs2_bnds = CONFIG_SYS_DDR2_CS2_BNDS; |
| 163 | ddr->cs3_bnds = CONFIG_SYS_DDR2_CS3_BNDS; |
| 164 | ddr->cs0_config = CONFIG_SYS_DDR2_CS0_CONFIG; |
| 165 | ddr->cs1_config = CONFIG_SYS_DDR2_CS1_CONFIG; |
| 166 | ddr->cs2_config = CONFIG_SYS_DDR2_CS2_CONFIG; |
| 167 | ddr->cs3_config = CONFIG_SYS_DDR2_CS3_CONFIG; |
| 168 | ddr->timing_cfg_3 = CONFIG_SYS_DDR2_EXT_REFRESH; |
| 169 | ddr->timing_cfg_0 = CONFIG_SYS_DDR2_TIMING_0; |
| 170 | ddr->timing_cfg_1 = CONFIG_SYS_DDR2_TIMING_1; |
| 171 | ddr->timing_cfg_2 = CONFIG_SYS_DDR2_TIMING_2; |
| 172 | ddr->sdram_cfg_1 = CONFIG_SYS_DDR2_CFG_1A; |
| 173 | ddr->sdram_cfg_2 = CONFIG_SYS_DDR2_CFG_2; |
| 174 | ddr->sdram_mode_1 = CONFIG_SYS_DDR2_MODE_1; |
| 175 | ddr->sdram_mode_2 = CONFIG_SYS_DDR2_MODE_2; |
| 176 | ddr->sdram_mode_cntl = CONFIG_SYS_DDR2_MODE_CTL; |
| 177 | ddr->sdram_interval = CONFIG_SYS_DDR2_INTERVAL; |
| 178 | ddr->sdram_data_init = CONFIG_SYS_DDR2_DATA_INIT; |
| 179 | ddr->sdram_clk_cntl = CONFIG_SYS_DDR2_CLK_CTRL; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 180 | |
| 181 | asm ("sync;isync"); |
| 182 | |
| 183 | udelay (500); |
| 184 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 185 | ddr->sdram_cfg_1 = CONFIG_SYS_DDR2_CFG_1B; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 186 | asm ("sync; isync"); |
| 187 | |
| 188 | udelay (500); |
| 189 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 190 | return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 191 | } |
| 192 | #endif /* !defined(CONFIG_SPD_EEPROM) */ |
| 193 | |
| 194 | #if defined(CONFIG_PCI) |
| 195 | /* |
| 196 | * Initialize PCI Devices, report devices found. |
| 197 | */ |
| 198 | |
| 199 | #ifndef CONFIG_PCI_PNP |
| 200 | static struct pci_config_table pci_fsl86xxads_config_table[] = { |
| 201 | {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 202 | PCI_IDSEL_NUMBER, PCI_ANY_ID, |
| 203 | pci_cfgfunc_config_device, {PCI_ENET0_IOADDR, |
| 204 | PCI_ENET0_MEMADDR, |
| 205 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER}}, |
| 206 | {} |
| 207 | }; |
| 208 | #endif |
| 209 | |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 210 | static struct pci_controller pci1_hose = { |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 211 | #ifndef CONFIG_PCI_PNP |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 212 | config_table:pci_mpc86xxcts_config_table |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 213 | #endif |
| 214 | }; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 215 | #endif /* CONFIG_PCI */ |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 216 | |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 217 | #ifdef CONFIG_PCI2 |
| 218 | static struct pci_controller pci2_hose; |
| 219 | #endif /* CONFIG_PCI2 */ |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 220 | |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 221 | int first_free_busno = 0; |
| 222 | |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 223 | extern int fsl_pci_setup_inbound_windows(struct pci_region *r); |
| 224 | extern void fsl_pci_init(struct pci_controller *hose); |
| 225 | |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 226 | void pci_init_board(void) |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 227 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 228 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_CCSRBAR; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 229 | volatile ccsr_gur_t *gur = &immap->im_gur; |
| 230 | uint devdisr = gur->devdisr; |
Jon Loeliger | 33fa5c0 | 2008-02-25 13:13:37 -0600 | [diff] [blame] | 231 | uint io_sel = (gur->pordevsr & MPC8641_PORDEVSR_IO_SEL) |
| 232 | >> MPC8641_PORDEVSR_IO_SEL_SHIFT; |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 233 | |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 234 | #ifdef CONFIG_PCI1 |
| 235 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 236 | volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCI1_ADDR; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 237 | struct pci_controller *hose = &pci1_hose; |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 238 | struct pci_region *r = hose->regions; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 239 | #ifdef DEBUG |
Jon Loeliger | 33fa5c0 | 2008-02-25 13:13:37 -0600 | [diff] [blame] | 240 | uint host1_agent = (gur->porbmsr & MPC8641_PORBMSR_HA) |
| 241 | >> MPC8641_PORBMSR_HA_SHIFT; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 242 | uint pex1_agent = (host1_agent == 0) || (host1_agent == 1); |
| 243 | #endif |
| 244 | if ((io_sel == 2 || io_sel == 3 || io_sel == 5 |
| 245 | || io_sel == 6 || io_sel == 7 || io_sel == 0xF) |
| 246 | && !(devdisr & MPC86xx_DEVDISR_PCIEX1)) { |
| 247 | debug("PCI-EXPRESS 1: %s \n", pex1_agent ? "Agent" : "Host"); |
| 248 | debug("0x%08x=0x%08x ", &pci->pme_msg_det, pci->pme_msg_det); |
| 249 | if (pci->pme_msg_det) { |
| 250 | pci->pme_msg_det = 0xffffffff; |
| 251 | debug(" with errors. Clearing. Now 0x%08x", |
| 252 | pci->pme_msg_det); |
| 253 | } |
| 254 | debug("\n"); |
| 255 | |
| 256 | /* inbound */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 257 | r += fsl_pci_setup_inbound_windows(r); |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 258 | |
| 259 | /* outbound memory */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 260 | pci_set_region(r++, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 261 | CONFIG_SYS_PCI1_MEM_BASE, |
| 262 | CONFIG_SYS_PCI1_MEM_PHYS, |
| 263 | CONFIG_SYS_PCI1_MEM_SIZE, |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 264 | PCI_REGION_MEM); |
| 265 | |
| 266 | /* outbound io */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 267 | pci_set_region(r++, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 268 | CONFIG_SYS_PCI1_IO_BASE, |
| 269 | CONFIG_SYS_PCI1_IO_PHYS, |
| 270 | CONFIG_SYS_PCI1_IO_SIZE, |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 271 | PCI_REGION_IO); |
| 272 | |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 273 | hose->region_count = r - hose->regions; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 274 | |
| 275 | hose->first_busno=first_free_busno; |
| 276 | pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data); |
| 277 | |
| 278 | fsl_pci_init(hose); |
| 279 | |
| 280 | first_free_busno=hose->last_busno+1; |
| 281 | printf (" PCI-EXPRESS 1 on bus %02x - %02x\n", |
| 282 | hose->first_busno,hose->last_busno); |
| 283 | |
| 284 | } else { |
| 285 | puts("PCI-EXPRESS 1: Disabled\n"); |
| 286 | } |
| 287 | } |
| 288 | #else |
| 289 | puts("PCI-EXPRESS1: Disabled\n"); |
| 290 | #endif /* CONFIG_PCI1 */ |
| 291 | |
| 292 | #ifdef CONFIG_PCI2 |
| 293 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 294 | volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCI2_ADDR; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 295 | struct pci_controller *hose = &pci2_hose; |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 296 | struct pci_region *r = hose->regions; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 297 | |
| 298 | |
| 299 | /* inbound */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 300 | r += fsl_pci_setup_inbound_windows(r); |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 301 | |
| 302 | /* outbound memory */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 303 | pci_set_region(r++, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 304 | CONFIG_SYS_PCI2_MEM_BASE, |
| 305 | CONFIG_SYS_PCI2_MEM_PHYS, |
| 306 | CONFIG_SYS_PCI2_MEM_SIZE, |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 307 | PCI_REGION_MEM); |
| 308 | |
| 309 | /* outbound io */ |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 310 | pci_set_region(r++, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 311 | CONFIG_SYS_PCI2_IO_BASE, |
| 312 | CONFIG_SYS_PCI2_IO_PHYS, |
| 313 | CONFIG_SYS_PCI2_IO_SIZE, |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 314 | PCI_REGION_IO); |
| 315 | |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 316 | hose->region_count = r - hose->regions; |
Joe Hamman | cca3496 | 2007-08-11 06:54:58 -0500 | [diff] [blame] | 317 | |
| 318 | hose->first_busno=first_free_busno; |
| 319 | pci_setup_indirect(hose, (int) &pci->cfg_addr, (int) &pci->cfg_data); |
| 320 | |
| 321 | fsl_pci_init(hose); |
| 322 | |
| 323 | first_free_busno=hose->last_busno+1; |
| 324 | printf (" PCI-EXPRESS 2 on bus %02x - %02x\n", |
| 325 | hose->first_busno,hose->last_busno); |
| 326 | } |
| 327 | #else |
| 328 | puts("PCI-EXPRESS 2: Disabled\n"); |
| 329 | #endif /* CONFIG_PCI2 */ |
| 330 | |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 331 | } |
| 332 | |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 333 | |
| 334 | #if defined(CONFIG_OF_BOARD_SETUP) |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 335 | extern void ft_fsl_pci_setup(void *blob, const char *pci_alias, |
| 336 | struct pci_controller *hose); |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 337 | |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 338 | void ft_board_setup (void *blob, bd_t *bd) |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 339 | { |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 340 | ft_cpu_setup(blob, bd); |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 341 | |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 342 | #ifdef CONFIG_PCI1 |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 343 | ft_fsl_pci_setup(blob, "pci0", &pci1_hose); |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 344 | #endif |
| 345 | #ifdef CONFIG_PCI2 |
Kumar Gala | c2083e0 | 2008-10-22 14:38:55 -0500 | [diff] [blame^] | 346 | ft_fsl_pci_setup(blob, "pci1", &pci2_hose); |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 347 | #endif |
Joe Hamman | 8ac2732 | 2007-08-09 15:10:53 -0500 | [diff] [blame] | 348 | } |
| 349 | #endif |
| 350 | |
| 351 | void sbc8641d_reset_board (void) |
| 352 | { |
| 353 | puts ("Resetting board....\n"); |
| 354 | } |
| 355 | |
| 356 | /* |
| 357 | * get_board_sys_clk |
| 358 | * Clock is fixed at 1GHz on this board. Used for CONFIG_SYS_CLK_FREQ |
| 359 | */ |
| 360 | |
| 361 | unsigned long get_board_sys_clk (ulong dummy) |
| 362 | { |
| 363 | int i; |
| 364 | ulong val = 0; |
| 365 | |
| 366 | i = 5; |
| 367 | i &= 0x07; |
| 368 | |
| 369 | switch (i) { |
| 370 | case 0: |
| 371 | val = 33000000; |
| 372 | break; |
| 373 | case 1: |
| 374 | val = 40000000; |
| 375 | break; |
| 376 | case 2: |
| 377 | val = 50000000; |
| 378 | break; |
| 379 | case 3: |
| 380 | val = 66000000; |
| 381 | break; |
| 382 | case 4: |
| 383 | val = 83000000; |
| 384 | break; |
| 385 | case 5: |
| 386 | val = 100000000; |
| 387 | break; |
| 388 | case 6: |
| 389 | val = 134000000; |
| 390 | break; |
| 391 | case 7: |
| 392 | val = 166000000; |
| 393 | break; |
| 394 | } |
| 395 | |
| 396 | return val; |
| 397 | } |