blob: 1de343ff48e054cf420086b48b8675b5c61068e9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dirk Behmee0e49fe2008-12-14 09:47:15 +01002/*
3 *
4 * Common board functions for OMAP3 based boards.
5 *
6 * (C) Copyright 2004-2008
7 * Texas Instruments, <www.ti.com>
8 *
9 * Author :
10 * Sunil Kumar <sunilsaini05@gmail.com>
11 * Shashi Ranjan <shashiranjanmca05@gmail.com>
12 *
13 * Derived from Beagle Board and 3430 SDP code by
14 * Richard Woodruff <r-woodruff2@ti.com>
15 * Syed Mohammed Khasim <khasim@ti.com>
16 *
Dirk Behmee0e49fe2008-12-14 09:47:15 +010017 */
Simon Glassed38aef2020-05-10 11:40:03 -060018#include <command.h>
Simon Glassbc0f4ea2014-10-22 21:37:15 -060019#include <dm.h>
Simon Glass97589732020-05-10 11:40:02 -060020#include <init.h>
Tom Rini28591df2012-08-13 12:03:19 -070021#include <spl.h>
Dirk Behmee0e49fe2008-12-14 09:47:15 +010022#include <asm/io.h>
23#include <asm/arch/sys_proto.h>
24#include <asm/arch/mem.h>
Kim, Heung Jun3b5ac952009-06-20 11:02:17 +020025#include <asm/cache.h>
Aneesh Vd16dd012011-06-16 23:30:53 +000026#include <asm/armv7.h>
Simon Glassbc0f4ea2014-10-22 21:37:15 -060027#include <asm/gpio.h>
Simon Schwarz992dcf72011-09-14 15:29:26 -040028#include <asm/omap_common.h>
Tom Rini05df8912012-04-13 12:20:03 +000029#include <linux/compiler.h>
Dirk Behmee0e49fe2008-12-14 09:47:15 +010030
Aneesh Vd16dd012011-06-16 23:30:53 +000031/* Declarations */
Dirk Behmee0e49fe2008-12-14 09:47:15 +010032extern omap3_sysinfo sysinfo;
Tom Rinib759db32012-10-30 22:23:28 -070033#ifndef CONFIG_SYS_L2CACHE_OFF
Aneesh Vd16dd012011-06-16 23:30:53 +000034static void omap3_invalidate_l2_cache_secure(void);
Tom Rinib759db32012-10-30 22:23:28 -070035#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +010036
Simon Glassfa4689a2019-12-06 21:41:35 -070037#if CONFIG_IS_ENABLED(DM_GPIO)
Adam Ford15e2ad62019-05-29 15:42:53 -050038#if !CONFIG_IS_ENABLED(OF_CONTROL)
39/* Manually initialize GPIO banks when OF_CONTROL doesn't */
Simon Glassb75b15b2020-12-03 16:55:23 -070040static const struct omap_gpio_plat omap34xx_gpio[] = {
Tom Rini7bc2bca2015-07-31 19:55:09 -040041 { 0, OMAP34XX_GPIO1_BASE },
42 { 1, OMAP34XX_GPIO2_BASE },
43 { 2, OMAP34XX_GPIO3_BASE },
44 { 3, OMAP34XX_GPIO4_BASE },
45 { 4, OMAP34XX_GPIO5_BASE },
46 { 5, OMAP34XX_GPIO6_BASE },
Simon Glassbc0f4ea2014-10-22 21:37:15 -060047};
48
Simon Glass1d8364a2020-12-28 20:34:54 -070049U_BOOT_DRVINFOS(omap34xx_gpios) = {
Simon Glassbc0f4ea2014-10-22 21:37:15 -060050 { "gpio_omap", &omap34xx_gpio[0] },
51 { "gpio_omap", &omap34xx_gpio[1] },
52 { "gpio_omap", &omap34xx_gpio[2] },
53 { "gpio_omap", &omap34xx_gpio[3] },
54 { "gpio_omap", &omap34xx_gpio[4] },
55 { "gpio_omap", &omap34xx_gpio[5] },
56};
Adam Ford15e2ad62019-05-29 15:42:53 -050057#endif
Simon Glassbc0f4ea2014-10-22 21:37:15 -060058#else
59
Aneesh V9a390882011-07-21 09:29:29 -040060static const struct gpio_bank gpio_bank_34xx[6] = {
Tom Rini7bc2bca2015-07-31 19:55:09 -040061 { (void *)OMAP34XX_GPIO1_BASE },
62 { (void *)OMAP34XX_GPIO2_BASE },
63 { (void *)OMAP34XX_GPIO3_BASE },
64 { (void *)OMAP34XX_GPIO4_BASE },
65 { (void *)OMAP34XX_GPIO5_BASE },
66 { (void *)OMAP34XX_GPIO6_BASE },
Aneesh V9a390882011-07-21 09:29:29 -040067};
68
69const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
70
Simon Glassbc0f4ea2014-10-22 21:37:15 -060071#endif
72
Adam Ford84ebfd42021-06-25 14:23:08 -050073void early_system_init(void)
74{
75 hw_data_init();
76}
77
Tom Rinie1e85442021-08-27 21:18:30 -040078#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) && \
79 !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT_ONLY)
Adam Ford84ebfd42021-06-25 14:23:08 -050080
Dirk Behmee0e49fe2008-12-14 09:47:15 +010081/******************************************************************************
Dirk Behmee0e49fe2008-12-14 09:47:15 +010082 * Routine: secure_unlock
83 * Description: Setup security registers for access
84 * (GP Device only)
85 *****************************************************************************/
Adam Ford84ebfd42021-06-25 14:23:08 -050086static void secure_unlock_mem(void)
Dirk Behmee0e49fe2008-12-14 09:47:15 +010087{
Dirk Behmedc7af202009-08-08 09:30:21 +020088 struct pm *pm_rt_ape_base = (struct pm *)PM_RT_APE_BASE_ADDR_ARM;
89 struct pm *pm_gpmc_base = (struct pm *)PM_GPMC_BASE_ADDR_ARM;
90 struct pm *pm_ocm_ram_base = (struct pm *)PM_OCM_RAM_BASE_ADDR_ARM;
91 struct pm *pm_iva2_base = (struct pm *)PM_IVA2_BASE_ADDR_ARM;
92 struct sms *sms_base = (struct sms *)OMAP34XX_SMS_BASE;
Dirk Behmee0e49fe2008-12-14 09:47:15 +010093
94 /* Protection Module Register Target APE (PM_RT) */
95 writel(UNLOCK_1, &pm_rt_ape_base->req_info_permission_1);
96 writel(UNLOCK_1, &pm_rt_ape_base->read_permission_0);
97 writel(UNLOCK_1, &pm_rt_ape_base->wirte_permission_0);
98 writel(UNLOCK_2, &pm_rt_ape_base->addr_match_1);
99
100 writel(UNLOCK_3, &pm_gpmc_base->req_info_permission_0);
101 writel(UNLOCK_3, &pm_gpmc_base->read_permission_0);
102 writel(UNLOCK_3, &pm_gpmc_base->wirte_permission_0);
103
104 writel(UNLOCK_3, &pm_ocm_ram_base->req_info_permission_0);
105 writel(UNLOCK_3, &pm_ocm_ram_base->read_permission_0);
106 writel(UNLOCK_3, &pm_ocm_ram_base->wirte_permission_0);
107 writel(UNLOCK_2, &pm_ocm_ram_base->addr_match_2);
108
109 /* IVA Changes */
110 writel(UNLOCK_3, &pm_iva2_base->req_info_permission_0);
111 writel(UNLOCK_3, &pm_iva2_base->read_permission_0);
112 writel(UNLOCK_3, &pm_iva2_base->wirte_permission_0);
113
114 /* SDRC region 0 public */
115 writel(UNLOCK_1, &sms_base->rg_att0);
116}
117
118/******************************************************************************
119 * Routine: secureworld_exit()
120 * Description: If chip is EMU and boot type is external
121 * configure secure registers and exit secure world
122 * general use.
123 *****************************************************************************/
Adam Ford9d049332021-06-25 14:23:07 -0500124static void secureworld_exit(void)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100125{
126 unsigned long i;
127
Peter Meerwald7ea4b7c2012-02-02 12:51:02 +0000128 /* configure non-secure access control register */
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100129 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 2":"=r"(i));
130 /* enabling co-processor CP10 and CP11 accesses in NS world */
131 __asm__ __volatile__("orr %0, %0, #0xC00":"=r"(i));
132 /*
133 * allow allocation of locked TLBs and L2 lines in NS world
134 * allow use of PLE registers in NS world also
135 */
136 __asm__ __volatile__("orr %0, %0, #0x70000":"=r"(i));
137 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 2":"=r"(i));
138
139 /* Enable ASA in ACR register */
140 __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
141 __asm__ __volatile__("orr %0, %0, #0x10":"=r"(i));
142 __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
143
144 /* Exiting secure world */
145 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 0":"=r"(i));
146 __asm__ __volatile__("orr %0, %0, #0x31":"=r"(i));
147 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i));
148}
149
150/******************************************************************************
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100151 * Routine: try_unlock_sram()
152 * Description: If chip is GP/EMU(special) type, unlock the SRAM for
153 * general use.
154 *****************************************************************************/
Adam Fordc50add12021-06-25 14:23:06 -0500155static void try_unlock_memory(void)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100156{
157 int mode;
158 int in_sdram = is_running_in_sdram();
159
160 /*
161 * if GP device unlock device SRAM for general use
162 * secure code breaks for Secure/Emulation device - HS/E/T
163 */
164 mode = get_device_type();
165 if (mode == GP_DEVICE)
166 secure_unlock_mem();
167
168 /*
169 * If device is EMU and boot is XIP external booting
170 * Unlock firewalls and disable L2 and put chip
171 * out of secure world
172 *
173 * Assuming memories are unlocked by the demon who put us in SDRAM
174 */
175 if ((mode <= EMU_DEVICE) && (get_boot_type() == 0x1F)
176 && (!in_sdram)) {
177 secure_unlock_mem();
178 secureworld_exit();
179 }
180
181 return;
182}
183
184/******************************************************************************
185 * Routine: s_init
186 * Description: Does early system init of muxing and clocks.
187 * - Called path is with SRAM stack.
188 *****************************************************************************/
189void s_init(void)
190{
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100191 watchdog_init();
Semen Protsenkoa8cb0222017-06-02 18:00:00 +0300192 early_system_init();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100193
194 try_unlock_memory();
195
Aneesh Vd16dd012011-06-16 23:30:53 +0000196#ifndef CONFIG_SYS_L2CACHE_OFF
197 /* Invalidate L2-cache from secure mode */
198 omap3_invalidate_l2_cache_secure();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100199#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100200
201 set_muxconf_regs();
Alexander Holler4e333f62010-12-18 13:24:20 +0100202 sdelay(100);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100203
204 prcm_init();
205
206 per_clocks_enable();
207
Govindraj.R3968a6a2012-02-06 03:55:35 +0000208#ifdef CONFIG_USB_EHCI_OMAP
209 ehci_clocks_enable();
210#endif
Simon Glass0c078ea2015-03-03 08:03:02 -0700211}
Pali Rohár8d4342f2021-02-07 14:50:13 +0100212#endif
Govindraj.R3968a6a2012-02-06 03:55:35 +0000213
Simon Glass0c078ea2015-03-03 08:03:02 -0700214#ifdef CONFIG_SPL_BUILD
215void board_init_f(ulong dummy)
216{
Semen Protsenkoa8cb0222017-06-02 18:00:00 +0300217 early_system_init();
Maxim Uvarov74dde142023-12-26 21:46:18 +0600218 omap3_mem_init();
Adam Ford0d5a1bf2017-07-14 08:53:20 -0500219 /*
220 * Save the boot parameters passed from romcode.
221 * We cannot delay the saving further than this,
222 * to prevent overwrites.
223 */
224 save_omap_boot_params();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100225}
Simon Glass0c078ea2015-03-03 08:03:02 -0700226#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100227
Tom Rini05df8912012-04-13 12:20:03 +0000228/*
229 * Routine: misc_init_r
230 * Description: A basic misc_init_r that just displays the die ID
231 */
232int __weak misc_init_r(void)
233{
Paul Kocialkowski6bc318e2015-08-27 19:37:13 +0200234 omap_die_id_display();
Tom Rini05df8912012-04-13 12:20:03 +0000235
236 return 0;
237}
238
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100239/******************************************************************************
240 * Routine: wait_for_command_complete
241 * Description: Wait for posting to finish on watchdog
242 *****************************************************************************/
Jeroen Hofsteecbc75622014-10-08 22:57:41 +0200243static void wait_for_command_complete(struct watchdog *wd_base)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100244{
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 *****************************************************************************/
255void watchdog_init(void)
256{
Dirk Behmedc7af202009-08-08 09:30:21 +0200257 struct watchdog *wd2_base = (struct watchdog *)WD2_BASE;
258 struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100259
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
Wolfgang Denk42b97cb2014-03-25 14:49:48 +0100267 setbits_le32(&prcm_base->fclken_wkup, 0x20);
268 setbits_le32(&prcm_base->iclken_wkup, 0x20);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100269 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 Behmee0e49fe2008-12-14 09:47:15 +0100277 * Dummy function to handle errors for EABI incompatibility
278 *****************************************************************************/
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100279void abort(void)
280{
281}
282
Simon Schwarz992dcf72011-09-14 15:29:26 -0400283#if defined(CONFIG_NAND_OMAP_GPMC) & !defined(CONFIG_SPL_BUILD)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100284/******************************************************************************
285 * OMAP3 specific command to switch between NAND HW and SW ecc
286 *****************************************************************************/
Simon Glassed38aef2020-05-10 11:40:03 -0600287static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
288 char *const argv[])
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100289{
Ladislav Michld3bc9852017-03-06 13:54:30 +0100290 int hw, strength = 1;
291
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000292 if (argc < 2 || argc > 3)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100293 goto usage;
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000294
295 if (strncmp(argv[1], "hw", 2) == 0) {
Ladislav Michld3bc9852017-03-06 13:54:30 +0100296 hw = 1;
297 if (argc == 3) {
298 if (strncmp(argv[2], "bch8", 4) == 0)
299 strength = 8;
Heiko Schocher5bf904c2016-06-07 08:55:42 +0200300 else if (strncmp(argv[2], "bch16", 5) == 0)
Ladislav Michld3bc9852017-03-06 13:54:30 +0100301 strength = 16;
302 else if (strncmp(argv[2], "hamming", 7) != 0)
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000303 goto usage;
304 }
305 } else if (strncmp(argv[1], "sw", 2) == 0) {
Ladislav Michld3bc9852017-03-06 13:54:30 +0100306 hw = 0;
307 if (argc == 3) {
308 if (strncmp(argv[2], "bch8", 4) == 0)
309 strength = 8;
310 else if (strncmp(argv[2], "hamming", 7) != 0)
Ash Charles4a5faa82015-02-18 11:25:11 -0800311 goto usage;
312 }
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000313 } else {
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100314 goto usage;
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000315 }
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100316
Ladislav Michld3bc9852017-03-06 13:54:30 +0100317 return -omap_nand_switch_ecc(hw, strength);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100318
319usage:
Sanjeev Premi15af9982009-04-03 14:00:07 +0530320 printf ("Usage: nandecc %s\n", cmdtp->usage);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100321 return 1;
322}
323
324U_BOOT_CMD(
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000325 nandecc, 3, 1, do_switch_ecc,
Robert P. J. Day3ea16c32009-11-17 07:30:23 -0500326 "switch OMAP3 NAND ECC calculation algorithm",
Heiko Schocher5bf904c2016-06-07 08:55:42 +0200327 "hw [hamming|bch8|bch16] - Switch between NAND hardware 1-bit hamming"
328 " and 8-bit/16-bit BCH\n"
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000329 " ecc calculation (second parameter may"
330 " be omitted).\n"
331 "nandecc sw - Switch to NAND software ecc algorithm."
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200332);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100333
Simon Schwarz992dcf72011-09-14 15:29:26 -0400334#endif /* CONFIG_NAND_OMAP_GPMC & !CONFIG_SPL_BUILD */
Sanjeev Premie32ef2e2009-04-27 21:27:27 +0530335
336#ifdef CONFIG_DISPLAY_BOARDINFO
337/**
338 * Print board information
339 */
340int checkboard (void)
341{
342 char *mem_s ;
343
344 if (is_mem_sdr())
345 mem_s = "mSDR";
346 else
347 mem_s = "LPDDR";
348
349 printf("%s + %s/%s\n", sysinfo.board_string, mem_s,
350 sysinfo.nand_string);
351
352 return 0;
353}
354#endif /* CONFIG_DISPLAY_BOARDINFO */
Aneesh Vd16dd012011-06-16 23:30:53 +0000355
356static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
357{
358 u32 i, num_params = *parameters;
359 u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA;
360
361 /*
362 * copy the parameters to an un-cached area to avoid coherency
363 * issues
364 */
365 for (i = 0; i < num_params; i++) {
366 __raw_writel(*parameters, sram_scratch_space);
367 parameters++;
368 sram_scratch_space++;
369 }
370
371 /* Now make the PPA call */
372 do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
373}
374
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500375void __weak omap3_set_aux_cr_secure(u32 acr)
Aneesh Vd16dd012011-06-16 23:30:53 +0000376{
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500377 struct emu_hal_params emu_romcode_params;
378
379 emu_romcode_params.num_params = 1;
380 emu_romcode_params.param1 = acr;
381 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
382 (u32 *)&emu_romcode_params);
Aneesh Vd16dd012011-06-16 23:30:53 +0000383}
384
Siarhei Siamashkafe038a72017-03-06 03:16:53 +0200385void v7_arch_cp15_set_l2aux_ctrl(u32 l2auxctrl, u32 cpu_midr,
386 u32 cpu_rev_comb, u32 cpu_variant,
387 u32 cpu_rev)
388{
389 if (get_device_type() == GP_DEVICE)
390 omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_L2ACR, l2auxctrl);
391
392 /* L2 Cache Auxiliary Control Register is not banked */
393}
394
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500395void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
396 u32 cpu_variant, u32 cpu_rev)
Aneesh Vd16dd012011-06-16 23:30:53 +0000397{
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500398 /* Write ACR - affects secure banked bits */
399 if (get_device_type() == GP_DEVICE)
400 omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_ACR, acr);
401 else
402 omap3_set_aux_cr_secure(acr);
Nishanth Menon3e46e3e2015-03-09 17:12:08 -0500403
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500404 /* Write ACR - affects non-secure banked bits - some erratas need it */
405 asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr));
Aneesh Vd16dd012011-06-16 23:30:53 +0000406}
407
408#ifndef CONFIG_SYS_L2CACHE_OFF
Tom Rinib759db32012-10-30 22:23:28 -0700409static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
410{
411 u32 acr;
412
413 /* Read ACR */
414 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
415 acr &= ~clear_bits;
416 acr |= set_bits;
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500417 v7_arch_cp15_set_acr(acr, 0, 0, 0, 0);
Tom Rinib759db32012-10-30 22:23:28 -0700418
Tom Rinib759db32012-10-30 22:23:28 -0700419}
420
Aneesh Vd16dd012011-06-16 23:30:53 +0000421/* Invalidate the entire L2 cache from secure mode */
422static void omap3_invalidate_l2_cache_secure(void)
423{
424 if (get_device_type() == GP_DEVICE) {
Nishanth Menona816cc32015-03-09 17:12:05 -0500425 omap_smc1(OMAP3_GP_ROMCODE_API_L2_INVAL, 0);
Aneesh Vd16dd012011-06-16 23:30:53 +0000426 } else {
427 struct emu_hal_params emu_romcode_params;
428 emu_romcode_params.num_params = 1;
429 emu_romcode_params.param1 = 0;
430 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_L2_INVAL,
431 (u32 *)&emu_romcode_params);
432 }
433}
434
435void v7_outer_cache_enable(void)
436{
Aneesh Vd16dd012011-06-16 23:30:53 +0000437
438 /*
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500439 * Set L2EN
Aneesh Vd16dd012011-06-16 23:30:53 +0000440 * On some revisions L2EN bit is banked on some revisions it's not
441 * No harm in setting both banked bits(in fact this is required
442 * by an erratum)
443 */
444 omap3_update_aux_cr(0x2, 0);
445}
446
Aneesh Ve0db71d2012-02-16 03:40:15 +0000447void omap3_outer_cache_disable(void)
Aneesh Vd16dd012011-06-16 23:30:53 +0000448{
Aneesh Vd16dd012011-06-16 23:30:53 +0000449 /*
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500450 * Clear L2EN
Aneesh Vd16dd012011-06-16 23:30:53 +0000451 * On some revisions L2EN bit is banked on some revisions it's not
452 * No harm in clearing both banked bits(in fact this is required
453 * by an erratum)
454 */
455 omap3_update_aux_cr(0, 0x2);
456}
Robert P. J. Day3bb3c292012-11-13 07:57:54 +0000457#endif /* !CONFIG_SYS_L2CACHE_OFF */