public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V6 11/11] ARM: OMAP3: rx51: Enable workaround for ARM errata 454179, 430973, 621766
Date: Mon, 9 Mar 2015 17:12:09 -0500	[thread overview]
Message-ID: <1425939129-308-12-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1425939129-308-1-git-send-email-nm@ti.com>

RX51 has a secure logic which uses different parameters compared to
traditional implementation. So, make the generic secure acr write
over-ride-able by board file and refactor rx51 code to use this.

While at it, enable the OMAP3 specific errata code for 454179, 430973,
621766.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/cpu/armv7/omap3/board.c            |   45 ++++++++++++---------------
 arch/arm/include/asm/arch-omap3/sys_proto.h |    1 +
 board/nokia/rx51/rx51.c                     |   19 ++++++-----
 include/configs/nokia_rx51.h                |    4 +++
 4 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 51a1c5816c3e..b064c0cc8343 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -415,31 +415,30 @@ static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
 	do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
 }
 
-void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
-			  u32 cpu_variant, u32 cpu_rev)
+void __weak omap3_set_aux_cr_secure(u32 acr)
 {
-	if (get_device_type() == GP_DEVICE) {
-		omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_ACR, acr);
-	} else {
-		struct emu_hal_params emu_romcode_params;
-		emu_romcode_params.num_params = 1;
-		emu_romcode_params.param1 = acr;
-		omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
-				       (u32 *)&emu_romcode_params);
-	}
+	struct emu_hal_params emu_romcode_params;
+
+	emu_romcode_params.num_params = 1;
+	emu_romcode_params.param1 = acr;
+	omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
+			       (u32 *)&emu_romcode_params);
 }
 
-static void omap3_update_aux_cr_secure(u32 set_bits, u32 clear_bits)
+void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
+			  u32 cpu_variant, u32 cpu_rev)
 {
-	u32 acr;
+	/* Write ACR - affects secure banked bits */
+	if (get_device_type() == GP_DEVICE)
+		omap_smc1(OMAP3_GP_ROMCODE_API_WRITE_ACR, acr);
+	else
+		omap3_set_aux_cr_secure(acr);
 
-	/* Read ACR */
-	asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
-	acr &= ~clear_bits;
-	acr |= set_bits;
-	v7_arch_cp15_set_acr(acr, 0, 0, 0, 0);
+	/* Write ACR - affects non-secure banked bits - some erratas need it */
+	asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr));
 }
 
+
 #ifndef CONFIG_SYS_L2CACHE_OFF
 static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
 {
@@ -449,9 +448,8 @@ static void omap3_update_aux_cr(u32 set_bits, u32 clear_bits)
 	asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
 	acr &= ~clear_bits;
 	acr |= set_bits;
+	v7_arch_cp15_set_acr(acr, 0, 0, 0, 0);
 
-	/* Write ACR - affects non-secure banked bits */
-	asm volatile ("mcr p15, 0, %0, c1, c0, 1" : : "r" (acr));
 }
 
 /* Invalidate the entire L2 cache from secure mode */
@@ -470,10 +468,9 @@ static void omap3_invalidate_l2_cache_secure(void)
 
 void v7_outer_cache_enable(void)
 {
-	/* Set L2EN */
-	omap3_update_aux_cr_secure(0x2, 0);
 
 	/*
+	 * Set L2EN
 	 * On some revisions L2EN bit is banked on some revisions it's not
 	 * No harm in setting both banked bits(in fact this is required
 	 * by an erratum)
@@ -483,10 +480,8 @@ void v7_outer_cache_enable(void)
 
 void omap3_outer_cache_disable(void)
 {
-	/* Clear L2EN */
-	omap3_update_aux_cr_secure(0, 0x2);
-
 	/*
+	 * Clear L2EN
 	 * On some revisions L2EN bit is banked on some revisions it's not
 	 * No harm in clearing both banked bits(in fact this is required
 	 * by an erratum)
diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h
index 0c77a22ccfff..3e45ce184ba4 100644
--- a/arch/arm/include/asm/arch-omap3/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap3/sys_proto.h
@@ -73,5 +73,6 @@ void power_init_r(void);
 void dieid_num_r(void);
 void get_dieid(u32 *id);
 void do_omap3_emu_romcode_call(u32 service_id, u32 parameters);
+void omap3_set_aux_cr_secure(u32 acr);
 u32 warm_reset(void);
 #endif
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 08fcaf21b3c6..3d019b01428b 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -341,6 +341,17 @@ static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
 	do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
 }
 
+void omap3_set_aux_cr_secure(u32 acr)
+{
+	struct emu_hal_params_rx51 emu_romcode_params = { 0, };
+
+	emu_romcode_params.num_params = 2;
+	emu_romcode_params.param1 = acr;
+
+	omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
+			       (u32 *)&emu_romcode_params);
+}
+
 /*
  * Routine: omap3_update_aux_cr_secure_rx51
  * Description: Modify the contents Auxiliary Control Register.
@@ -350,19 +361,13 @@ static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
  */
 static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits)
 {
-	struct emu_hal_params_rx51 emu_romcode_params = { 0, };
 	u32 acr;
 
 	/* Read ACR */
 	asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
 	acr &= ~clear_bits;
 	acr |= set_bits;
-
-	emu_romcode_params.num_params = 2;
-	emu_romcode_params.param1 = acr;
-
-	omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
-				(u32 *)&emu_romcode_params);
+	omap3_set_aux_cr_secure(acr);
 }
 
 /*
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 442e16ae686b..152a6e564b00 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -29,6 +29,10 @@
 #define CONFIG_SYS_L2CACHE_OFF		/* pretend there is no L2 CACHE */
 #define CONFIG_OMAP_COMMON
 #define CONFIG_SYS_GENERIC_BOARD
+/* Common ARM Erratas */
+#define CONFIG_ARM_ERRATA_454179
+#define CONFIG_ARM_ERRATA_430973
+#define CONFIG_ARM_ERRATA_621766
 
 #define CONFIG_MACH_TYPE		MACH_TYPE_NOKIA_RX51
 
-- 
1.7.9.5

  parent reply	other threads:[~2015-03-09 22:12 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 22:11 [U-Boot] [PATCH V6 00/11] ARM: OMAP3-DRA7: CP15 erratum workarounds and improvements Nishanth Menon
2015-03-09 22:11 ` [U-Boot] [PATCH V6 01/11] ARM: Introduce erratum workaround for 798870 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:50   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 02/11] ARM: Introduce erratum workaround for 454179 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:50   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 03/11] ARM: Introduce erratum workaround for 430973 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:50   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 04/11] ARM: Introduce erratum workaround for 621766 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:50   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 05/11] ARM: OMAP: Change set_pl310_ctrl_reg to be generic Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 06/11] ARM: OMAP3: Rename omap3.h to omap.h to be generic as all SoCs Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 07/11] ARM: OMAP3: Get rid of omap3_gp_romcode_call and replace with omap_smc1 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-11 15:53     ` Nishanth Menon
2015-03-11 16:00       ` Tom Rini
2015-03-11 16:04         ` Nishanth Menon
2015-03-11 20:26           ` Paul Kocialkowski
2015-03-11 21:16             ` Tom Rini
2015-03-11 21:33               ` Paul Kocialkowski
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 08/11] ARM: DRA7 / OMAP5: Add workaround for ARM errata 798870 Nishanth Menon
2015-03-11 15:48   ` Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 09/11] ARM: OMAP5 / DRA7: Setup L2 Aux Control Register with recommended configuration Nishanth Menon
2015-03-11 15:49   ` Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` [U-Boot] [PATCH V6 10/11] ARM: OMAP3: Enable workaround for ARM errata 454179, 430973, 621766 Nishanth Menon
2015-03-11 15:51   ` Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-09 22:12 ` Nishanth Menon [this message]
2015-03-11 15:51   ` [U-Boot] [PATCH V6 11/11] ARM: OMAP3: rx51: " Tom Rini
2015-03-15 21:51   ` [U-Boot] [U-Boot, V6, " Tom Rini
2015-03-11 15:48 ` [U-Boot] [PATCH V6 00/11] ARM: OMAP3-DRA7: CP15 erratum workarounds and improvements Tom Rini
2015-03-11 15:51   ` Nishanth Menon
2015-03-11 16:00     ` Tom Rini
2015-03-12  0:26       ` Matt Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425939129-308-12-git-send-email-nm@ti.com \
    --to=nm@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox