Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Common board functions for OMAP3 based boards. |
| 4 | * |
| 5 | * (C) Copyright 2004-2008 |
| 6 | * Texas Instruments, <www.ti.com> |
| 7 | * |
| 8 | * Author : |
| 9 | * Sunil Kumar <sunilsaini05@gmail.com> |
| 10 | * Shashi Ranjan <shashiranjanmca05@gmail.com> |
| 11 | * |
| 12 | * Derived from Beagle Board and 3430 SDP code by |
| 13 | * Richard Woodruff <r-woodruff2@ti.com> |
| 14 | * Syed Mohammed Khasim <khasim@ti.com> |
| 15 | * |
| 16 | * |
| 17 | * See file CREDITS for list of people who contributed to this |
| 18 | * project. |
| 19 | * |
| 20 | * This program is free software; you can redistribute it and/or |
| 21 | * modify it under the terms of the GNU General Public License as |
| 22 | * published by the Free Software Foundation; either version 2 of |
| 23 | * the License, or (at your option) any later version. |
| 24 | * |
| 25 | * This program is distributed in the hope that it will be useful, |
| 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | * GNU General Public License for more details. |
| 29 | * |
| 30 | * You should have received a copy of the GNU General Public License |
| 31 | * along with this program; if not, write to the Free Software |
| 32 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 33 | * MA 02111-1307 USA |
| 34 | */ |
| 35 | #include <common.h> |
| 36 | #include <asm/io.h> |
| 37 | #include <asm/arch/sys_proto.h> |
| 38 | #include <asm/arch/mem.h> |
Kim, Heung Jun | 3b5ac95 | 2009-06-20 11:02:17 +0200 | [diff] [blame] | 39 | #include <asm/cache.h> |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 40 | #include <asm/armv7.h> |
Aneesh V | 1843eca | 2011-07-31 20:30:53 +0000 | [diff] [blame] | 41 | #include <asm/arch/gpio.h> |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 42 | #include <asm/omap_common.h> |
Tom Rini | ead66c1 | 2011-11-23 05:13:06 +0000 | [diff] [blame^] | 43 | #include <i2c.h> |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 44 | |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 45 | /* Declarations */ |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 46 | extern omap3_sysinfo sysinfo; |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 47 | static void omap3_setup_aux_cr(void); |
| 48 | static void omap3_invalidate_l2_cache_secure(void); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 49 | |
Aneesh V | 9a39088 | 2011-07-21 09:29:29 -0400 | [diff] [blame] | 50 | static const struct gpio_bank gpio_bank_34xx[6] = { |
| 51 | { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX }, |
| 52 | { (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX }, |
| 53 | { (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX }, |
| 54 | { (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX }, |
| 55 | { (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX }, |
| 56 | { (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX }, |
| 57 | }; |
| 58 | |
| 59 | const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx; |
| 60 | |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 61 | #ifdef CONFIG_SPL_BUILD |
| 62 | /* |
| 63 | * We use static variables because global data is not ready yet. |
| 64 | * Initialized data is available in SPL right from the beginning. |
| 65 | * We would not typically need to save these parameters in regular |
| 66 | * U-Boot. This is needed only in SPL at the moment. |
| 67 | */ |
| 68 | u32 omap3_boot_device = BOOT_DEVICE_NAND; |
| 69 | |
| 70 | /* auto boot mode detection is not possible for OMAP3 - hard code */ |
| 71 | u32 omap_boot_mode(void) |
| 72 | { |
| 73 | switch (omap_boot_device()) { |
| 74 | case BOOT_DEVICE_MMC2: |
| 75 | return MMCSD_MODE_RAW; |
| 76 | case BOOT_DEVICE_MMC1: |
| 77 | return MMCSD_MODE_FAT; |
| 78 | break; |
| 79 | case BOOT_DEVICE_NAND: |
| 80 | return NAND_MODE_HW_ECC; |
| 81 | break; |
| 82 | default: |
| 83 | puts("spl: ERROR: unknown device - can't select boot mode\n"); |
| 84 | hang(); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | u32 omap_boot_device(void) |
| 89 | { |
| 90 | return omap3_boot_device; |
| 91 | } |
| 92 | |
Tom Rini | ead66c1 | 2011-11-23 05:13:06 +0000 | [diff] [blame^] | 93 | void spl_board_init(void) |
| 94 | { |
| 95 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
| 96 | } |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 97 | #endif /* CONFIG_SPL_BUILD */ |
| 98 | |
| 99 | |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 100 | /****************************************************************************** |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 101 | * Routine: secure_unlock |
| 102 | * Description: Setup security registers for access |
| 103 | * (GP Device only) |
| 104 | *****************************************************************************/ |
| 105 | void secure_unlock_mem(void) |
| 106 | { |
Dirk Behme | dc7af20 | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 107 | struct pm *pm_rt_ape_base = (struct pm *)PM_RT_APE_BASE_ADDR_ARM; |
| 108 | struct pm *pm_gpmc_base = (struct pm *)PM_GPMC_BASE_ADDR_ARM; |
| 109 | struct pm *pm_ocm_ram_base = (struct pm *)PM_OCM_RAM_BASE_ADDR_ARM; |
| 110 | struct pm *pm_iva2_base = (struct pm *)PM_IVA2_BASE_ADDR_ARM; |
| 111 | struct sms *sms_base = (struct sms *)OMAP34XX_SMS_BASE; |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 112 | |
| 113 | /* Protection Module Register Target APE (PM_RT) */ |
| 114 | writel(UNLOCK_1, &pm_rt_ape_base->req_info_permission_1); |
| 115 | writel(UNLOCK_1, &pm_rt_ape_base->read_permission_0); |
| 116 | writel(UNLOCK_1, &pm_rt_ape_base->wirte_permission_0); |
| 117 | writel(UNLOCK_2, &pm_rt_ape_base->addr_match_1); |
| 118 | |
| 119 | writel(UNLOCK_3, &pm_gpmc_base->req_info_permission_0); |
| 120 | writel(UNLOCK_3, &pm_gpmc_base->read_permission_0); |
| 121 | writel(UNLOCK_3, &pm_gpmc_base->wirte_permission_0); |
| 122 | |
| 123 | writel(UNLOCK_3, &pm_ocm_ram_base->req_info_permission_0); |
| 124 | writel(UNLOCK_3, &pm_ocm_ram_base->read_permission_0); |
| 125 | writel(UNLOCK_3, &pm_ocm_ram_base->wirte_permission_0); |
| 126 | writel(UNLOCK_2, &pm_ocm_ram_base->addr_match_2); |
| 127 | |
| 128 | /* IVA Changes */ |
| 129 | writel(UNLOCK_3, &pm_iva2_base->req_info_permission_0); |
| 130 | writel(UNLOCK_3, &pm_iva2_base->read_permission_0); |
| 131 | writel(UNLOCK_3, &pm_iva2_base->wirte_permission_0); |
| 132 | |
| 133 | /* SDRC region 0 public */ |
| 134 | writel(UNLOCK_1, &sms_base->rg_att0); |
| 135 | } |
| 136 | |
| 137 | /****************************************************************************** |
| 138 | * Routine: secureworld_exit() |
| 139 | * Description: If chip is EMU and boot type is external |
| 140 | * configure secure registers and exit secure world |
| 141 | * general use. |
| 142 | *****************************************************************************/ |
| 143 | void secureworld_exit() |
| 144 | { |
| 145 | unsigned long i; |
| 146 | |
| 147 | /* configrue non-secure access control register */ |
| 148 | __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 2":"=r"(i)); |
| 149 | /* enabling co-processor CP10 and CP11 accesses in NS world */ |
| 150 | __asm__ __volatile__("orr %0, %0, #0xC00":"=r"(i)); |
| 151 | /* |
| 152 | * allow allocation of locked TLBs and L2 lines in NS world |
| 153 | * allow use of PLE registers in NS world also |
| 154 | */ |
| 155 | __asm__ __volatile__("orr %0, %0, #0x70000":"=r"(i)); |
| 156 | __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 2":"=r"(i)); |
| 157 | |
| 158 | /* Enable ASA in ACR register */ |
| 159 | __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i)); |
| 160 | __asm__ __volatile__("orr %0, %0, #0x10":"=r"(i)); |
| 161 | __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i)); |
| 162 | |
| 163 | /* Exiting secure world */ |
| 164 | __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 0":"=r"(i)); |
| 165 | __asm__ __volatile__("orr %0, %0, #0x31":"=r"(i)); |
| 166 | __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i)); |
| 167 | } |
| 168 | |
| 169 | /****************************************************************************** |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 170 | * Routine: try_unlock_sram() |
| 171 | * Description: If chip is GP/EMU(special) type, unlock the SRAM for |
| 172 | * general use. |
| 173 | *****************************************************************************/ |
| 174 | void try_unlock_memory() |
| 175 | { |
| 176 | int mode; |
| 177 | int in_sdram = is_running_in_sdram(); |
| 178 | |
| 179 | /* |
| 180 | * if GP device unlock device SRAM for general use |
| 181 | * secure code breaks for Secure/Emulation device - HS/E/T |
| 182 | */ |
| 183 | mode = get_device_type(); |
| 184 | if (mode == GP_DEVICE) |
| 185 | secure_unlock_mem(); |
| 186 | |
| 187 | /* |
| 188 | * If device is EMU and boot is XIP external booting |
| 189 | * Unlock firewalls and disable L2 and put chip |
| 190 | * out of secure world |
| 191 | * |
| 192 | * Assuming memories are unlocked by the demon who put us in SDRAM |
| 193 | */ |
| 194 | if ((mode <= EMU_DEVICE) && (get_boot_type() == 0x1F) |
| 195 | && (!in_sdram)) { |
| 196 | secure_unlock_mem(); |
| 197 | secureworld_exit(); |
| 198 | } |
| 199 | |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | /****************************************************************************** |
| 204 | * Routine: s_init |
| 205 | * Description: Does early system init of muxing and clocks. |
| 206 | * - Called path is with SRAM stack. |
| 207 | *****************************************************************************/ |
| 208 | void s_init(void) |
| 209 | { |
| 210 | int in_sdram = is_running_in_sdram(); |
| 211 | |
| 212 | watchdog_init(); |
| 213 | |
| 214 | try_unlock_memory(); |
| 215 | |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 216 | /* Errata workarounds */ |
| 217 | omap3_setup_aux_cr(); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 218 | |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 219 | #ifndef CONFIG_SYS_L2CACHE_OFF |
| 220 | /* Invalidate L2-cache from secure mode */ |
| 221 | omap3_invalidate_l2_cache_secure(); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 222 | #endif |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 223 | |
| 224 | set_muxconf_regs(); |
Alexander Holler | 4e333f6 | 2010-12-18 13:24:20 +0100 | [diff] [blame] | 225 | sdelay(100); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 226 | |
| 227 | prcm_init(); |
| 228 | |
| 229 | per_clocks_enable(); |
| 230 | |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 231 | #ifdef CONFIG_SPL_BUILD |
| 232 | preloader_console_init(); |
| 233 | #endif |
| 234 | |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 235 | if (!in_sdram) |
Vaibhav Hiremath | 558d23d | 2010-06-07 15:20:34 -0400 | [diff] [blame] | 236 | mem_init(); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /****************************************************************************** |
| 240 | * Routine: wait_for_command_complete |
| 241 | * Description: Wait for posting to finish on watchdog |
| 242 | *****************************************************************************/ |
Dirk Behme | dc7af20 | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 243 | void wait_for_command_complete(struct watchdog *wd_base) |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 244 | { |
| 245 | int pending = 1; |
| 246 | do { |
| 247 | pending = readl(&wd_base->wwps); |
| 248 | } while (pending); |
| 249 | } |
| 250 | |
| 251 | /****************************************************************************** |
| 252 | * Routine: watchdog_init |
| 253 | * Description: Shut down watch dogs |
| 254 | *****************************************************************************/ |
| 255 | void watchdog_init(void) |
| 256 | { |
Dirk Behme | dc7af20 | 2009-08-08 09:30:21 +0200 | [diff] [blame] | 257 | struct watchdog *wd2_base = (struct watchdog *)WD2_BASE; |
| 258 | struct prcm *prcm_base = (struct prcm *)PRCM_BASE; |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 259 | |
| 260 | /* |
| 261 | * There are 3 watch dogs WD1=Secure, WD2=MPU, WD3=IVA. WD1 is |
| 262 | * either taken care of by ROM (HS/EMU) or not accessible (GP). |
| 263 | * We need to take care of WD2-MPU or take a PRCM reset. WD3 |
| 264 | * should not be running and does not generate a PRCM reset. |
| 265 | */ |
| 266 | |
| 267 | sr32(&prcm_base->fclken_wkup, 5, 1, 1); |
| 268 | sr32(&prcm_base->iclken_wkup, 5, 1, 1); |
| 269 | wait_on_value(ST_WDT2, 0x20, &prcm_base->idlest_wkup, 5); |
| 270 | |
| 271 | writel(WD_UNLOCK1, &wd2_base->wspr); |
| 272 | wait_for_command_complete(wd2_base); |
| 273 | writel(WD_UNLOCK2, &wd2_base->wspr); |
| 274 | } |
| 275 | |
| 276 | /****************************************************************************** |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 277 | * Dummy function to handle errors for EABI incompatibility |
| 278 | *****************************************************************************/ |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 279 | void abort(void) |
| 280 | { |
| 281 | } |
| 282 | |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 283 | #if defined(CONFIG_NAND_OMAP_GPMC) & !defined(CONFIG_SPL_BUILD) |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 284 | /****************************************************************************** |
| 285 | * OMAP3 specific command to switch between NAND HW and SW ecc |
| 286 | *****************************************************************************/ |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 287 | static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 288 | { |
| 289 | if (argc != 2) |
| 290 | goto usage; |
| 291 | if (strncmp(argv[1], "hw", 2) == 0) |
| 292 | omap_nand_switch_ecc(1); |
| 293 | else if (strncmp(argv[1], "sw", 2) == 0) |
| 294 | omap_nand_switch_ecc(0); |
| 295 | else |
| 296 | goto usage; |
| 297 | |
| 298 | return 0; |
| 299 | |
| 300 | usage: |
Sanjeev Premi | 15af998 | 2009-04-03 14:00:07 +0530 | [diff] [blame] | 301 | printf ("Usage: nandecc %s\n", cmdtp->usage); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 302 | return 1; |
| 303 | } |
| 304 | |
| 305 | U_BOOT_CMD( |
| 306 | nandecc, 2, 1, do_switch_ecc, |
Robert P. J. Day | 3ea16c3 | 2009-11-17 07:30:23 -0500 | [diff] [blame] | 307 | "switch OMAP3 NAND ECC calculation algorithm", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 308 | "[hw/sw] - Switch between NAND hardware (hw) or software (sw) ecc algorithm" |
| 309 | ); |
Dirk Behme | e0e49fe | 2008-12-14 09:47:15 +0100 | [diff] [blame] | 310 | |
Simon Schwarz | 992dcf7 | 2011-09-14 15:29:26 -0400 | [diff] [blame] | 311 | #endif /* CONFIG_NAND_OMAP_GPMC & !CONFIG_SPL_BUILD */ |
Sanjeev Premi | e32ef2e | 2009-04-27 21:27:27 +0530 | [diff] [blame] | 312 | |
| 313 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 314 | /** |
| 315 | * Print board information |
| 316 | */ |
| 317 | int checkboard (void) |
| 318 | { |
| 319 | char *mem_s ; |
| 320 | |
| 321 | if (is_mem_sdr()) |
| 322 | mem_s = "mSDR"; |
| 323 | else |
| 324 | mem_s = "LPDDR"; |
| 325 | |
| 326 | printf("%s + %s/%s\n", sysinfo.board_string, mem_s, |
| 327 | sysinfo.nand_string); |
| 328 | |
| 329 | return 0; |
| 330 | } |
| 331 | #endif /* CONFIG_DISPLAY_BOARDINFO */ |
Aneesh V | d16dd01 | 2011-06-16 23:30:53 +0000 | [diff] [blame] | 332 | |
| 333 | static void omap3_emu_romcode_call(u32 service_id, u32 *parameters) |
| 334 | { |
| 335 | u32 i, num_params = *parameters; |
| 336 | u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA; |
| 337 | |
| 338 | /* |
| 339 | * copy the parameters to an un-cached area to avoid coherency |
| 340 | * issues |
| 341 | */ |
| 342 | for (i = 0; i < num_params; i++) { |
| 343 | __raw_writel(*parameters, sram_scratch_space); |
| 344 | parameters++; |
| 345 | sram_scratch_space++; |
| 346 | } |
| 347 | |
| 348 | /* Now make the PPA call */ |
| 349 | do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA); |
| 350 | } |
| 351 | |
| 352 | static void omap3_update_aux_cr_secure(u32 set_bits, u32 clear_bits) |
| 353 | { |
| 354 | u32 acr; |
| 355 | |
| 356 | /* Read ACR */ |
| 357 | asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); |
| 358 | acr &= ~clear_bits; |
| 359 | acr |= set_bits; |
| 360 | |
| 361 | if (get_device_type() == GP_DEVICE) { |
| 362 | omap3_gp_romcode_call(OMAP3_GP_ROMCODE_API_WRITE_ACR, |
| 363 | acr); |
| 364 | } else { |
| 365 | struct emu_hal_params emu_romcode_params; |
| 366 | emu_romcode_params.num_params = 1; |
| 367 | emu_romcode_params.param1 = acr; |
| 368 | omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR, |
| 369 | (u32 *)&emu_romcode_params); |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits) |
| 374 | { |
| 375 | u32 acr; |
| 376 | |
| 377 | /* Read ACR */ |
| 378 | asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr)); |
| 379 | acr &= ~clear_bits; |
| 380 | acr |= set_bits; |
| 381 | |
| 382 | /* Write ACR - affects non-secure banked bits */ |
| 383 | asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr)); |
| 384 | } |
| 385 | |
| 386 | static void omap3_setup_aux_cr(void) |
| 387 | { |
| 388 | /* Workaround for Cortex-A8 errata: #454179 #430973 |
| 389 | * Set "IBE" bit |
| 390 | * Set "Disable Brach Size Mispredicts" bit |
| 391 | * Workaround for erratum #621766 |
| 392 | * Enable L1NEON bit |
| 393 | * ACR |= (IBE | DBSM | L1NEON) => ACR |= 0xE0 |
| 394 | */ |
| 395 | omap3_update_aux_cr_secure(0xE0, 0); |
| 396 | } |
| 397 | |
| 398 | #ifndef CONFIG_SYS_L2CACHE_OFF |
| 399 | /* Invalidate the entire L2 cache from secure mode */ |
| 400 | static void omap3_invalidate_l2_cache_secure(void) |
| 401 | { |
| 402 | if (get_device_type() == GP_DEVICE) { |
| 403 | omap3_gp_romcode_call(OMAP3_GP_ROMCODE_API_L2_INVAL, |
| 404 | 0); |
| 405 | } else { |
| 406 | struct emu_hal_params emu_romcode_params; |
| 407 | emu_romcode_params.num_params = 1; |
| 408 | emu_romcode_params.param1 = 0; |
| 409 | omap3_emu_romcode_call(OMAP3_EMU_HAL_API_L2_INVAL, |
| 410 | (u32 *)&emu_romcode_params); |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | void v7_outer_cache_enable(void) |
| 415 | { |
| 416 | /* Set L2EN */ |
| 417 | omap3_update_aux_cr_secure(0x2, 0); |
| 418 | |
| 419 | /* |
| 420 | * On some revisions L2EN bit is banked on some revisions it's not |
| 421 | * No harm in setting both banked bits(in fact this is required |
| 422 | * by an erratum) |
| 423 | */ |
| 424 | omap3_update_aux_cr(0x2, 0); |
| 425 | } |
| 426 | |
| 427 | void v7_outer_cache_disable(void) |
| 428 | { |
| 429 | /* Clear L2EN */ |
| 430 | omap3_update_aux_cr_secure(0, 0x2); |
| 431 | |
| 432 | /* |
| 433 | * On some revisions L2EN bit is banked on some revisions it's not |
| 434 | * No harm in clearing both banked bits(in fact this is required |
| 435 | * by an erratum) |
| 436 | */ |
| 437 | omap3_update_aux_cr(0, 0x2); |
| 438 | } |
| 439 | #endif |
Aneesh V | 572134b | 2011-08-11 04:35:43 +0000 | [diff] [blame] | 440 | |
| 441 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 442 | void enable_caches(void) |
| 443 | { |
| 444 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 445 | dcache_enable(); |
| 446 | } |
| 447 | #endif |