wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 1 | /* |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 2 | * Copyright 2004 Freescale Semiconductor. |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 3 | * (C) Copyright 2002,2003, Motorola Inc. |
| 4 | * Xianghua Xiao, (X.Xiao@motorola.com) |
| 5 | * |
| 6 | * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com> |
| 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA |
| 25 | */ |
| 26 | |
| 27 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 28 | #include <common.h> |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 29 | #include <pci.h> |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 30 | #include <asm/processor.h> |
| 31 | #include <asm/immap_85xx.h> |
Jon Loeliger | de9737d | 2008-03-04 10:03:03 -0600 | [diff] [blame] | 32 | #include <spd_sdram.h> |
Kumar Gala | 6e57840 | 2007-11-28 22:54:27 -0600 | [diff] [blame] | 33 | #include <libfdt.h> |
| 34 | #include <fdt_support.h> |
Matthew McClintock | 148e26a | 2006-06-28 10:43:36 -0500 | [diff] [blame] | 35 | |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 36 | #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 37 | extern void ddr_enable_ecc(unsigned int dram_size); |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 38 | #endif |
| 39 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 40 | void local_bus_init(void); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 41 | void sdram_init(void); |
| 42 | long int fixed_sdram(void); |
| 43 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 44 | |
wdenk | da55c6e | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 45 | int board_early_init_f (void) |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 46 | { |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 47 | return 0; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | int checkboard (void) |
| 51 | { |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 52 | puts("Board: ADS\n"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 53 | |
| 54 | #ifdef CONFIG_PCI |
| 55 | printf(" PCI1: 32 bit, %d MHz (compiled)\n", |
| 56 | CONFIG_SYS_CLK_FREQ / 1000000); |
| 57 | #else |
| 58 | printf(" PCI1: disabled\n"); |
| 59 | #endif |
| 60 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 61 | /* |
| 62 | * Initialize local bus. |
| 63 | */ |
| 64 | local_bus_init(); |
| 65 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 66 | return 0; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 67 | } |
| 68 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 69 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 70 | long int |
| 71 | initdram(int board_type) |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 72 | { |
| 73 | long dram_size = 0; |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 74 | |
| 75 | puts("Initializing\n"); |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 76 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 77 | #if defined(CONFIG_DDR_DLL) |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 78 | { |
Kumar Gala | ec1340d | 2007-11-27 23:25:02 -0600 | [diff] [blame] | 79 | volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR); |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 80 | uint temp_ddrdll = 0; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 81 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 82 | /* |
| 83 | * Work around to stabilize DDR DLL |
| 84 | */ |
| 85 | temp_ddrdll = gur->ddrdllcr; |
| 86 | gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000; |
| 87 | asm("sync;isync;msync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 88 | } |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 89 | #endif |
| 90 | |
| 91 | #if defined(CONFIG_SPD_EEPROM) |
| 92 | dram_size = spd_sdram (); |
| 93 | #else |
| 94 | dram_size = fixed_sdram (); |
| 95 | #endif |
| 96 | |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 97 | #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 98 | /* |
| 99 | * Initialize and enable DDR ECC. |
| 100 | */ |
| 101 | ddr_enable_ecc(dram_size); |
| 102 | #endif |
| 103 | |
| 104 | /* |
| 105 | * Initialize SDRAM. |
| 106 | */ |
| 107 | sdram_init(); |
| 108 | |
| 109 | puts(" DDR: "); |
| 110 | return dram_size; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /* |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 115 | * Initialize Local Bus |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 116 | */ |
| 117 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 118 | void |
| 119 | local_bus_init(void) |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 120 | { |
Kumar Gala | ec1340d | 2007-11-27 23:25:02 -0600 | [diff] [blame] | 121 | volatile ccsr_gur_t *gur = (void *)(CFG_MPC85xx_GUTS_ADDR); |
Kumar Gala | 0a7a097 | 2007-11-29 02:10:09 -0600 | [diff] [blame] | 122 | volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 123 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 124 | uint clkdiv; |
| 125 | uint lbc_hz; |
| 126 | sys_info_t sysinfo; |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 127 | |
| 128 | /* |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 129 | * Errata LBC11. |
| 130 | * Fix Local Bus clock glitch when DLL is enabled. |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 131 | * |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 132 | * If localbus freq is < 66Mhz, DLL bypass mode must be used. |
| 133 | * If localbus freq is > 133Mhz, DLL can be safely enabled. |
| 134 | * Between 66 and 133, the DLL is enabled with an override workaround. |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 135 | */ |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 136 | |
| 137 | get_sys_info(&sysinfo); |
| 138 | clkdiv = lbc->lcrr & 0x0f; |
| 139 | lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv; |
| 140 | |
| 141 | if (lbc_hz < 66) { |
| 142 | lbc->lcrr = CFG_LBC_LCRR | 0x80000000; /* DLL Bypass */ |
| 143 | |
| 144 | } else if (lbc_hz >= 133) { |
| 145 | lbc->lcrr = CFG_LBC_LCRR & (~0x80000000); /* DLL Enabled */ |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 146 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 147 | } else { |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 148 | /* |
| 149 | * On REV1 boards, need to change CLKDIV before enable DLL. |
| 150 | * Default CLKDIV is 8, change it to 4 temporarily. |
| 151 | */ |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 152 | uint pvr = get_pvr(); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 153 | uint temp_lbcdll = 0; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 154 | |
| 155 | if (pvr == PVR_85xx_REV1) { |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 156 | /* FIXME: Justify the high bit here. */ |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 157 | lbc->lcrr = 0x10000004; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 158 | } |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 159 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 160 | lbc->lcrr = CFG_LBC_LCRR & (~0x80000000); /* DLL Enabled */ |
| 161 | udelay(200); |
| 162 | |
| 163 | /* |
| 164 | * Sample LBC DLL ctrl reg, upshift it to set the |
| 165 | * override bits. |
| 166 | */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 167 | temp_lbcdll = gur->lbcdllcr; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 168 | gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000); |
| 169 | asm("sync;isync;msync"); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 170 | } |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | |
| 174 | /* |
| 175 | * Initialize SDRAM memory on the Local Bus. |
| 176 | */ |
| 177 | |
| 178 | void |
| 179 | sdram_init(void) |
| 180 | { |
Kumar Gala | 0a7a097 | 2007-11-29 02:10:09 -0600 | [diff] [blame] | 181 | volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR); |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 182 | uint *sdram_addr = (uint *)CFG_LBC_SDRAM_BASE; |
| 183 | |
| 184 | puts(" SDRAM: "); |
| 185 | print_size (CFG_LBC_SDRAM_SIZE * 1024 * 1024, "\n"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * Setup SDRAM Base and Option Registers |
| 189 | */ |
| 190 | lbc->or2 = CFG_OR2_PRELIM; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 191 | lbc->br2 = CFG_BR2_PRELIM; |
| 192 | lbc->lbcr = CFG_LBC_LBCR; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 193 | asm("msync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 194 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 195 | lbc->lsrt = CFG_LBC_LSRT; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 196 | lbc->mrtpr = CFG_LBC_MRTPR; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 197 | asm("sync"); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 198 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 199 | /* |
| 200 | * Configure the SDRAM controller. |
| 201 | */ |
| 202 | lbc->lsdmr = CFG_LBC_LSDMR_1; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 203 | asm("sync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 204 | *sdram_addr = 0xff; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 205 | ppcDcbf((unsigned long) sdram_addr); |
| 206 | udelay(100); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 207 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 208 | lbc->lsdmr = CFG_LBC_LSDMR_2; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 209 | asm("sync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 210 | *sdram_addr = 0xff; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 211 | ppcDcbf((unsigned long) sdram_addr); |
| 212 | udelay(100); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 213 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 214 | lbc->lsdmr = CFG_LBC_LSDMR_3; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 215 | asm("sync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 216 | *sdram_addr = 0xff; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 217 | ppcDcbf((unsigned long) sdram_addr); |
| 218 | udelay(100); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 219 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 220 | lbc->lsdmr = CFG_LBC_LSDMR_4; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 221 | asm("sync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 222 | *sdram_addr = 0xff; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 223 | ppcDcbf((unsigned long) sdram_addr); |
| 224 | udelay(100); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 225 | |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 226 | lbc->lsdmr = CFG_LBC_LSDMR_5; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 227 | asm("sync"); |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 228 | *sdram_addr = 0xff; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 229 | ppcDcbf((unsigned long) sdram_addr); |
| 230 | udelay(100); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | |
| 234 | #if defined(CFG_DRAM_TEST) |
| 235 | int testdram (void) |
| 236 | { |
| 237 | uint *pstart = (uint *) CFG_MEMTEST_START; |
| 238 | uint *pend = (uint *) CFG_MEMTEST_END; |
| 239 | uint *p; |
| 240 | |
| 241 | printf("SDRAM test phase 1:\n"); |
| 242 | for (p = pstart; p < pend; p++) |
| 243 | *p = 0xaaaaaaaa; |
| 244 | |
| 245 | for (p = pstart; p < pend; p++) { |
| 246 | if (*p != 0xaaaaaaaa) { |
| 247 | printf ("SDRAM test fails at: %08x\n", (uint) p); |
| 248 | return 1; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | printf("SDRAM test phase 2:\n"); |
| 253 | for (p = pstart; p < pend; p++) |
| 254 | *p = 0x55555555; |
| 255 | |
| 256 | for (p = pstart; p < pend; p++) { |
| 257 | if (*p != 0x55555555) { |
| 258 | printf ("SDRAM test fails at: %08x\n", (uint) p); |
| 259 | return 1; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | printf("SDRAM test passed.\n"); |
| 264 | return 0; |
| 265 | } |
| 266 | #endif |
| 267 | |
| 268 | |
| 269 | #if !defined(CONFIG_SPD_EEPROM) |
| 270 | /************************************************************************* |
| 271 | * fixed sdram init -- doesn't use serial presence detect. |
| 272 | ************************************************************************/ |
| 273 | long int fixed_sdram (void) |
| 274 | { |
| 275 | #ifndef CFG_RAMBOOT |
Kumar Gala | 0a7a097 | 2007-11-29 02:10:09 -0600 | [diff] [blame] | 276 | volatile ccsr_ddr_t *ddr= (void *)(CFG_MPC85xx_DDR_ADDR); |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 277 | |
| 278 | ddr->cs0_bnds = CFG_DDR_CS0_BNDS; |
| 279 | ddr->cs0_config = CFG_DDR_CS0_CONFIG; |
| 280 | ddr->timing_cfg_1 = CFG_DDR_TIMING_1; |
| 281 | ddr->timing_cfg_2 = CFG_DDR_TIMING_2; |
| 282 | ddr->sdram_mode = CFG_DDR_MODE; |
| 283 | ddr->sdram_interval = CFG_DDR_INTERVAL; |
| 284 | #if defined (CONFIG_DDR_ECC) |
| 285 | ddr->err_disable = 0x0000000D; |
| 286 | ddr->err_sbe = 0x00ff0000; |
| 287 | #endif |
| 288 | asm("sync;isync;msync"); |
| 289 | udelay(500); |
| 290 | #if defined (CONFIG_DDR_ECC) |
| 291 | /* Enable ECC checking */ |
| 292 | ddr->sdram_cfg = (CFG_DDR_CONTROL | 0x20000000); |
| 293 | #else |
| 294 | ddr->sdram_cfg = CFG_DDR_CONTROL; |
| 295 | #endif |
| 296 | asm("sync; isync; msync"); |
| 297 | udelay(500); |
| 298 | #endif |
wdenk | 13eb221 | 2004-07-09 23:27:13 +0000 | [diff] [blame] | 299 | return CFG_SDRAM_SIZE * 1024 * 1024; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 300 | } |
| 301 | #endif /* !defined(CONFIG_SPD_EEPROM) */ |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 302 | |
| 303 | |
| 304 | #if defined(CONFIG_PCI) |
| 305 | /* |
| 306 | * Initialize PCI Devices, report devices found. |
| 307 | */ |
| 308 | |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 309 | |
Matthew McClintock | 8c0da86 | 2006-06-28 10:45:41 -0500 | [diff] [blame] | 310 | static struct pci_controller hose; |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 311 | |
| 312 | #endif /* CONFIG_PCI */ |
| 313 | |
| 314 | |
| 315 | void |
| 316 | pci_init_board(void) |
| 317 | { |
| 318 | #ifdef CONFIG_PCI |
wdenk | 492b9e7 | 2004-08-01 23:02:45 +0000 | [diff] [blame] | 319 | pci_mpc85xx_init(&hose); |
| 320 | #endif /* CONFIG_PCI */ |
| 321 | } |
Matthew McClintock | 148e26a | 2006-06-28 10:43:36 -0500 | [diff] [blame] | 322 | |
| 323 | |
Kumar Gala | 6e57840 | 2007-11-28 22:54:27 -0600 | [diff] [blame] | 324 | #if defined(CONFIG_OF_BOARD_SETUP) |
Matthew McClintock | 148e26a | 2006-06-28 10:43:36 -0500 | [diff] [blame] | 325 | void |
| 326 | ft_board_setup(void *blob, bd_t *bd) |
| 327 | { |
Kumar Gala | 6e57840 | 2007-11-28 22:54:27 -0600 | [diff] [blame] | 328 | int node, tmp[2]; |
| 329 | const char *path; |
Matthew McClintock | 148e26a | 2006-06-28 10:43:36 -0500 | [diff] [blame] | 330 | |
| 331 | ft_cpu_setup(blob, bd); |
| 332 | |
Kumar Gala | 6e57840 | 2007-11-28 22:54:27 -0600 | [diff] [blame] | 333 | node = fdt_path_offset(blob, "/aliases"); |
| 334 | tmp[0] = 0; |
| 335 | if (node >= 0) { |
| 336 | #ifdef CONFIG_PCI |
| 337 | path = fdt_getprop(blob, node, "pci0", NULL); |
| 338 | if (path) { |
| 339 | tmp[1] = hose.last_busno - hose.first_busno; |
| 340 | do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1); |
| 341 | } |
| 342 | #endif |
Matthew McClintock | 148e26a | 2006-06-28 10:43:36 -0500 | [diff] [blame] | 343 | } |
| 344 | } |
| 345 | #endif |