[U-Boot] [V2] [PATCH 4/8] sun8i: Add TZPC setup for A83t

tpearson at raptorengineering.com tpearson at raptorengineering.com
Tue May 17 21:35:58 CEST 2016


This patch enables non-secure access to all system peripherals
controlled by the STMA, and additionally sets the secure RAM
range to 64k in line with other sunxi devices.

Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 arch/arm/cpu/armv7/sunxi/Makefile      |  1 +
 arch/arm/cpu/armv7/sunxi/tzpc.c        | 10 ++++++++++
 arch/arm/include/asm/arch-sunxi/tzpc.h | 10 ++++++++++
 arch/arm/mach-sunxi/board.c            |  2 +-
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
index 4d2274a..4dd449b 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -11,6 +11,7 @@ obj-y	+= timer.o

 obj-$(CONFIG_MACH_SUN6I)	+= tzpc.o
 obj-$(CONFIG_MACH_SUN8I_H3)	+= tzpc.o
+obj-$(CONFIG_MACH_SUN8I_A83T)	+= tzpc.o

 ifndef CONFIG_SPL_BUILD
 ifdef CONFIG_ARMV7_PSCI
diff --git a/arch/arm/cpu/armv7/sunxi/tzpc.c b/arch/arm/cpu/armv7/sunxi/tzpc.c
index 6c8a0fd..3b94e0d 100644
--- a/arch/arm/cpu/armv7/sunxi/tzpc.c
+++ b/arch/arm/cpu/armv7/sunxi/tzpc.c
@@ -18,6 +18,16 @@ void tzpc_init(void)
 	writel(SUN6I_TZPC_DECPORT0_RTC, &tzpc->decport0_set);
 #endif

+#ifdef SUN8I_A83T_TZPC_DECPORT0_ALL
+	/* Set secure RAM size to defined value */
+	writel(R0SIZE, &tzpc->r0size);
+
+	/* Enable non-secure access to all peripherals */
+	writel(SUN8I_A83T_TZPC_DECPORT0_ALL, &tzpc->decport0_set);
+	writel(SUN8I_A83T_TZPC_DECPORT1_ALL, &tzpc->decport1_set);
+	writel(SUN8I_A83T_TZPC_DECPORT2_ALL, &tzpc->decport2_set);
+#endif
+
 #ifdef CONFIG_MACH_SUN8I_H3
 	/* Enable non-secure access to all peripherals */
 	writel(SUN8I_H3_TZPC_DECPORT0_ALL, &tzpc->decport0_set);
diff --git a/arch/arm/include/asm/arch-sunxi/tzpc.h b/arch/arm/include/asm/arch-sunxi/tzpc.h
index 95c55cd..66e6abb 100644
--- a/arch/arm/include/asm/arch-sunxi/tzpc.h
+++ b/arch/arm/include/asm/arch-sunxi/tzpc.h
@@ -25,6 +25,16 @@ struct sunxi_tzpc {

 #define SUN6I_TZPC_DECPORT0_RTC	(1 << 1)

+#define SUN8I_A83T_TZPC_DECPORT0_ALL  0xbe
+#define SUN8I_A83T_TZPC_DECPORT1_ALL  0x7f
+#define SUN8I_A83T_TZPC_DECPORT2_ALL  0x10
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x10 : Size of secured ram (64Kib)
+ */
+#define R0SIZE			0x10
+
 #define SUN8I_H3_TZPC_DECPORT0_ALL  0xbe
 #define SUN8I_H3_TZPC_DECPORT1_ALL  0xff
 #define SUN8I_H3_TZPC_DECPORT2_ALL  0x7f
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 20149da..1ded4d6 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -183,7 +183,7 @@ void s_init(void)
 		"orr r0, r0, #1 << 6\n"
 		"mcr p15, 0, r0, c1, c0, 1\n");
 #endif
-#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_H3
+#if defined CONFIG_MACH_SUN6I || || defined CONFIG_MACH_SUN8I_A83T defined CONFIG_MACH_SUN8I_H3
 	/* Enable non-secure access to some peripherals */
 	tzpc_init();
 #endif
-- 
2.8.0.rc3



More information about the U-Boot mailing list