blob: dd53b207f850e2fbe2c5064df414f4ed77457d5a [file] [log] [blame]
Dirk Behme91eee542008-12-14 09:47:15 +01001/*
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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020017 * SPDX-License-Identifier: GPL-2.0+
Dirk Behme91eee542008-12-14 09:47:15 +010018 */
19#include <common.h>
Simon Glassb3f4ca12014-10-22 21:37:15 -060020#include <dm.h>
Jeroen Hofsteebf855022014-10-08 22:57:57 +020021#include <mmc.h>
Tom Rini47f7bca2012-08-13 12:03:19 -070022#include <spl.h>
Dirk Behme91eee542008-12-14 09:47:15 +010023#include <asm/io.h>
24#include <asm/arch/sys_proto.h>
25#include <asm/arch/mem.h>
Kim, Heung Jun06e758e2009-06-20 11:02:17 +020026#include <asm/cache.h>
Aneesh V45bf0582011-06-16 23:30:53 +000027#include <asm/armv7.h>
Simon Glassb3f4ca12014-10-22 21:37:15 -060028#include <asm/gpio.h>
Simon Schwarzbb085b82011-09-14 15:29:26 -040029#include <asm/omap_common.h>
Tom Rinif0881252012-08-14 10:25:15 -070030#include <asm/arch/mmc_host_def.h>
Tom Riniee08a822011-11-23 05:13:06 +000031#include <i2c.h>
Tom Rini8a87a3d2012-04-13 12:20:03 +000032#include <linux/compiler.h>
Dirk Behme91eee542008-12-14 09:47:15 +010033
Tom Rini6507f132012-08-22 15:31:05 -070034DECLARE_GLOBAL_DATA_PTR;
35
Aneesh V45bf0582011-06-16 23:30:53 +000036/* Declarations */
Dirk Behme91eee542008-12-14 09:47:15 +010037extern omap3_sysinfo sysinfo;
Aneesh V45bf0582011-06-16 23:30:53 +000038static void omap3_setup_aux_cr(void);
Tom Rini57f588b2012-10-30 22:23:28 -070039#ifndef CONFIG_SYS_L2CACHE_OFF
Aneesh V45bf0582011-06-16 23:30:53 +000040static void omap3_invalidate_l2_cache_secure(void);
Tom Rini57f588b2012-10-30 22:23:28 -070041#endif
Dirk Behme91eee542008-12-14 09:47:15 +010042
Simon Glassb3f4ca12014-10-22 21:37:15 -060043#ifdef CONFIG_DM_GPIO
44static const struct omap_gpio_platdata omap34xx_gpio[] = {
45 { 0, OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
46 { 1, OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
47 { 2, OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
48 { 3, OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
49 { 4, OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
50 { 5, OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
51};
52
53U_BOOT_DEVICES(am33xx_gpios) = {
54 { "gpio_omap", &omap34xx_gpio[0] },
55 { "gpio_omap", &omap34xx_gpio[1] },
56 { "gpio_omap", &omap34xx_gpio[2] },
57 { "gpio_omap", &omap34xx_gpio[3] },
58 { "gpio_omap", &omap34xx_gpio[4] },
59 { "gpio_omap", &omap34xx_gpio[5] },
60};
61
62#else
63
Aneesh V25223a62011-07-21 09:29:29 -040064static const struct gpio_bank gpio_bank_34xx[6] = {
65 { (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
66 { (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
67 { (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
68 { (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
69 { (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
70 { (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
71};
72
73const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
74
Simon Glassb3f4ca12014-10-22 21:37:15 -060075#endif
76
Simon Schwarzbb085b82011-09-14 15:29:26 -040077#ifdef CONFIG_SPL_BUILD
78/*
79* We use static variables because global data is not ready yet.
80* Initialized data is available in SPL right from the beginning.
81* We would not typically need to save these parameters in regular
82* U-Boot. This is needed only in SPL at the moment.
83*/
84u32 omap3_boot_device = BOOT_DEVICE_NAND;
85
86/* auto boot mode detection is not possible for OMAP3 - hard code */
Tom Rini37189a12012-08-14 09:19:44 -070087u32 spl_boot_mode(void)
Simon Schwarzbb085b82011-09-14 15:29:26 -040088{
Tom Rini8e1b8362012-08-13 12:53:23 -070089 switch (spl_boot_device()) {
Simon Schwarzbb085b82011-09-14 15:29:26 -040090 case BOOT_DEVICE_MMC2:
91 return MMCSD_MODE_RAW;
92 case BOOT_DEVICE_MMC1:
Guillaume GARDET205b4f32014-10-15 17:53:11 +020093 return MMCSD_MODE_FS;
Simon Schwarzbb085b82011-09-14 15:29:26 -040094 break;
Simon Schwarzbb085b82011-09-14 15:29:26 -040095 default:
96 puts("spl: ERROR: unknown device - can't select boot mode\n");
97 hang();
98 }
99}
100
Tom Rini8e1b8362012-08-13 12:53:23 -0700101u32 spl_boot_device(void)
Simon Schwarzbb085b82011-09-14 15:29:26 -0400102{
103 return omap3_boot_device;
104}
105
Tom Rinif0881252012-08-14 10:25:15 -0700106int board_mmc_init(bd_t *bis)
107{
108 switch (spl_boot_device()) {
109 case BOOT_DEVICE_MMC1:
Nikita Kiryanove3913f52012-12-03 02:19:47 +0000110 omap_mmc_init(0, 0, 0, -1, -1);
Tom Rinif0881252012-08-14 10:25:15 -0700111 break;
112 case BOOT_DEVICE_MMC2:
113 case BOOT_DEVICE_MMC2_2:
Nikita Kiryanove3913f52012-12-03 02:19:47 +0000114 omap_mmc_init(1, 0, 0, -1, -1);
Tom Rinif0881252012-08-14 10:25:15 -0700115 break;
116 }
117 return 0;
118}
119
Tom Riniee08a822011-11-23 05:13:06 +0000120void spl_board_init(void)
121{
Tom Rinia6b541b2014-12-19 16:53:24 -0500122 preloader_console_init();
Enric Balletbo i Serrab51a5e32013-02-07 23:14:49 +0000123#if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT)
Tom Rinid7cb93b2012-08-14 12:26:08 -0700124 gpmc_init();
125#endif
Stefano Babicda521382012-03-15 04:01:42 +0000126#ifdef CONFIG_SPL_I2C_SUPPORT
Heiko Schocher6789e842013-10-22 11:03:18 +0200127 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
Stefano Babicda521382012-03-15 04:01:42 +0000128#endif
Tom Riniee08a822011-11-23 05:13:06 +0000129}
Simon Schwarzbb085b82011-09-14 15:29:26 -0400130#endif /* CONFIG_SPL_BUILD */
131
132
Dirk Behme91eee542008-12-14 09:47:15 +0100133/******************************************************************************
Dirk Behme91eee542008-12-14 09:47:15 +0100134 * Routine: secure_unlock
135 * Description: Setup security registers for access
136 * (GP Device only)
137 *****************************************************************************/
138void secure_unlock_mem(void)
139{
Dirk Behme97a099e2009-08-08 09:30:21 +0200140 struct pm *pm_rt_ape_base = (struct pm *)PM_RT_APE_BASE_ADDR_ARM;
141 struct pm *pm_gpmc_base = (struct pm *)PM_GPMC_BASE_ADDR_ARM;
142 struct pm *pm_ocm_ram_base = (struct pm *)PM_OCM_RAM_BASE_ADDR_ARM;
143 struct pm *pm_iva2_base = (struct pm *)PM_IVA2_BASE_ADDR_ARM;
144 struct sms *sms_base = (struct sms *)OMAP34XX_SMS_BASE;
Dirk Behme91eee542008-12-14 09:47:15 +0100145
146 /* Protection Module Register Target APE (PM_RT) */
147 writel(UNLOCK_1, &pm_rt_ape_base->req_info_permission_1);
148 writel(UNLOCK_1, &pm_rt_ape_base->read_permission_0);
149 writel(UNLOCK_1, &pm_rt_ape_base->wirte_permission_0);
150 writel(UNLOCK_2, &pm_rt_ape_base->addr_match_1);
151
152 writel(UNLOCK_3, &pm_gpmc_base->req_info_permission_0);
153 writel(UNLOCK_3, &pm_gpmc_base->read_permission_0);
154 writel(UNLOCK_3, &pm_gpmc_base->wirte_permission_0);
155
156 writel(UNLOCK_3, &pm_ocm_ram_base->req_info_permission_0);
157 writel(UNLOCK_3, &pm_ocm_ram_base->read_permission_0);
158 writel(UNLOCK_3, &pm_ocm_ram_base->wirte_permission_0);
159 writel(UNLOCK_2, &pm_ocm_ram_base->addr_match_2);
160
161 /* IVA Changes */
162 writel(UNLOCK_3, &pm_iva2_base->req_info_permission_0);
163 writel(UNLOCK_3, &pm_iva2_base->read_permission_0);
164 writel(UNLOCK_3, &pm_iva2_base->wirte_permission_0);
165
166 /* SDRC region 0 public */
167 writel(UNLOCK_1, &sms_base->rg_att0);
168}
169
170/******************************************************************************
171 * Routine: secureworld_exit()
172 * Description: If chip is EMU and boot type is external
173 * configure secure registers and exit secure world
174 * general use.
175 *****************************************************************************/
Jeroen Hofsteefd3f4012014-06-16 23:22:23 +0200176void secureworld_exit(void)
Dirk Behme91eee542008-12-14 09:47:15 +0100177{
178 unsigned long i;
179
Peter Meerwalda4958312012-02-02 12:51:02 +0000180 /* configure non-secure access control register */
Dirk Behme91eee542008-12-14 09:47:15 +0100181 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 2":"=r"(i));
182 /* enabling co-processor CP10 and CP11 accesses in NS world */
183 __asm__ __volatile__("orr %0, %0, #0xC00":"=r"(i));
184 /*
185 * allow allocation of locked TLBs and L2 lines in NS world
186 * allow use of PLE registers in NS world also
187 */
188 __asm__ __volatile__("orr %0, %0, #0x70000":"=r"(i));
189 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 2":"=r"(i));
190
191 /* Enable ASA in ACR register */
192 __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
193 __asm__ __volatile__("orr %0, %0, #0x10":"=r"(i));
194 __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
195
196 /* Exiting secure world */
197 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 0":"=r"(i));
198 __asm__ __volatile__("orr %0, %0, #0x31":"=r"(i));
199 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i));
200}
201
202/******************************************************************************
Dirk Behme91eee542008-12-14 09:47:15 +0100203 * Routine: try_unlock_sram()
204 * Description: If chip is GP/EMU(special) type, unlock the SRAM for
205 * general use.
206 *****************************************************************************/
Jeroen Hofsteefd3f4012014-06-16 23:22:23 +0200207void try_unlock_memory(void)
Dirk Behme91eee542008-12-14 09:47:15 +0100208{
209 int mode;
210 int in_sdram = is_running_in_sdram();
211
212 /*
213 * if GP device unlock device SRAM for general use
214 * secure code breaks for Secure/Emulation device - HS/E/T
215 */
216 mode = get_device_type();
217 if (mode == GP_DEVICE)
218 secure_unlock_mem();
219
220 /*
221 * If device is EMU and boot is XIP external booting
222 * Unlock firewalls and disable L2 and put chip
223 * out of secure world
224 *
225 * Assuming memories are unlocked by the demon who put us in SDRAM
226 */
227 if ((mode <= EMU_DEVICE) && (get_boot_type() == 0x1F)
228 && (!in_sdram)) {
229 secure_unlock_mem();
230 secureworld_exit();
231 }
232
233 return;
234}
235
236/******************************************************************************
237 * Routine: s_init
238 * Description: Does early system init of muxing and clocks.
239 * - Called path is with SRAM stack.
240 *****************************************************************************/
241void s_init(void)
242{
Dirk Behme91eee542008-12-14 09:47:15 +0100243 watchdog_init();
244
245 try_unlock_memory();
246
Aneesh V45bf0582011-06-16 23:30:53 +0000247 /* Errata workarounds */
248 omap3_setup_aux_cr();
Dirk Behme91eee542008-12-14 09:47:15 +0100249
Aneesh V45bf0582011-06-16 23:30:53 +0000250#ifndef CONFIG_SYS_L2CACHE_OFF
251 /* Invalidate L2-cache from secure mode */
252 omap3_invalidate_l2_cache_secure();
Dirk Behme91eee542008-12-14 09:47:15 +0100253#endif
Dirk Behme91eee542008-12-14 09:47:15 +0100254
255 set_muxconf_regs();
Alexander Holler86623ad2010-12-18 13:24:20 +0100256 sdelay(100);
Dirk Behme91eee542008-12-14 09:47:15 +0100257
258 prcm_init();
259
260 per_clocks_enable();
261
Govindraj.R95f87912012-02-06 03:55:35 +0000262#ifdef CONFIG_USB_EHCI_OMAP
263 ehci_clocks_enable();
264#endif
Dirk Behme91eee542008-12-14 09:47:15 +0100265}
266
Simon Glass7ae83502015-03-03 08:03:02 -0700267#ifdef CONFIG_SPL_BUILD
268void board_init_f(ulong dummy)
269{
270 mem_init();
271}
272#endif
273
Tom Rini8a87a3d2012-04-13 12:20:03 +0000274/*
275 * Routine: misc_init_r
276 * Description: A basic misc_init_r that just displays the die ID
277 */
278int __weak misc_init_r(void)
279{
280 dieid_num_r();
281
282 return 0;
283}
284
Dirk Behme91eee542008-12-14 09:47:15 +0100285/******************************************************************************
286 * Routine: wait_for_command_complete
287 * Description: Wait for posting to finish on watchdog
288 *****************************************************************************/
Jeroen Hofstee98431d52014-10-08 22:57:41 +0200289static void wait_for_command_complete(struct watchdog *wd_base)
Dirk Behme91eee542008-12-14 09:47:15 +0100290{
291 int pending = 1;
292 do {
293 pending = readl(&wd_base->wwps);
294 } while (pending);
295}
296
297/******************************************************************************
298 * Routine: watchdog_init
299 * Description: Shut down watch dogs
300 *****************************************************************************/
301void watchdog_init(void)
302{
Dirk Behme97a099e2009-08-08 09:30:21 +0200303 struct watchdog *wd2_base = (struct watchdog *)WD2_BASE;
304 struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
Dirk Behme91eee542008-12-14 09:47:15 +0100305
306 /*
307 * There are 3 watch dogs WD1=Secure, WD2=MPU, WD3=IVA. WD1 is
308 * either taken care of by ROM (HS/EMU) or not accessible (GP).
309 * We need to take care of WD2-MPU or take a PRCM reset. WD3
310 * should not be running and does not generate a PRCM reset.
311 */
312
Wolfgang Denke7300f42014-03-25 14:49:48 +0100313 setbits_le32(&prcm_base->fclken_wkup, 0x20);
314 setbits_le32(&prcm_base->iclken_wkup, 0x20);
Dirk Behme91eee542008-12-14 09:47:15 +0100315 wait_on_value(ST_WDT2, 0x20, &prcm_base->idlest_wkup, 5);
316
317 writel(WD_UNLOCK1, &wd2_base->wspr);
318 wait_for_command_complete(wd2_base);
319 writel(WD_UNLOCK2, &wd2_base->wspr);
320}
321
322/******************************************************************************
Dirk Behme91eee542008-12-14 09:47:15 +0100323 * Dummy function to handle errors for EABI incompatibility
324 *****************************************************************************/
Dirk Behme91eee542008-12-14 09:47:15 +0100325void abort(void)
326{
327}
328
Simon Schwarzbb085b82011-09-14 15:29:26 -0400329#if defined(CONFIG_NAND_OMAP_GPMC) & !defined(CONFIG_SPL_BUILD)
Dirk Behme91eee542008-12-14 09:47:15 +0100330/******************************************************************************
331 * OMAP3 specific command to switch between NAND HW and SW ecc
332 *****************************************************************************/
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200333static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Dirk Behme91eee542008-12-14 09:47:15 +0100334{
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000335 if (argc < 2 || argc > 3)
Dirk Behme91eee542008-12-14 09:47:15 +0100336 goto usage;
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000337
338 if (strncmp(argv[1], "hw", 2) == 0) {
339 if (argc == 2) {
340 omap_nand_switch_ecc(1, 1);
341 } else {
342 if (strncmp(argv[2], "hamming", 7) == 0)
343 omap_nand_switch_ecc(1, 1);
344 else if (strncmp(argv[2], "bch8", 4) == 0)
345 omap_nand_switch_ecc(1, 8);
346 else
347 goto usage;
348 }
349 } else if (strncmp(argv[1], "sw", 2) == 0) {
Ash Charlesb0508982015-02-18 11:25:11 -0800350 if (argc == 2) {
351 omap_nand_switch_ecc(0, 1);
352 } else {
353 if (strncmp(argv[2], "hamming", 7) == 0)
354 omap_nand_switch_ecc(0, 1);
355 else if (strncmp(argv[2], "bch8", 4) == 0)
356 omap_nand_switch_ecc(0, 8);
357 else
358 goto usage;
359 }
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000360 } else {
Dirk Behme91eee542008-12-14 09:47:15 +0100361 goto usage;
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000362 }
Dirk Behme91eee542008-12-14 09:47:15 +0100363
364 return 0;
365
366usage:
Sanjeev Premi36003262009-04-03 14:00:07 +0530367 printf ("Usage: nandecc %s\n", cmdtp->usage);
Dirk Behme91eee542008-12-14 09:47:15 +0100368 return 1;
369}
370
371U_BOOT_CMD(
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000372 nandecc, 3, 1, do_switch_ecc,
Robert P. J. Daya93c92c2009-11-17 07:30:23 -0500373 "switch OMAP3 NAND ECC calculation algorithm",
Andreas Bießmannda634ae2013-04-04 23:52:50 +0000374 "hw [hamming|bch8] - Switch between NAND hardware 1-bit hamming and"
375 " 8-bit BCH\n"
376 " ecc calculation (second parameter may"
377 " be omitted).\n"
378 "nandecc sw - Switch to NAND software ecc algorithm."
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200379);
Dirk Behme91eee542008-12-14 09:47:15 +0100380
Simon Schwarzbb085b82011-09-14 15:29:26 -0400381#endif /* CONFIG_NAND_OMAP_GPMC & !CONFIG_SPL_BUILD */
Sanjeev Premi6a6b62e2009-04-27 21:27:27 +0530382
383#ifdef CONFIG_DISPLAY_BOARDINFO
384/**
385 * Print board information
386 */
387int checkboard (void)
388{
389 char *mem_s ;
390
391 if (is_mem_sdr())
392 mem_s = "mSDR";
393 else
394 mem_s = "LPDDR";
395
396 printf("%s + %s/%s\n", sysinfo.board_string, mem_s,
397 sysinfo.nand_string);
398
399 return 0;
400}
401#endif /* CONFIG_DISPLAY_BOARDINFO */
Aneesh V45bf0582011-06-16 23:30:53 +0000402
403static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
404{
405 u32 i, num_params = *parameters;
406 u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA;
407
408 /*
409 * copy the parameters to an un-cached area to avoid coherency
410 * issues
411 */
412 for (i = 0; i < num_params; i++) {
413 __raw_writel(*parameters, sram_scratch_space);
414 parameters++;
415 sram_scratch_space++;
416 }
417
418 /* Now make the PPA call */
419 do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
420}
421
422static void omap3_update_aux_cr_secure(u32 set_bits, u32 clear_bits)
423{
424 u32 acr;
425
426 /* Read ACR */
427 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
428 acr &= ~clear_bits;
429 acr |= set_bits;
430
431 if (get_device_type() == GP_DEVICE) {
432 omap3_gp_romcode_call(OMAP3_GP_ROMCODE_API_WRITE_ACR,
433 acr);
434 } else {
435 struct emu_hal_params emu_romcode_params;
436 emu_romcode_params.num_params = 1;
437 emu_romcode_params.param1 = acr;
438 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
439 (u32 *)&emu_romcode_params);
440 }
441}
442
Aneesh V45bf0582011-06-16 23:30:53 +0000443static void omap3_setup_aux_cr(void)
444{
445 /* Workaround for Cortex-A8 errata: #454179 #430973
446 * Set "IBE" bit
Peter Meerwalda4958312012-02-02 12:51:02 +0000447 * Set "Disable Branch Size Mispredicts" bit
Aneesh V45bf0582011-06-16 23:30:53 +0000448 * Workaround for erratum #621766
449 * Enable L1NEON bit
450 * ACR |= (IBE | DBSM | L1NEON) => ACR |= 0xE0
451 */
452 omap3_update_aux_cr_secure(0xE0, 0);
453}
454
455#ifndef CONFIG_SYS_L2CACHE_OFF
Tom Rini57f588b2012-10-30 22:23:28 -0700456static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
457{
458 u32 acr;
459
460 /* Read ACR */
461 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
462 acr &= ~clear_bits;
463 acr |= set_bits;
464
465 /* Write ACR - affects non-secure banked bits */
466 asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr));
467}
468
Aneesh V45bf0582011-06-16 23:30:53 +0000469/* Invalidate the entire L2 cache from secure mode */
470static void omap3_invalidate_l2_cache_secure(void)
471{
472 if (get_device_type() == GP_DEVICE) {
473 omap3_gp_romcode_call(OMAP3_GP_ROMCODE_API_L2_INVAL,
474 0);
475 } else {
476 struct emu_hal_params emu_romcode_params;
477 emu_romcode_params.num_params = 1;
478 emu_romcode_params.param1 = 0;
479 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_L2_INVAL,
480 (u32 *)&emu_romcode_params);
481 }
482}
483
484void v7_outer_cache_enable(void)
485{
486 /* Set L2EN */
487 omap3_update_aux_cr_secure(0x2, 0);
488
489 /*
490 * On some revisions L2EN bit is banked on some revisions it's not
491 * No harm in setting both banked bits(in fact this is required
492 * by an erratum)
493 */
494 omap3_update_aux_cr(0x2, 0);
495}
496
Aneesh Vf1f2c3c2012-02-16 03:40:15 +0000497void omap3_outer_cache_disable(void)
Aneesh V45bf0582011-06-16 23:30:53 +0000498{
499 /* Clear L2EN */
500 omap3_update_aux_cr_secure(0, 0x2);
501
502 /*
503 * On some revisions L2EN bit is banked on some revisions it's not
504 * No harm in clearing both banked bits(in fact this is required
505 * by an erratum)
506 */
507 omap3_update_aux_cr(0, 0x2);
508}
Robert P. J. Daye3fe6252012-11-13 07:57:54 +0000509#endif /* !CONFIG_SYS_L2CACHE_OFF */