All of lore.kernel.org
 help / color / mirror / Atom feed
From: Icenowy Zheng <icenowy@aosc.io>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 1/8] sun8i: Add TZPC setup for A83T
Date: Wed,  7 Jun 2017 08:47:14 +0800	[thread overview]
Message-ID: <20170607004721.24194-2-icenowy@aosc.io> (raw)
In-Reply-To: <20170607004721.24194-1-icenowy@aosc.io>

From: "tpearson@raptorengineering.com" <tpearson@raptorengineering.com>

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@raptorengineering.com>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 arch/arm/cpu/armv7/sunxi/Makefile      |  1 +
 arch/arm/cpu/armv7/sunxi/tzpc.c        | 10 ++++++++++
 arch/arm/include/asm/arch-sunxi/tzpc.h |  6 ++++++
 arch/arm/mach-sunxi/board.c            |  2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
index b35b9df4a9..8c026ff052 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
 obj-$(CONFIG_ARMV7_PSCI)	+= psci.o
diff --git a/arch/arm/cpu/armv7/sunxi/tzpc.c b/arch/arm/cpu/armv7/sunxi/tzpc.c
index 6c8a0fd9a2..50a5ff6b30 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(SUN8I_A83T_TZPC_R0SIZE_64K, &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 95c55cd4d1..5b85ee86f9 100644
--- a/arch/arm/include/asm/arch-sunxi/tzpc.h
+++ b/arch/arm/include/asm/arch-sunxi/tzpc.h
@@ -25,6 +25,12 @@ 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
+/* The Secure RAM size, 0x10 means 64KiB */
+#define SUN8I_A83T_TZPC_R0SIZE_64K	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 65b1ebd837..269555e77c 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -196,7 +196,7 @@ void s_init(void)
 		"mcr p15, 0, r0, c1, c0, 1\n"
 		::: "r0");
 #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.12.2

  reply	other threads:[~2017-06-07  0:47 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07  0:47 [U-Boot] [RFC PATCH 0/8] Allwinner A83T PSCI SMP support Icenowy Zheng
2017-06-07  0:47 ` Icenowy Zheng [this message]
2017-06-07  3:24   ` [U-Boot] [linux-sunxi] [RFC PATCH 1/8] sun8i: Add TZPC setup for A83T Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 2/8] sunxi: add configuration of secure SRAM " Icenowy Zheng
2017-06-07  3:25   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 3/8] sun8i: Add a macro to read the silicon revision Icenowy Zheng
2017-06-07  3:27   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 4/8] sunxi: add SUNXI_R_CPUCFG_BASE for A83T SoC Icenowy Zheng
2017-06-07  3:48   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  4:13     ` Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 5/8] sunxi: Add CPUCFG register definitions for A80/A83T SoCs Icenowy Zheng
2017-06-07  3:43   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  3:44     ` Icenowy Zheng
2017-06-07  6:44   ` [U-Boot] " Maxime Ripard
2017-06-07  6:58     ` Icenowy Zheng
2017-06-07  7:06       ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 6/8] sunxi: add multi-cluster CPU PRCM register definition Icenowy Zheng
2017-06-07  3:40   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 7/8] sunxi: Add basic PSCI implementation for multi-cluster SoCs Icenowy Zheng
2017-06-07  4:53   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  6:48   ` [U-Boot] " Maxime Ripard
2017-06-07  6:59     ` [U-Boot] [linux-sunxi] " Icenowy Zheng
2017-06-07  7:54       ` Marc Zyngier
2017-06-07  0:47 ` [U-Boot] [RFC PATCH 8/8] sunxi: enable PSCI for A83T SoC Icenowy Zheng
2017-06-07  3:36   ` [U-Boot] [linux-sunxi] " Chen-Yu Tsai
2017-06-07  3:40     ` Icenowy Zheng
2017-06-07  3:47       ` Chen-Yu Tsai
2017-06-07  6:50         ` Maxime Ripard
2017-06-07  6:58           ` Icenowy Zheng
2017-06-07  7:00           ` Chen-Yu Tsai
2017-06-07 12:11             ` Marc Zyngier
2017-06-07 12:12               ` Icenowy Zheng
2017-06-07 12:51                 ` Marc Zyngier
2017-06-07 13:04                   ` Maxime Ripard
2017-06-07 14:06                     ` Marc Zyngier
2017-07-02 14:17                       ` Maxime Ripard
2017-07-02 15:40                         ` André Przywara
2017-07-03  8:21                           ` Maxime Ripard
2017-06-23 13:24                   ` icenowy at aosc.io
2017-06-23 13:35                     ` Maxime Ripard
2017-06-23 13:39                       ` icenowy at aosc.io
2017-06-23 13:50                         ` Chen-Yu Tsai
2017-07-02  7:08                           ` icenowy at aosc.io
2017-07-02 11:22                             ` Marc Zyngier
2017-07-02 12:36                               ` icenowy at aosc.io
2017-07-02 15:27                                 ` Marc Zyngier
2017-07-03 20:37                                   ` Maxime Ripard

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=20170607004721.24194-2-icenowy@aosc.io \
    --to=icenowy@aosc.io \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.