wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | /* |
| 25 | * evb64260.c - main board support/init for the Galileo Eval board. |
| 26 | */ |
| 27 | |
| 28 | #include <common.h> |
| 29 | #include <74xx_7xx.h> |
| 30 | #include <galileo/memory.h> |
| 31 | #include <galileo/pci.h> |
| 32 | #include <galileo/gt64260R.h> |
| 33 | #include <net.h> |
Ben Warren | 9d48ec2 | 2008-08-31 10:13:34 -0700 | [diff] [blame] | 34 | #include <netdev.h> |
Wolfgang Denk | ebfa188 | 2011-11-09 09:28:57 +0000 | [diff] [blame] | 35 | #include <linux/compiler.h> |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 36 | |
| 37 | #include <asm/io.h> |
| 38 | #include "eth.h" |
| 39 | #include "mpsc.h" |
| 40 | #include "i2c.h" |
| 41 | #include "64260.h" |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 42 | |
| 43 | DECLARE_GLOBAL_DATA_PTR; |
| 44 | |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 45 | #ifdef CONFIG_ZUMA_V2 |
| 46 | extern void zuma_mbox_init(void); |
| 47 | #endif |
| 48 | |
| 49 | #undef DEBUG |
| 50 | #define MAP_PCI |
| 51 | |
| 52 | #ifdef DEBUG |
| 53 | #define DP(x) x |
| 54 | #else |
| 55 | #define DP(x) |
| 56 | #endif |
| 57 | |
| 58 | /* ------------------------------------------------------------------------- */ |
| 59 | |
| 60 | /* this is the current GT register space location */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 61 | /* it starts at CONFIG_SYS_DFL_GT_REGS but moves later to CONFIG_SYS_GT_REGS */ |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 62 | |
| 63 | /* Unfortunately, we cant change it while we are in flash, so we initialize it |
| 64 | * to the "final" value. This means that any debug_led calls before |
wdenk | da55c6e | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 65 | * board_early_init_f wont work right (like in cpu_init_f). |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 66 | * See also my_remap_gt_regs below. (NTL) |
| 67 | */ |
| 68 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | unsigned int INTERNAL_REG_BASE_ADDR = CONFIG_SYS_GT_REGS; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 70 | |
| 71 | /* ------------------------------------------------------------------------- */ |
| 72 | |
| 73 | /* |
| 74 | * This is a version of the GT register space remapping function that |
| 75 | * doesn't touch globals (meaning, it's ok to run from flash.) |
| 76 | * |
| 77 | * Unfortunately, this has the side effect that a writable |
| 78 | * INTERNAL_REG_BASE_ADDR is impossible. Oh well. |
| 79 | */ |
| 80 | |
| 81 | void |
| 82 | my_remap_gt_regs(u32 cur_loc, u32 new_loc) |
| 83 | { |
| 84 | u32 temp; |
| 85 | |
| 86 | /* check and see if it's already moved */ |
| 87 | temp = in_le32((u32 *)(new_loc + INTERNAL_SPACE_DECODE)); |
| 88 | if ((temp & 0xffff) == new_loc >> 20) |
| 89 | return; |
| 90 | |
| 91 | temp = (in_le32((u32 *)(cur_loc + INTERNAL_SPACE_DECODE)) & |
| 92 | 0xffff0000) | (new_loc >> 20); |
| 93 | |
| 94 | out_le32((u32 *)(cur_loc + INTERNAL_SPACE_DECODE), temp); |
| 95 | |
| 96 | while (GTREGREAD(INTERNAL_SPACE_DECODE) != temp); |
| 97 | } |
| 98 | |
| 99 | static void |
| 100 | gt_pci_config(void) |
| 101 | { |
| 102 | /* move PCI stuff out of the way - NTL */ |
| 103 | /* map PCI Host 0 */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 104 | pciMapSpace(PCI_HOST0, PCI_REGION0, CONFIG_SYS_PCI0_0_MEM_SPACE, |
| 105 | CONFIG_SYS_PCI0_0_MEM_SPACE, CONFIG_SYS_PCI0_MEM_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 106 | |
| 107 | pciMapSpace(PCI_HOST0, PCI_REGION1, 0, 0, 0); |
| 108 | pciMapSpace(PCI_HOST0, PCI_REGION2, 0, 0, 0); |
| 109 | pciMapSpace(PCI_HOST0, PCI_REGION3, 0, 0, 0); |
| 110 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 111 | pciMapSpace(PCI_HOST0, PCI_IO, CONFIG_SYS_PCI0_IO_SPACE_PCI, |
| 112 | CONFIG_SYS_PCI0_IO_SPACE, CONFIG_SYS_PCI0_IO_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 113 | |
| 114 | /* map PCI Host 1 */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 115 | pciMapSpace(PCI_HOST1, PCI_REGION0, CONFIG_SYS_PCI1_0_MEM_SPACE, |
| 116 | CONFIG_SYS_PCI1_0_MEM_SPACE, CONFIG_SYS_PCI1_MEM_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 117 | |
| 118 | pciMapSpace(PCI_HOST1, PCI_REGION1, 0, 0, 0); |
| 119 | pciMapSpace(PCI_HOST1, PCI_REGION2, 0, 0, 0); |
| 120 | pciMapSpace(PCI_HOST1, PCI_REGION3, 0, 0, 0); |
| 121 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 122 | pciMapSpace(PCI_HOST1, PCI_IO, CONFIG_SYS_PCI1_IO_SPACE_PCI, |
| 123 | CONFIG_SYS_PCI1_IO_SPACE, CONFIG_SYS_PCI1_IO_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 124 | |
| 125 | /* PCI interface settings */ |
| 126 | GT_REG_WRITE(PCI_0TIMEOUT_RETRY, 0xffff); |
| 127 | GT_REG_WRITE(PCI_1TIMEOUT_RETRY, 0xffff); |
| 128 | GT_REG_WRITE(PCI_0BASE_ADDRESS_REGISTERS_ENABLE, 0xfffff80e); |
| 129 | GT_REG_WRITE(PCI_1BASE_ADDRESS_REGISTERS_ENABLE, 0xfffff80e); |
| 130 | |
| 131 | |
| 132 | } |
| 133 | |
| 134 | /* Setup CPU interface paramaters */ |
| 135 | static void |
| 136 | gt_cpu_config(void) |
| 137 | { |
| 138 | cpu_t cpu = get_cpu_type(); |
| 139 | ulong tmp; |
| 140 | |
| 141 | /* cpu configuration register */ |
| 142 | tmp = GTREGREAD(CPU_CONFIGURATION); |
| 143 | |
| 144 | /* set the AACK delay bit |
| 145 | * see Res#14 */ |
| 146 | tmp |= CPU_CONF_AACK_DELAY; |
| 147 | tmp &= ~CPU_CONF_AACK_DELAY_2; /* New RGF */ |
| 148 | |
| 149 | /* Galileo claims this is necessary for all busses >= 100 MHz */ |
| 150 | tmp |= CPU_CONF_FAST_CLK; |
| 151 | |
| 152 | if (cpu == CPU_750CX) { |
| 153 | tmp &= ~CPU_CONF_DP_VALID; /* Safer, needed for CXe. RGF */ |
| 154 | tmp &= ~CPU_CONF_AP_VALID; |
| 155 | } else { |
| 156 | tmp |= CPU_CONF_DP_VALID; |
| 157 | tmp |= CPU_CONF_AP_VALID; |
| 158 | } |
| 159 | |
| 160 | /* this only works with the MPX bus */ |
| 161 | tmp &= ~CPU_CONF_RD_OOO; /* Safer RGF */ |
| 162 | tmp |= CPU_CONF_PIPELINE; |
| 163 | tmp |= CPU_CONF_TA_DELAY; |
| 164 | |
| 165 | GT_REG_WRITE(CPU_CONFIGURATION, tmp); |
| 166 | |
| 167 | /* CPU master control register */ |
| 168 | tmp = GTREGREAD(CPU_MASTER_CONTROL); |
| 169 | |
| 170 | tmp |= CPU_MAST_CTL_ARB_EN; |
| 171 | |
| 172 | if ((cpu == CPU_7400) || |
| 173 | (cpu == CPU_7410) || |
| 174 | (cpu == CPU_7450)) { |
| 175 | |
| 176 | tmp |= CPU_MAST_CTL_CLEAN_BLK; |
| 177 | tmp |= CPU_MAST_CTL_FLUSH_BLK; |
| 178 | |
| 179 | } else { |
| 180 | /* cleanblock must be cleared for CPUs |
| 181 | * that do not support this command |
| 182 | * see Res#1 */ |
| 183 | tmp &= ~CPU_MAST_CTL_CLEAN_BLK; |
| 184 | tmp &= ~CPU_MAST_CTL_FLUSH_BLK; |
| 185 | } |
| 186 | GT_REG_WRITE(CPU_MASTER_CONTROL, tmp); |
| 187 | } |
| 188 | |
| 189 | /* |
wdenk | da55c6e | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 190 | * board_early_init_f. |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 191 | * |
| 192 | * set up gal. device mappings, etc. |
| 193 | */ |
wdenk | da55c6e | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 194 | int board_early_init_f (void) |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 195 | { |
| 196 | uchar sram_boot = 0; |
| 197 | |
| 198 | /* |
| 199 | * set up the GT the way the kernel wants it |
| 200 | * the call to move the GT register space will obviously |
| 201 | * fail if it has already been done, but we're going to assume |
| 202 | * that if it's not at the power-on location, it's where we put |
| 203 | * it last time. (huber) |
| 204 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 205 | my_remap_gt_regs(CONFIG_SYS_DFL_GT_REGS, CONFIG_SYS_GT_REGS); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 206 | |
| 207 | gt_pci_config(); |
| 208 | |
| 209 | /* mask all external interrupt sources */ |
| 210 | GT_REG_WRITE(CPU_INTERRUPT_MASK_REGISTER_LOW, 0); |
| 211 | GT_REG_WRITE(CPU_INTERRUPT_MASK_REGISTER_HIGH, 0); |
| 212 | GT_REG_WRITE(PCI_0INTERRUPT_CAUSE_MASK_REGISTER_LOW, 0); |
| 213 | GT_REG_WRITE(PCI_0INTERRUPT_CAUSE_MASK_REGISTER_HIGH, 0); |
| 214 | GT_REG_WRITE(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_LOW, 0); |
| 215 | GT_REG_WRITE(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH, 0); |
| 216 | GT_REG_WRITE(CPU_INT_0_MASK, 0); |
| 217 | GT_REG_WRITE(CPU_INT_1_MASK, 0); |
| 218 | GT_REG_WRITE(CPU_INT_2_MASK, 0); |
| 219 | GT_REG_WRITE(CPU_INT_3_MASK, 0); |
| 220 | |
| 221 | /* now, onto the configuration */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 222 | GT_REG_WRITE(SDRAM_CONFIGURATION, CONFIG_SYS_SDRAM_CONFIG); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 223 | |
| 224 | /* ----- DEVICE BUS SETTINGS ------ */ |
| 225 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 226 | /* |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 227 | * EVB |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 228 | * 0 - SRAM |
| 229 | * 1 - RTC |
| 230 | * 2 - UART |
| 231 | * 3 - Flash |
| 232 | * boot - BootCS |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 233 | * |
| 234 | * Zuma |
| 235 | * 0 - Flash |
| 236 | * boot - BootCS |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 237 | */ |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 238 | |
| 239 | /* |
| 240 | * the dual 7450 module requires burst access to the boot |
| 241 | * device, so the serial rom copies the boot device to the |
| 242 | * on-board sram on the eval board, and updates the correct |
| 243 | * registers to boot from the sram. (device0) |
| 244 | */ |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 245 | #if defined(CONFIG_ZUMA_V2) || defined(CONFIG_P3G4) |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 246 | /* Zuma has no SRAM */ |
| 247 | sram_boot = 0; |
| 248 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 249 | if (memoryGetDeviceBaseAddress(DEVICE0) && 0xfff00000 == CONFIG_SYS_MONITOR_BASE) |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 250 | sram_boot = 1; |
| 251 | #endif |
| 252 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 253 | memoryMapDeviceSpace(DEVICE0, CONFIG_SYS_DEV0_SPACE, CONFIG_SYS_DEV0_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 254 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 255 | memoryMapDeviceSpace(DEVICE1, CONFIG_SYS_DEV1_SPACE, CONFIG_SYS_DEV1_SIZE); |
| 256 | memoryMapDeviceSpace(DEVICE2, CONFIG_SYS_DEV2_SPACE, CONFIG_SYS_DEV2_SIZE); |
| 257 | memoryMapDeviceSpace(DEVICE3, CONFIG_SYS_DEV3_SPACE, CONFIG_SYS_DEV3_SIZE); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 258 | |
| 259 | /* configure device timing */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 260 | #ifdef CONFIG_SYS_DEV0_PAR |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 261 | if (!sram_boot) |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 262 | GT_REG_WRITE(DEVICE_BANK0PARAMETERS, CONFIG_SYS_DEV0_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 263 | #endif |
| 264 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 265 | #ifdef CONFIG_SYS_DEV1_PAR |
| 266 | GT_REG_WRITE(DEVICE_BANK1PARAMETERS, CONFIG_SYS_DEV1_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 267 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 268 | #ifdef CONFIG_SYS_DEV2_PAR |
| 269 | GT_REG_WRITE(DEVICE_BANK2PARAMETERS, CONFIG_SYS_DEV2_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 270 | #endif |
| 271 | |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 272 | #ifdef CONFIG_EVB64260 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 273 | #ifdef CONFIG_SYS_32BIT_BOOT_PAR |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 274 | /* detect if we are booting from the 32 bit flash */ |
| 275 | if (GTREGREAD(DEVICE_BOOT_BANK_PARAMETERS) & (0x3 << 20)) { |
| 276 | /* 32 bit boot flash */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 277 | GT_REG_WRITE(DEVICE_BANK3PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR); |
| 278 | GT_REG_WRITE(DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_32BIT_BOOT_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 279 | } else { |
| 280 | /* 8 bit boot flash */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 281 | GT_REG_WRITE(DEVICE_BANK3PARAMETERS, CONFIG_SYS_32BIT_BOOT_PAR); |
| 282 | GT_REG_WRITE(DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 283 | } |
| 284 | #else |
| 285 | /* 8 bit boot flash only */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 286 | GT_REG_WRITE(DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_8BIT_BOOT_PAR); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 287 | #endif |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 288 | #else /* CONFIG_EVB64260 not defined */ |
| 289 | /* We are booting from 16-bit flash. |
| 290 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 291 | GT_REG_WRITE(DEVICE_BOOT_BANK_PARAMETERS, CONFIG_SYS_16BIT_BOOT_PAR); |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 292 | #endif |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 293 | |
| 294 | gt_cpu_config(); |
| 295 | |
| 296 | /* MPP setup */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 297 | GT_REG_WRITE(MPP_CONTROL0, CONFIG_SYS_MPP_CONTROL_0); |
| 298 | GT_REG_WRITE(MPP_CONTROL1, CONFIG_SYS_MPP_CONTROL_1); |
| 299 | GT_REG_WRITE(MPP_CONTROL2, CONFIG_SYS_MPP_CONTROL_2); |
| 300 | GT_REG_WRITE(MPP_CONTROL3, CONFIG_SYS_MPP_CONTROL_3); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 301 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 302 | GT_REG_WRITE(GPP_LEVEL_CONTROL, CONFIG_SYS_GPP_LEVEL_CONTROL); |
| 303 | GT_REG_WRITE(SERIAL_PORT_MULTIPLEX, CONFIG_SYS_SERIAL_PORT_MUX); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 304 | |
| 305 | return 0; |
| 306 | } |
| 307 | |
| 308 | /* various things to do after relocation */ |
| 309 | |
| 310 | int misc_init_r (void) |
| 311 | { |
| 312 | icache_enable(); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 313 | #ifdef CONFIG_SYS_L2 |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 314 | l2cache_enable(); |
| 315 | #endif |
| 316 | |
| 317 | #ifdef CONFIG_MPSC |
| 318 | mpsc_init2(); |
| 319 | #endif |
| 320 | |
| 321 | #ifdef CONFIG_ZUMA_V2 |
| 322 | zuma_mbox_init(); |
| 323 | #endif |
| 324 | return (0); |
| 325 | } |
| 326 | |
| 327 | void |
wdenk | b666c8f | 2003-03-06 00:58:30 +0000 | [diff] [blame] | 328 | after_reloc(ulong dest_addr) |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 329 | { |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 330 | /* check to see if we booted from the sram. If so, move things |
| 331 | * back to the way they should be. (we're running from main |
| 332 | * memory at this point now */ |
| 333 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 334 | if (memoryGetDeviceBaseAddress(DEVICE0) == CONFIG_SYS_MONITOR_BASE) { |
| 335 | memoryMapDeviceSpace(DEVICE0, CONFIG_SYS_DEV0_SPACE, CONFIG_SYS_DEV0_SIZE); |
| 336 | memoryMapDeviceSpace(BOOT_DEVICE, CONFIG_SYS_FLASH_BASE, _1M); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | /* now, jump to the main U-Boot board init code */ |
wdenk | 874ac26 | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 340 | board_init_r ((gd_t *)gd, dest_addr); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 341 | |
| 342 | /* NOTREACHED */ |
| 343 | } |
| 344 | |
| 345 | /* ------------------------------------------------------------------------- */ |
| 346 | |
| 347 | /* |
| 348 | * Check Board Identity: |
| 349 | */ |
| 350 | |
| 351 | int |
| 352 | checkboard (void) |
| 353 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 354 | puts ("Board: " CONFIG_SYS_BOARD_NAME "\n"); |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 355 | return (0); |
| 356 | } |
| 357 | |
| 358 | /* utility functions */ |
| 359 | void |
| 360 | debug_led(int led, int mode) |
| 361 | { |
wdenk | 232fe0b | 2003-09-02 22:48:03 +0000 | [diff] [blame] | 362 | #if !defined(CONFIG_ZUMA_V2) && !defined(CONFIG_P3G4) |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 363 | volatile int *addr = NULL; |
Wolfgang Denk | ebfa188 | 2011-11-09 09:28:57 +0000 | [diff] [blame] | 364 | __maybe_unused int dummy; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 365 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 366 | if (mode == 1) { |
| 367 | switch (led) { |
| 368 | case 0: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 369 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x08000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 370 | break; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 371 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 372 | case 1: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 373 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x0c000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 374 | break; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 375 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 376 | case 2: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 377 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x10000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 378 | break; |
| 379 | } |
| 380 | } else if (mode == 0) { |
| 381 | switch (led) { |
| 382 | case 0: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 383 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x14000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 384 | break; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 385 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 386 | case 1: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 387 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x18000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 388 | break; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 389 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 390 | case 2: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 391 | addr = (int *)((unsigned int)CONFIG_SYS_DEV1_SPACE | 0x1c000); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 392 | break; |
| 393 | } |
| 394 | } |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 395 | WRITE_CHAR(addr, 0); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 396 | dummy = *addr; |
wdenk | 7ebf744 | 2002-11-02 23:17:16 +0000 | [diff] [blame] | 397 | #endif /* CONFIG_ZUMA_V2 */ |
| 398 | } |
| 399 | |
| 400 | void |
| 401 | display_mem_map(void) |
| 402 | { |
| 403 | int i,j; |
| 404 | unsigned int base,size,width; |
| 405 | /* SDRAM */ |
| 406 | printf("SDRAM\n"); |
| 407 | for(i=0;i<=BANK3;i++) { |
| 408 | base = memoryGetBankBaseAddress(i); |
| 409 | size = memoryGetBankSize(i); |
| 410 | if(size !=0) |
| 411 | { |
| 412 | printf("BANK%d: base - 0x%08x\tsize - %dM bytes\n",i,base,size>>20); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | /* CPU's PCI windows */ |
| 417 | for(i=0;i<=PCI_HOST1;i++) { |
| 418 | printf("\nCPU's PCI %d windows\n", i); |
| 419 | base=pciGetSpaceBase(i,PCI_IO); |
| 420 | size=pciGetSpaceSize(i,PCI_IO); |
| 421 | printf(" IO: base - 0x%08x\tsize - %dM bytes\n",base,size>>20); |
| 422 | for(j=0;j<=PCI_REGION3;j++) { |
| 423 | base = pciGetSpaceBase(i,j); |
| 424 | size = pciGetSpaceSize(i,j); |
| 425 | printf("MEMORY %d: base - 0x%08x\tsize - %dM bytes\n",j,base, |
| 426 | size>>20); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | /* Devices */ |
| 431 | printf("\nDEVICES\n"); |
| 432 | for(i=0;i<=DEVICE3;i++) { |
| 433 | base = memoryGetDeviceBaseAddress(i); |
| 434 | size = memoryGetDeviceSize(i); |
| 435 | width= memoryGetDeviceWidth(i) * 8; |
| 436 | printf("DEV %d: base - 0x%08x\tsize - %dM bytes\twidth - %d bits\n", |
| 437 | i, base, size>>20, width); |
| 438 | } |
| 439 | |
| 440 | /* Bootrom */ |
| 441 | base = memoryGetDeviceBaseAddress(BOOT_DEVICE); /* Boot */ |
| 442 | size = memoryGetDeviceSize(BOOT_DEVICE); |
| 443 | width= memoryGetDeviceWidth(BOOT_DEVICE) * 8; |
| 444 | printf(" BOOT: base - 0x%08x\tsize - %dM bytes\twidth - %d bits\n", |
| 445 | base, size>>20, width); |
| 446 | } |
Ben Warren | 9d48ec2 | 2008-08-31 10:13:34 -0700 | [diff] [blame] | 447 | |
| 448 | int board_eth_init(bd_t *bis) |
| 449 | { |
| 450 | gt6426x_eth_initialize(bis); |
| 451 | return 0; |
| 452 | } |