blob: 6ffedd1769fd2011b47df901c6f628743f577d82 [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 */
18#include <common.h>
Simon Glassed38aef2020-05-10 11:40:03 -060019#include <command.h>
Simon Glassbc0f4ea2014-10-22 21:37:15 -060020#include <dm.h>
Simon Glass97589732020-05-10 11:40:02 -060021#include <init.h>
Tom Rini28591df2012-08-13 12:03:19 -070022#include <spl.h>
Dirk Behmee0e49fe2008-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 Jun3b5ac952009-06-20 11:02:17 +020026#include <asm/cache.h>
Aneesh Vd16dd012011-06-16 23:30:53 +000027#include <asm/armv7.h>
Simon Glassbc0f4ea2014-10-22 21:37:15 -060028#include <asm/gpio.h>
Simon Schwarz992dcf72011-09-14 15:29:26 -040029#include <asm/omap_common.h>
Tom Rini05df8912012-04-13 12:20:03 +000030#include <linux/compiler.h>
Dirk Behmee0e49fe2008-12-14 09:47:15 +010031
Aneesh Vd16dd012011-06-16 23:30:53 +000032/* Declarations */
Dirk Behmee0e49fe2008-12-14 09:47:15 +010033extern omap3_sysinfo sysinfo;
Tom Rinib759db32012-10-30 22:23:28 -070034#ifndef CONFIG_SYS_L2CACHE_OFF
Aneesh Vd16dd012011-06-16 23:30:53 +000035static void omap3_invalidate_l2_cache_secure(void);
Tom Rinib759db32012-10-30 22:23:28 -070036#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +010037
Simon Glassfa4689a2019-12-06 21:41:35 -070038#if CONFIG_IS_ENABLED(DM_GPIO)
Adam Ford15e2ad62019-05-29 15:42:53 -050039#if !CONFIG_IS_ENABLED(OF_CONTROL)
40/* Manually initialize GPIO banks when OF_CONTROL doesn't */
Simon Glassb75b15b2020-12-03 16:55:23 -070041static const struct omap_gpio_plat omap34xx_gpio[] = {
Tom Rini7bc2bca2015-07-31 19:55:09 -040042 { 0, OMAP34XX_GPIO1_BASE },
43 { 1, OMAP34XX_GPIO2_BASE },
44 { 2, OMAP34XX_GPIO3_BASE },
45 { 3, OMAP34XX_GPIO4_BASE },
46 { 4, OMAP34XX_GPIO5_BASE },
47 { 5, OMAP34XX_GPIO6_BASE },
Simon Glassbc0f4ea2014-10-22 21:37:15 -060048};
49
Adam Ford8d70ffd2017-04-09 07:35:12 -050050U_BOOT_DEVICES(omap34xx_gpios) = {
Simon Glassbc0f4ea2014-10-22 21:37:15 -060051 { "gpio_omap", &omap34xx_gpio[0] },
52 { "gpio_omap", &omap34xx_gpio[1] },
53 { "gpio_omap", &omap34xx_gpio[2] },
54 { "gpio_omap", &omap34xx_gpio[3] },
55 { "gpio_omap", &omap34xx_gpio[4] },
56 { "gpio_omap", &omap34xx_gpio[5] },
57};
Adam Ford15e2ad62019-05-29 15:42:53 -050058#endif
Simon Glassbc0f4ea2014-10-22 21:37:15 -060059#else
60
Aneesh V9a390882011-07-21 09:29:29 -040061static const struct gpio_bank gpio_bank_34xx[6] = {
Tom Rini7bc2bca2015-07-31 19:55:09 -040062 { (void *)OMAP34XX_GPIO1_BASE },
63 { (void *)OMAP34XX_GPIO2_BASE },
64 { (void *)OMAP34XX_GPIO3_BASE },
65 { (void *)OMAP34XX_GPIO4_BASE },
66 { (void *)OMAP34XX_GPIO5_BASE },
67 { (void *)OMAP34XX_GPIO6_BASE },
Aneesh V9a390882011-07-21 09:29:29 -040068};
69
70const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
71
Simon Glassbc0f4ea2014-10-22 21:37:15 -060072#endif
73
Dirk Behmee0e49fe2008-12-14 09:47:15 +010074/******************************************************************************
Dirk Behmee0e49fe2008-12-14 09:47:15 +010075 * Routine: secure_unlock
76 * Description: Setup security registers for access
77 * (GP Device only)
78 *****************************************************************************/
79void secure_unlock_mem(void)
80{
Dirk Behmedc7af202009-08-08 09:30:21 +020081 struct pm *pm_rt_ape_base = (struct pm *)PM_RT_APE_BASE_ADDR_ARM;
82 struct pm *pm_gpmc_base = (struct pm *)PM_GPMC_BASE_ADDR_ARM;
83 struct pm *pm_ocm_ram_base = (struct pm *)PM_OCM_RAM_BASE_ADDR_ARM;
84 struct pm *pm_iva2_base = (struct pm *)PM_IVA2_BASE_ADDR_ARM;
85 struct sms *sms_base = (struct sms *)OMAP34XX_SMS_BASE;
Dirk Behmee0e49fe2008-12-14 09:47:15 +010086
87 /* Protection Module Register Target APE (PM_RT) */
88 writel(UNLOCK_1, &pm_rt_ape_base->req_info_permission_1);
89 writel(UNLOCK_1, &pm_rt_ape_base->read_permission_0);
90 writel(UNLOCK_1, &pm_rt_ape_base->wirte_permission_0);
91 writel(UNLOCK_2, &pm_rt_ape_base->addr_match_1);
92
93 writel(UNLOCK_3, &pm_gpmc_base->req_info_permission_0);
94 writel(UNLOCK_3, &pm_gpmc_base->read_permission_0);
95 writel(UNLOCK_3, &pm_gpmc_base->wirte_permission_0);
96
97 writel(UNLOCK_3, &pm_ocm_ram_base->req_info_permission_0);
98 writel(UNLOCK_3, &pm_ocm_ram_base->read_permission_0);
99 writel(UNLOCK_3, &pm_ocm_ram_base->wirte_permission_0);
100 writel(UNLOCK_2, &pm_ocm_ram_base->addr_match_2);
101
102 /* IVA Changes */
103 writel(UNLOCK_3, &pm_iva2_base->req_info_permission_0);
104 writel(UNLOCK_3, &pm_iva2_base->read_permission_0);
105 writel(UNLOCK_3, &pm_iva2_base->wirte_permission_0);
106
107 /* SDRC region 0 public */
108 writel(UNLOCK_1, &sms_base->rg_att0);
109}
110
111/******************************************************************************
112 * Routine: secureworld_exit()
113 * Description: If chip is EMU and boot type is external
114 * configure secure registers and exit secure world
115 * general use.
116 *****************************************************************************/
Jeroen Hofstee69ab3832014-06-16 23:22:23 +0200117void secureworld_exit(void)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100118{
119 unsigned long i;
120
Peter Meerwald7ea4b7c2012-02-02 12:51:02 +0000121 /* configure non-secure access control register */
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100122 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 2":"=r"(i));
123 /* enabling co-processor CP10 and CP11 accesses in NS world */
124 __asm__ __volatile__("orr %0, %0, #0xC00":"=r"(i));
125 /*
126 * allow allocation of locked TLBs and L2 lines in NS world
127 * allow use of PLE registers in NS world also
128 */
129 __asm__ __volatile__("orr %0, %0, #0x70000":"=r"(i));
130 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 2":"=r"(i));
131
132 /* Enable ASA in ACR register */
133 __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
134 __asm__ __volatile__("orr %0, %0, #0x10":"=r"(i));
135 __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
136
137 /* Exiting secure world */
138 __asm__ __volatile__("mrc p15, 0, %0, c1, c1, 0":"=r"(i));
139 __asm__ __volatile__("orr %0, %0, #0x31":"=r"(i));
140 __asm__ __volatile__("mcr p15, 0, %0, c1, c1, 0":"=r"(i));
141}
142
143/******************************************************************************
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100144 * Routine: try_unlock_sram()
145 * Description: If chip is GP/EMU(special) type, unlock the SRAM for
146 * general use.
147 *****************************************************************************/
Jeroen Hofstee69ab3832014-06-16 23:22:23 +0200148void try_unlock_memory(void)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100149{
150 int mode;
151 int in_sdram = is_running_in_sdram();
152
153 /*
154 * if GP device unlock device SRAM for general use
155 * secure code breaks for Secure/Emulation device - HS/E/T
156 */
157 mode = get_device_type();
158 if (mode == GP_DEVICE)
159 secure_unlock_mem();
160
161 /*
162 * If device is EMU and boot is XIP external booting
163 * Unlock firewalls and disable L2 and put chip
164 * out of secure world
165 *
166 * Assuming memories are unlocked by the demon who put us in SDRAM
167 */
168 if ((mode <= EMU_DEVICE) && (get_boot_type() == 0x1F)
169 && (!in_sdram)) {
170 secure_unlock_mem();
171 secureworld_exit();
172 }
173
174 return;
175}
176
Semen Protsenkoa8cb0222017-06-02 18:00:00 +0300177void early_system_init(void)
178{
179 hw_data_init();
180}
181
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100182/******************************************************************************
183 * Routine: s_init
184 * Description: Does early system init of muxing and clocks.
185 * - Called path is with SRAM stack.
186 *****************************************************************************/
187void s_init(void)
188{
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100189 watchdog_init();
Semen Protsenkoa8cb0222017-06-02 18:00:00 +0300190 early_system_init();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100191
192 try_unlock_memory();
193
Aneesh Vd16dd012011-06-16 23:30:53 +0000194#ifndef CONFIG_SYS_L2CACHE_OFF
195 /* Invalidate L2-cache from secure mode */
196 omap3_invalidate_l2_cache_secure();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100197#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100198
199 set_muxconf_regs();
Alexander Holler4e333f62010-12-18 13:24:20 +0100200 sdelay(100);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100201
202 prcm_init();
203
204 per_clocks_enable();
205
Govindraj.R3968a6a2012-02-06 03:55:35 +0000206#ifdef CONFIG_USB_EHCI_OMAP
207 ehci_clocks_enable();
208#endif
Simon Glass0c078ea2015-03-03 08:03:02 -0700209}
Govindraj.R3968a6a2012-02-06 03:55:35 +0000210
Simon Glass0c078ea2015-03-03 08:03:02 -0700211#ifdef CONFIG_SPL_BUILD
212void board_init_f(ulong dummy)
213{
Semen Protsenkoa8cb0222017-06-02 18:00:00 +0300214 early_system_init();
Simon Glass0c078ea2015-03-03 08:03:02 -0700215 mem_init();
Adam Ford0d5a1bf2017-07-14 08:53:20 -0500216 /*
217 * Save the boot parameters passed from romcode.
218 * We cannot delay the saving further than this,
219 * to prevent overwrites.
220 */
221 save_omap_boot_params();
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100222}
Simon Glass0c078ea2015-03-03 08:03:02 -0700223#endif
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100224
Tom Rini05df8912012-04-13 12:20:03 +0000225/*
226 * Routine: misc_init_r
227 * Description: A basic misc_init_r that just displays the die ID
228 */
229int __weak misc_init_r(void)
230{
Paul Kocialkowski6bc318e2015-08-27 19:37:13 +0200231 omap_die_id_display();
Tom Rini05df8912012-04-13 12:20:03 +0000232
233 return 0;
234}
235
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100236/******************************************************************************
237 * Routine: wait_for_command_complete
238 * Description: Wait for posting to finish on watchdog
239 *****************************************************************************/
Jeroen Hofsteecbc75622014-10-08 22:57:41 +0200240static void wait_for_command_complete(struct watchdog *wd_base)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100241{
242 int pending = 1;
243 do {
244 pending = readl(&wd_base->wwps);
245 } while (pending);
246}
247
248/******************************************************************************
249 * Routine: watchdog_init
250 * Description: Shut down watch dogs
251 *****************************************************************************/
252void watchdog_init(void)
253{
Dirk Behmedc7af202009-08-08 09:30:21 +0200254 struct watchdog *wd2_base = (struct watchdog *)WD2_BASE;
255 struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100256
257 /*
258 * There are 3 watch dogs WD1=Secure, WD2=MPU, WD3=IVA. WD1 is
259 * either taken care of by ROM (HS/EMU) or not accessible (GP).
260 * We need to take care of WD2-MPU or take a PRCM reset. WD3
261 * should not be running and does not generate a PRCM reset.
262 */
263
Wolfgang Denk42b97cb2014-03-25 14:49:48 +0100264 setbits_le32(&prcm_base->fclken_wkup, 0x20);
265 setbits_le32(&prcm_base->iclken_wkup, 0x20);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100266 wait_on_value(ST_WDT2, 0x20, &prcm_base->idlest_wkup, 5);
267
268 writel(WD_UNLOCK1, &wd2_base->wspr);
269 wait_for_command_complete(wd2_base);
270 writel(WD_UNLOCK2, &wd2_base->wspr);
271}
272
273/******************************************************************************
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100274 * Dummy function to handle errors for EABI incompatibility
275 *****************************************************************************/
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100276void abort(void)
277{
278}
279
Simon Schwarz992dcf72011-09-14 15:29:26 -0400280#if defined(CONFIG_NAND_OMAP_GPMC) & !defined(CONFIG_SPL_BUILD)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100281/******************************************************************************
282 * OMAP3 specific command to switch between NAND HW and SW ecc
283 *****************************************************************************/
Simon Glassed38aef2020-05-10 11:40:03 -0600284static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
285 char *const argv[])
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100286{
Ladislav Michld3bc9852017-03-06 13:54:30 +0100287 int hw, strength = 1;
288
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000289 if (argc < 2 || argc > 3)
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100290 goto usage;
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000291
292 if (strncmp(argv[1], "hw", 2) == 0) {
Ladislav Michld3bc9852017-03-06 13:54:30 +0100293 hw = 1;
294 if (argc == 3) {
295 if (strncmp(argv[2], "bch8", 4) == 0)
296 strength = 8;
Heiko Schocher5bf904c2016-06-07 08:55:42 +0200297 else if (strncmp(argv[2], "bch16", 5) == 0)
Ladislav Michld3bc9852017-03-06 13:54:30 +0100298 strength = 16;
299 else if (strncmp(argv[2], "hamming", 7) != 0)
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000300 goto usage;
301 }
302 } else if (strncmp(argv[1], "sw", 2) == 0) {
Ladislav Michld3bc9852017-03-06 13:54:30 +0100303 hw = 0;
304 if (argc == 3) {
305 if (strncmp(argv[2], "bch8", 4) == 0)
306 strength = 8;
307 else if (strncmp(argv[2], "hamming", 7) != 0)
Ash Charles4a5faa82015-02-18 11:25:11 -0800308 goto usage;
309 }
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000310 } else {
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100311 goto usage;
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000312 }
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100313
Ladislav Michld3bc9852017-03-06 13:54:30 +0100314 return -omap_nand_switch_ecc(hw, strength);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100315
316usage:
Sanjeev Premi15af9982009-04-03 14:00:07 +0530317 printf ("Usage: nandecc %s\n", cmdtp->usage);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100318 return 1;
319}
320
321U_BOOT_CMD(
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000322 nandecc, 3, 1, do_switch_ecc,
Robert P. J. Day3ea16c32009-11-17 07:30:23 -0500323 "switch OMAP3 NAND ECC calculation algorithm",
Heiko Schocher5bf904c2016-06-07 08:55:42 +0200324 "hw [hamming|bch8|bch16] - Switch between NAND hardware 1-bit hamming"
325 " and 8-bit/16-bit BCH\n"
Andreas Bießmann1e4eccf2013-04-04 23:52:50 +0000326 " ecc calculation (second parameter may"
327 " be omitted).\n"
328 "nandecc sw - Switch to NAND software ecc algorithm."
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200329);
Dirk Behmee0e49fe2008-12-14 09:47:15 +0100330
Simon Schwarz992dcf72011-09-14 15:29:26 -0400331#endif /* CONFIG_NAND_OMAP_GPMC & !CONFIG_SPL_BUILD */
Sanjeev Premie32ef2e2009-04-27 21:27:27 +0530332
333#ifdef CONFIG_DISPLAY_BOARDINFO
334/**
335 * Print board information
336 */
337int checkboard (void)
338{
339 char *mem_s ;
340
341 if (is_mem_sdr())
342 mem_s = "mSDR";
343 else
344 mem_s = "LPDDR";
345
346 printf("%s + %s/%s\n", sysinfo.board_string, mem_s,
347 sysinfo.nand_string);
348
349 return 0;
350}
351#endif /* CONFIG_DISPLAY_BOARDINFO */
Aneesh Vd16dd012011-06-16 23:30:53 +0000352
353static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
354{
355 u32 i, num_params = *parameters;
356 u32 *sram_scratch_space = (u32 *)OMAP3_PUBLIC_SRAM_SCRATCH_AREA;
357
358 /*
359 * copy the parameters to an un-cached area to avoid coherency
360 * issues
361 */
362 for (i = 0; i < num_params; i++) {
363 __raw_writel(*parameters, sram_scratch_space);
364 parameters++;
365 sram_scratch_space++;
366 }
367
368 /* Now make the PPA call */
369 do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
370}
371
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500372void __weak omap3_set_aux_cr_secure(u32 acr)
Aneesh Vd16dd012011-06-16 23:30:53 +0000373{
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500374 struct emu_hal_params emu_romcode_params;
375
376 emu_romcode_params.num_params = 1;
377 emu_romcode_params.param1 = acr;
378 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
379 (u32 *)&emu_romcode_params);
Aneesh Vd16dd012011-06-16 23:30:53 +0000380}
381
Siarhei Siamashkafe038a72017-03-06 03:16:53 +0200382void v7_arch_cp15_set_l2aux_ctrl(u32 l2auxctrl, u32 cpu_midr,
383 u32 cpu_rev_comb, u32 cpu_variant,
384 u32 cpu_rev)
385{
386 if (get_device_type() == GP_DEVICE)
387 omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_L2ACR, l2auxctrl);
388
389 /* L2 Cache Auxiliary Control Register is not banked */
390}
391
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500392void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
393 u32 cpu_variant, u32 cpu_rev)
Aneesh Vd16dd012011-06-16 23:30:53 +0000394{
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500395 /* Write ACR - affects secure banked bits */
396 if (get_device_type() == GP_DEVICE)
397 omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_ACR, acr);
398 else
399 omap3_set_aux_cr_secure(acr);
Nishanth Menon3e46e3e2015-03-09 17:12:08 -0500400
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500401 /* Write ACR - affects non-secure banked bits - some erratas need it */
402 asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr));
Aneesh Vd16dd012011-06-16 23:30:53 +0000403}
404
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500405
Aneesh Vd16dd012011-06-16 23:30:53 +0000406#ifndef CONFIG_SYS_L2CACHE_OFF
Tom Rinib759db32012-10-30 22:23:28 -0700407static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
408{
409 u32 acr;
410
411 /* Read ACR */
412 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
413 acr &= ~clear_bits;
414 acr |= set_bits;
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500415 v7_arch_cp15_set_acr(acr, 0, 0, 0, 0);
Tom Rinib759db32012-10-30 22:23:28 -0700416
Tom Rinib759db32012-10-30 22:23:28 -0700417}
418
Aneesh Vd16dd012011-06-16 23:30:53 +0000419/* Invalidate the entire L2 cache from secure mode */
420static void omap3_invalidate_l2_cache_secure(void)
421{
422 if (get_device_type() == GP_DEVICE) {
Nishanth Menona816cc32015-03-09 17:12:05 -0500423 omap_smc1(OMAP3_GP_ROMCODE_API_L2_INVAL, 0);
Aneesh Vd16dd012011-06-16 23:30:53 +0000424 } else {
425 struct emu_hal_params emu_romcode_params;
426 emu_romcode_params.num_params = 1;
427 emu_romcode_params.param1 = 0;
428 omap3_emu_romcode_call(OMAP3_EMU_HAL_API_L2_INVAL,
429 (u32 *)&emu_romcode_params);
430 }
431}
432
433void v7_outer_cache_enable(void)
434{
Aneesh Vd16dd012011-06-16 23:30:53 +0000435
436 /*
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500437 * Set L2EN
Aneesh Vd16dd012011-06-16 23:30:53 +0000438 * On some revisions L2EN bit is banked on some revisions it's not
439 * No harm in setting both banked bits(in fact this is required
440 * by an erratum)
441 */
442 omap3_update_aux_cr(0x2, 0);
443}
444
Aneesh Ve0db71d2012-02-16 03:40:15 +0000445void omap3_outer_cache_disable(void)
Aneesh Vd16dd012011-06-16 23:30:53 +0000446{
Aneesh Vd16dd012011-06-16 23:30:53 +0000447 /*
Nishanth Menon53fee1e2015-03-09 17:12:09 -0500448 * Clear L2EN
Aneesh Vd16dd012011-06-16 23:30:53 +0000449 * On some revisions L2EN bit is banked on some revisions it's not
450 * No harm in clearing both banked bits(in fact this is required
451 * by an erratum)
452 */
453 omap3_update_aux_cr(0, 0x2);
454}
Robert P. J. Day3bb3c292012-11-13 07:57:54 +0000455#endif /* !CONFIG_SYS_L2CACHE_OFF */