Skip to contentSkip to conversation

Make tzpc initialization common for exynos4 and exynos5

PATCH Superseded Inderpal Singh 2 participants 8 messages Mar 15, 2013 – Apr 5, 2013

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Make tzpc initialization common for exynos4 and exynos5

The first patch moves the tzpc_init file from smdk5250 to armv7/exynos. The second makes tzpc_init common for exynos4 and exynos5. And the third makes necessary changes to exynos4 based origen and smdkv310 boards.

The patchset has been tested on exynos4 based origen and exynos5 based Arndale board.

Changes in v2:
- removed uninitialised warning for start and end variables
- corrected the SPL_TEXT_BASE for origen and smdkv310
- Added Chander's Acked-by

Inderpal Singh (3):
exynos: move tzpc_init to armv7/exynos
exynos: update tzpc_init to make it common for exynos4 and exynos5
exynos: Update origen and smdkv310 to use common tzpc_init

 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   57 +++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/s5p-common/Makefile  |    2 ++
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 +++++++++++++++
 board/samsung/origen/lowlevel_init.S    |   44 ++---------------------
 board/samsung/origen/origen_setup.h     |   25 -------------
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/lowlevel_init.S  |    2 ++
 board/samsung/smdk5250/setup.h          |   25 -------------
 board/samsung/smdk5250/tzpc_init.c      |   48 -------------------------
 board/samsung/smdkv310/lowlevel_init.S  |   60 ++-----------------------------
 include/configs/exynos5250-dt.h         |    2 --
 include/configs/origen.h                |    2 ++
 include/configs/smdkv310.h              |    2 ++
 spl/Makefile                            |    4 +++
 15 files changed, 102 insertions(+), 202 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/3 exynos: move tzpc_init to armv7/exynos

tzpc_init is common for all exynos5 boards, hence move it to armv7/exynos so that all other boards can use it.

Also update the smdk5250 Makefile and config file.

---
 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   48 +++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 ++++++++++++++++++
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/setup.h          |   25 ----------------
 board/samsung/smdk5250/tzpc_init.c      |   48 -------------------------------
 include/configs/exynos5250-dt.h         |    2 --
 7 files changed, 77 insertions(+), 77 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c
arch/arm/cpu/armv7/exynos/Makefile +1 -1
index 9119961..b9cf921 100644
@@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).o
 
-COBJS	+= clock.o power.o soc.o system.o pinmux.o
+COBJS	+= clock.o power.o soc.o system.o pinmux.o tzpc_init.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/exynos/tzpc_init.c new file +48 -0

48 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/tzpc.h +28 -0
index c5eb4b1..050ad70 100644
@@ -47,6 +47,34 @@ struct exynos_tzpc {
 	unsigned int pcellid2;
 	unsigned int pcellid3;
 };
+
+/* TZPC : Register Offsets */
+#define TZPC0_BASE		0x10100000
+#define TZPC1_BASE		0x10110000
+#define TZPC2_BASE		0x10120000
+#define TZPC3_BASE		0x10130000
+#define TZPC4_BASE		0x10140000
+#define TZPC5_BASE		0x10150000
+#define TZPC6_BASE		0x10160000
+#define TZPC7_BASE		0x10170000
+#define TZPC8_BASE		0x10180000
+#define TZPC9_BASE		0x10190000
+
+#define TZPC_BASE_OFFSET		0x10000
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x0 : Size of secured ram
+ */
+#define R0SIZE			0x0
+
+/*
+ * TZPC Decode Protection Register Value :
+ * DECPROTXSET: 0xFF : Set Decode region to non-secure
+ */
+#define DECPROTXSET		0xFF
+void tzpc_init(void);
+
 #endif
 
 #endif
board/samsung/smdk5250/Makefile +0 -1
index ecca9f3..f2c32ee 100644
@@ -28,7 +28,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	:= clock_init.o
 COBJS	+= dmc_common.o dmc_init_ddr3.o
-COBJS	+= tzpc_init.o
 COBJS	+= smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
board/samsung/smdk5250/setup.h +0 -25
index a159601..8c1a3f4 100644
@@ -28,18 +28,6 @@
 #include <config.h>
 #include <asm/arch/dmc.h>
 
-/* TZPC : Register Offsets */
-#define TZPC0_BASE		0x10100000
-#define TZPC1_BASE		0x10110000
-#define TZPC2_BASE		0x10120000
-#define TZPC3_BASE		0x10130000
-#define TZPC4_BASE		0x10140000
-#define TZPC5_BASE		0x10150000
-#define TZPC6_BASE		0x10160000
-#define TZPC7_BASE		0x10170000
-#define TZPC8_BASE		0x10180000
-#define TZPC9_BASE		0x10190000
-
 /* APLL_CON1	*/
 #define APLL_CON1_VAL	(0x00203800)
 
@@ -458,18 +446,6 @@
 /* CLK_GATE_IP_DISP1 */
 #define CLK_GATE_DP1_ALLOW	(1 << 4)
 
-/*
- * TZPC Register Value :
- * R0SIZE: 0x0 : Size of secured ram
- */
-#define R0SIZE			0x0
-
-/*
- * TZPC Decode Protection Register Value :
- * DECPROTXSET: 0xFF : Set Decode region to non-secure
- */
-#define DECPROTXSET		0xFF
-
 #define DDR3PHY_CTRL_PHY_RESET	(1 << 0)
 #define DDR3PHY_CTRL_PHY_RESET_OFF	(0 << 0)
 
@@ -590,5 +566,4 @@ void update_reset_dll(struct exynos5_dmc *, enum ddr_mode);
 void sdelay(unsigned long);
 void mem_ctrl_init(void);
 void system_clock_init(void);
-void tzpc_init(void);
 #endif
board/samsung/smdk5250/tzpc_init.c deleted +0 -48

48 lines not on this page · raw message

include/configs/exynos5250-dt.h +0 -2
index c03dcf7..8ac05aa 100644
@@ -87,8 +87,6 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	EXYNOS_DEVICE_SETTINGS
 
-#define TZPC_BASE_OFFSET		0x10000
-
 /* SD/MMC configuration */
 #define CONFIG_GENERIC_MMC
 #define CONFIG_MMC
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/3 exynos: move tzpc_init to armv7/exynos

Dear Inderpal Singh,

Quoted 24 lines · Inderpal Singh

tzpc_init is common for all exynos5 boards, hence move it to armv7/exynos so that all other boards can use it.

Also update the smdk5250 Makefile and config file.

---
 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   48 +++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 ++++++++++++++++++
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/setup.h          |   25 ----------------
 board/samsung/smdk5250/tzpc_init.c      |   48 -------------------------------
 include/configs/exynos5250-dt.h         |    2 --
 7 files changed, 77 insertions(+), 77 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c
arch/arm/cpu/armv7/exynos/Makefile +0 -0
index 9119961..b9cf921 100644

arch/arm/cpu/armv7/exynos/Makefile include $(TOPDIR)/config.mk · line 25

Quoted 5 lines
arch/arm/cpu/armv7/exynos/Makefile +1 -1
@@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).o
 
-COBJS	+= clock.o power.o soc.o system.o pinmux.o
+COBJS	+= clock.o power.o soc.o system.o pinmux.o tzpc_init.o

patch looks good.
but, do we need to build tzpc always?
and please rename tzpc_init.c to just tzpc.c.

Quoted 67 lines
arch/arm/cpu/armv7/exynos/Makefile +0 -0
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/exynos/tzpc_init.c new file +48 -0
new file mode 100644
index 0000000..81adb4b
@@ -0,0 +1,48 @@
+/*
+ * Lowlevel setup for SMDK5250 board based on S5PC520
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/arch/tzpc.h>
+#include <asm/io.h>
+
+/* Setting TZPC[TrustZone Protection Controller] */
+void tzpc_init(void)
+{
+	struct exynos_tzpc *tzpc;
+	unsigned int addr;
+
+	for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
+		tzpc = (struct exynos_tzpc *)addr;
+
+		if (addr == TZPC0_BASE)
+			writel(R0SIZE, &tzpc->r0size);
+
+		writel(DECPROTXSET, &tzpc->decprot0set);
+		writel(DECPROTXSET, &tzpc->decprot1set);
+
+		if (addr != TZPC9_BASE) {
+			writel(DECPROTXSET, &tzpc->decprot2set);
+			writel(DECPROTXSET, &tzpc->decprot3set);
+		}
+	}
+}
arch/arm/include/asm/arch-exynos/tzpc.h +2 -0
index c5eb4b1..050ad70 100644
@@ -47,6 +47,34 @@ struct exynos_tzpc {
 	unsigned int pcellid2;
 	unsigned int pcellid3;
 };
+
+/* TZPC : Register Offsets */

arch/arm/include/asm/arch-exynos/tzpc.h struct exynos_tzpc { · line 61

Quoted 10 lines
arch/arm/include/asm/arch-exynos/tzpc.h +10 -0
+#define TZPC0_BASE		0x10100000
+#define TZPC1_BASE		0x10110000
+#define TZPC2_BASE		0x10120000
+#define TZPC3_BASE		0x10130000
+#define TZPC4_BASE		0x10140000
+#define TZPC5_BASE		0x10150000
+#define TZPC6_BASE		0x10160000
+#define TZPC7_BASE		0x10170000
+#define TZPC8_BASE		0x10180000
+#define TZPC9_BASE		0x10190000

we did not need these defines.
please use samsung_get_base_tzpc().

Quoted 139 lines
arch/arm/include/asm/arch-exynos/tzpc.h +16 -0
+
+#define TZPC_BASE_OFFSET		0x10000
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x0 : Size of secured ram
+ */
+#define R0SIZE			0x0
+
+/*
+ * TZPC Decode Protection Register Value :
+ * DECPROTXSET: 0xFF : Set Decode region to non-secure
+ */
+#define DECPROTXSET		0xFF
+void tzpc_init(void);
+
 #endif
 
 #endif
board/samsung/smdk5250/Makefile +0 -1
index ecca9f3..f2c32ee 100644
@@ -28,7 +28,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	:= clock_init.o
 COBJS	+= dmc_common.o dmc_init_ddr3.o
-COBJS	+= tzpc_init.o
 COBJS	+= smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
board/samsung/smdk5250/setup.h +0 -25
index a159601..8c1a3f4 100644
@@ -28,18 +28,6 @@
 #include <config.h>
 #include <asm/arch/dmc.h>
 
-/* TZPC : Register Offsets */
-#define TZPC0_BASE		0x10100000
-#define TZPC1_BASE		0x10110000
-#define TZPC2_BASE		0x10120000
-#define TZPC3_BASE		0x10130000
-#define TZPC4_BASE		0x10140000
-#define TZPC5_BASE		0x10150000
-#define TZPC6_BASE		0x10160000
-#define TZPC7_BASE		0x10170000
-#define TZPC8_BASE		0x10180000
-#define TZPC9_BASE		0x10190000
-
 /* APLL_CON1	*/
 #define APLL_CON1_VAL	(0x00203800)
 
@@ -458,18 +446,6 @@
 /* CLK_GATE_IP_DISP1 */
 #define CLK_GATE_DP1_ALLOW	(1 << 4)
 
-/*
- * TZPC Register Value :
- * R0SIZE: 0x0 : Size of secured ram
- */
-#define R0SIZE			0x0
-
-/*
- * TZPC Decode Protection Register Value :
- * DECPROTXSET: 0xFF : Set Decode region to non-secure
- */
-#define DECPROTXSET		0xFF
-
 #define DDR3PHY_CTRL_PHY_RESET	(1 << 0)
 #define DDR3PHY_CTRL_PHY_RESET_OFF	(0 << 0)
 
@@ -590,5 +566,4 @@ void update_reset_dll(struct exynos5_dmc *, enum ddr_mode);
 void sdelay(unsigned long);
 void mem_ctrl_init(void);
 void system_clock_init(void);
-void tzpc_init(void);
 #endif
board/samsung/smdk5250/tzpc_init.c deleted +0 -48
deleted file mode 100644
index c833541..0000000
@@ -1,48 +0,0 @@
-/*
- * Lowlevel setup for SMDK5250 board based on S5PC520
- *
- * Copyright (C) 2012 Samsung Electronics
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <asm/arch/tzpc.h>
-#include"setup.h"
-
-/* Setting TZPC[TrustZone Protection Controller] */
-void tzpc_init(void)
-{
-	struct exynos_tzpc *tzpc;
-	unsigned int addr;
-
-	for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
-		tzpc = (struct exynos_tzpc *)addr;
-
-		if (addr == TZPC0_BASE)
-			writel(R0SIZE, &tzpc->r0size);
-
-		writel(DECPROTXSET, &tzpc->decprot0set);
-		writel(DECPROTXSET, &tzpc->decprot1set);
-
-		if (addr != TZPC9_BASE) {
-			writel(DECPROTXSET, &tzpc->decprot2set);
-			writel(DECPROTXSET, &tzpc->decprot3set);
-		}
-	}
-}
include/configs/exynos5250-dt.h +0 -0
index c03dcf7..8ac05aa 100644

include/configs/exynos5250-dt.h line 92

Quoted 8 lines
include/configs/exynos5250-dt.h +0 -2
@@ -87,8 +87,6 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	EXYNOS_DEVICE_SETTINGS
 
-#define TZPC_BASE_OFFSET		0x10000
-
 /* SD/MMC configuration */
 #define CONFIG_GENERIC_MMC
 #define CONFIG_MMC

Thanks,
Minkyu Kang.

#3 lore raw

PATCH v2 1/3 exynos: move tzpc_init to armv7/exynos

Dear Minkyu,

Thanks for the review.

Quoted 31 lines · Minkyu Kang

Dear Inderpal Singh,

Quoted 10 lines · Inderpal Singh

tzpc_init is common for all exynos5 boards, hence move it to armv7/exynos so that all other boards can use it.

Also update the smdk5250 Makefile and config file.

---
 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   48

+++++++++++++++++++++++++++++++

Quoted 4 lines
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 ++++++++++++++++++
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/setup.h          |   25 ----------------
 board/samsung/smdk5250/tzpc_init.c      |   48

-------------------------------

Review

Quoted 6 lines
 include/configs/exynos5250-dt.h         |    2 --
 7 files changed, 77 insertions(+), 77 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/exynos/Makefile

Quoted 5 lines

index 9119961..b9cf921 100644

arch/arm/cpu/armv7/exynos/Makefile +0 -0
@@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk
 
Quoted 9 lines

arch/arm/cpu/armv7/exynos/Makefile include $(TOPDIR)/config.mk · line 25

Quoted 4 lines
arch/arm/cpu/armv7/exynos/Makefile +1 -1
 LIB  = $(obj)lib$(SOC).o
 
-COBJS        += clock.o power.o soc.o system.o pinmux.o
+COBJS        += clock.o power.o soc.o system.o pinmux.o tzpc_init.o

patch looks good.
but, do we need to build tzpc always?
and please rename tzpc_init.c to just tzpc.c.

Yes, we need it always.
I have renamed the file to tzpc.c in the v3 version.

Quoted 76 lines

Review

Quoted 5 lines
arch/arm/cpu/armv7/exynos/Makefile +0 -0
 SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
(quoted diff) +0 -0

b/arch/arm/cpu/armv7/exynos/tzpc_init.c

Quoted 29 lines

new file mode 100644
index 0000000..81adb4b

arch/arm/cpu/armv7/exynos/tzpc_init.c new file +24 -0
@@ -0,0 +1,48 @@
+/*
+ * Lowlevel setup for SMDK5250 board based on S5PC520
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+

arch/arm/cpu/armv7/exynos/tzpc_init.c line 34

Quoted 10 lines
arch/arm/cpu/armv7/exynos/tzpc_init.c new file +10 -0
+#include <asm/arch/tzpc.h>
+#include <asm/io.h>
+
+/* Setting TZPC[TrustZone Protection Controller] */
+void tzpc_init(void)
+{
+     struct exynos_tzpc *tzpc;
+     unsigned int addr;
+
+     for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr +=

TZPC_BASE_OFFSET) {

Review

Quoted 15 lines
arch/arm/cpu/armv7/exynos/tzpc_init.c new file +14 -0
+             tzpc = (struct exynos_tzpc *)addr;
+
+             if (addr == TZPC0_BASE)
+                     writel(R0SIZE, &tzpc->r0size);
+
+             writel(DECPROTXSET, &tzpc->decprot0set);
+             writel(DECPROTXSET, &tzpc->decprot1set);
+
+             if (addr != TZPC9_BASE) {
+                     writel(DECPROTXSET, &tzpc->decprot2set);
+                     writel(DECPROTXSET, &tzpc->decprot3set);
+             }
+     }
+}
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/tzpc.h

Quoted 14 lines

index c5eb4b1..050ad70 100644

arch/arm/include/asm/arch-exynos/tzpc.h +7 -0
@@ -47,6 +47,34 @@ struct exynos_tzpc {
      unsigned int pcellid2;
      unsigned int pcellid3;
 };
+
+/* TZPC : Register Offsets */
+#define TZPC0_BASE           0x10100000
+#define TZPC1_BASE           0x10110000
+#define TZPC2_BASE           0x10120000
+#define TZPC3_BASE           0x10130000
+#define TZPC4_BASE           0x10140000
Quoted 9 lines

arch/arm/include/asm/arch-exynos/tzpc.h struct exynos_tzpc { · line 61

Quoted 5 lines
arch/arm/include/asm/arch-exynos/tzpc.h +5 -0
+#define TZPC5_BASE           0x10150000
+#define TZPC6_BASE           0x10160000
+#define TZPC7_BASE           0x10170000
+#define TZPC8_BASE           0x10180000
+#define TZPC9_BASE           0x10190000

we did not need these defines.
please use samsung_get_base_tzpc().

Yes, good point.
Have removed these macros and used samsung_get_base tzpc in v3.

With Regards,
Inder

Quoted 159 lines

Review

Quoted 21 lines
arch/arm/include/asm/arch-exynos/tzpc.h +16 -0
+
+#define TZPC_BASE_OFFSET             0x10000
+
+/*
+ * TZPC Register Value :
+ * R0SIZE: 0x0 : Size of secured ram
+ */
+#define R0SIZE                       0x0
+
+/*
+ * TZPC Decode Protection Register Value :
+ * DECPROTXSET: 0xFF : Set Decode region to non-secure
+ */
+#define DECPROTXSET          0xFF
+void tzpc_init(void);
+
 #endif
 
 #endif
(quoted diff) +0 -0

b/board/samsung/smdk5250/Makefile

Review

Quoted 12 lines

index ecca9f3..f2c32ee 100644

board/samsung/smdk5250/Makefile +0 -1
@@ -28,7 +28,6 @@ SOBJS       := lowlevel_init.o
 
 COBJS        := clock_init.o
 COBJS        += dmc_common.o dmc_init_ddr3.o
-COBJS        += tzpc_init.o
 COBJS        += smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
(quoted diff) +0 -0

b/board/samsung/smdk5250/setup.h

board/samsung/smdk5250/setup.h void update_reset_dll(struct exynos5_dmc *, enum

Quoted 42 lines

index a159601..8c1a3f4 100644

board/samsung/smdk5250/setup.h +0 -24
@@ -28,18 +28,6 @@
 #include <config.h>
 #include <asm/arch/dmc.h>
 
-/* TZPC : Register Offsets */
-#define TZPC0_BASE           0x10100000
-#define TZPC1_BASE           0x10110000
-#define TZPC2_BASE           0x10120000
-#define TZPC3_BASE           0x10130000
-#define TZPC4_BASE           0x10140000
-#define TZPC5_BASE           0x10150000
-#define TZPC6_BASE           0x10160000
-#define TZPC7_BASE           0x10170000
-#define TZPC8_BASE           0x10180000
-#define TZPC9_BASE           0x10190000
-
 /* APLL_CON1 */
 #define APLL_CON1_VAL        (0x00203800)
 
@@ -458,18 +446,6 @@
 /* CLK_GATE_IP_DISP1 */
 #define CLK_GATE_DP1_ALLOW   (1 << 4)
 
-/*
- * TZPC Register Value :
- * R0SIZE: 0x0 : Size of secured ram
- */
-#define R0SIZE                       0x0
-
-/*
- * TZPC Decode Protection Register Value :
- * DECPROTXSET: 0xFF : Set Decode region to non-secure
- */
-#define DECPROTXSET          0xFF
-
 #define DDR3PHY_CTRL_PHY_RESET       (1 << 0)
 #define DDR3PHY_CTRL_PHY_RESET_OFF   (0 << 0)
 
@@ -590,5 +566,4 @@ void update_reset_dll(struct exynos5_dmc *, enum

ddr_mode);

Review

Quoted 6 lines
board/samsung/smdk5250/setup.h +0 -1
 void sdelay(unsigned long);
 void mem_ctrl_init(void);
 void system_clock_init(void);
-void tzpc_init(void);
 #endif
(quoted diff) +0 -0

b/board/samsung/smdk5250/tzpc_init.c

Quoted 29 lines

deleted file mode 100644
index c833541..0000000

board/samsung/smdk5250/tzpc_init.c deleted +0 -24
@@ -1,48 +0,0 @@
-/*
- * Lowlevel setup for SMDK5250 board based on S5PC520
- *
- * Copyright (C) 2012 Samsung Electronics
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-

board/samsung/smdk5250/tzpc_init.c line 34

Quoted 10 lines
board/samsung/smdk5250/tzpc_init.c deleted +0 -10
-#include <asm/arch/tzpc.h>
-#include"setup.h"
-
-/* Setting TZPC[TrustZone Protection Controller] */
-void tzpc_init(void)
-{
-     struct exynos_tzpc *tzpc;
-     unsigned int addr;
-
-     for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr +=

TZPC_BASE_OFFSET) {

Review

Quoted 15 lines
board/samsung/smdk5250/tzpc_init.c deleted +0 -14
-             tzpc = (struct exynos_tzpc *)addr;
-
-             if (addr == TZPC0_BASE)
-                     writel(R0SIZE, &tzpc->r0size);
-
-             writel(DECPROTXSET, &tzpc->decprot0set);
-             writel(DECPROTXSET, &tzpc->decprot1set);
-
-             if (addr != TZPC9_BASE) {
-                     writel(DECPROTXSET, &tzpc->decprot2set);
-                     writel(DECPROTXSET, &tzpc->decprot3set);
-             }
-     }
-}
(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h

include/configs/exynos5250-dt.h line 92

Quoted 13 lines

index c03dcf7..8ac05aa 100644

include/configs/exynos5250-dt.h +0 -2
@@ -87,8 +87,6 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
      EXYNOS_DEVICE_SETTINGS
 
-#define TZPC_BASE_OFFSET             0x10000
-
 /* SD/MMC configuration */
 #define CONFIG_GENERIC_MMC
 #define CONFIG_MMC

Thanks,
Minkyu Kang.

#4 lore raw

PATCH v2 2/3 exynos: update tzpc_init to make it common for exynos4 and exynos5

In reply to Inderpal Singh

This requires that cpu_is_exynos4/5 should be made available before tzpc_init. Hence this patch also makes necessary changes to have cpu_info in spl and invokes arch_cpu_init before tzpc_init in low_level_init.S for smdk5250.

---
 arch/arm/cpu/armv7/exynos/tzpc_init.c  |   15 ++++++++++++---
 arch/arm/cpu/armv7/s5p-common/Makefile |    2 ++
 board/samsung/smdk5250/lowlevel_init.S |    2 ++
 spl/Makefile                           |    4 ++++
 4 files changed, 20 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/exynos/tzpc_init.c +12 -3
index 81adb4b..5204fb1 100644
@@ -22,6 +22,7 @@
  * MA 02111-1307 USA
  */
 
+#include <common.h>
 #include <asm/arch/tzpc.h>
 #include <asm/io.h>
 
@@ -29,12 +30,20 @@
 void tzpc_init(void)
 {
 	struct exynos_tzpc *tzpc;
-	unsigned int addr;
+	unsigned int addr, start = 0, end = 0;
 
-	for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
+	if (cpu_is_exynos5()) {
+		start = TZPC0_BASE;
+		end = TZPC9_BASE;
+	} else if (cpu_is_exynos4()) {
+		start = TZPC1_BASE;
+		end = TZPC6_BASE;
+	}
+
+	for (addr = start; addr <= end; addr += TZPC_BASE_OFFSET) {
 		tzpc = (struct exynos_tzpc *)addr;
 
-		if (addr == TZPC0_BASE)
+		if (addr == start)
 			writel(R0SIZE, &tzpc->r0size);
 
 		writel(DECPROTXSET, &tzpc->decprot0set);
arch/arm/cpu/armv7/s5p-common/Makefile +2 -0
index 1705399..0c38bd0 100644
@@ -26,9 +26,11 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)libs5p-common.o
 
 COBJS-y		+= cpu_info.o
+ifndef CONFIG_SPL_BUILD
 COBJS-y		+= timer.o
 COBJS-y		+= sromc.o
 COBJS-$(CONFIG_PWM)	+= pwm.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS))
board/samsung/smdk5250/lowlevel_init.S +2 -0
index bc6cb6f..edc565e 100644
@@ -75,12 +75,14 @@ lowlevel_init:
 	bl	mem_ctrl_init
 
 1:
+	bl	arch_cpu_init
 	bl	tzpc_init
 	ldmia	r13!, {ip,pc}
 
 wakeup_reset:
 	bl	system_clock_init
 	bl	mem_ctrl_init
+	bl	arch_cpu_init
 	bl	tzpc_init
 
 exit_wakeup:
spl/Makefile +4 -0
index 101d478..8d33210 100644
@@ -92,6 +92,10 @@ LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o
 LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o
 endif
 
+ifeq ($(SOC),exynos)
+LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
+endif
+
 # Add GCC lib
 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
 PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/libgcc.o
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v2 3/3 exynos: Update origen and smdkv310 to use common tzpc_init

In reply to Inderpal Singh
---
 board/samsung/origen/lowlevel_init.S   |   44 ++---------------------
 board/samsung/origen/origen_setup.h    |   25 -------------
 board/samsung/smdkv310/lowlevel_init.S |   60 ++------------------------------
 include/configs/origen.h               |    2 ++
 include/configs/smdkv310.h             |    2 ++
 5 files changed, 8 insertions(+), 125 deletions(-)
board/samsung/origen/lowlevel_init.S +2 -42
index 9daa0da..be9d418 100644
@@ -87,12 +87,14 @@ lowlevel_init:
 1:
 	/* for UART */
 	bl uart_asm_init
+	bl arch_cpu_init
 	bl tzpc_init
 	pop	{pc}
 
 wakeup_reset:
 	bl system_clock_init
 	bl mem_ctrl_asm_init
+	bl arch_cpu_init
 	bl tzpc_init
 
 exit_wakeup:
@@ -353,45 +355,3 @@ uart_asm_init:
 	nop
 	nop
 
-/* Setting TZPC[TrustZone Protection Controller] */
-tzpc_init:
-	ldr	r0, =TZPC0_BASE
-	mov	r1, #R0SIZE
-	str	r1, [r0]
-	mov	r1, #DECPROTXSET
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	ldr	r0, =TZPC1_BASE
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	ldr	r0, =TZPC2_BASE
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	ldr	r0, =TZPC3_BASE
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	ldr	r0, =TZPC4_BASE
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	ldr	r0, =TZPC5_BASE
-	str	r1, [r0, #TZPC_DECPROT0SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT1SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT2SET_OFFSET]
-	str	r1, [r0, #TZPC_DECPROT3SET_OFFSET]
-
-	mov	pc, lr
board/samsung/origen/origen_setup.h +0 -25
index 930b948..926a4cc 100644
@@ -121,19 +121,6 @@
 #define UBRDIV_OFFSET		0x28
 #define UFRACVAL_OFFSET		0x2C
 
-/* TZPC : Register Offsets */
-#define TZPC0_BASE		0x10110000
-#define TZPC1_BASE		0x10120000
-#define TZPC2_BASE		0x10130000
-#define TZPC3_BASE		0x10140000
-#define TZPC4_BASE		0x10150000
-#define TZPC5_BASE		0x10160000
-
-#define TZPC_DECPROT0SET_OFFSET	0x804
-#define TZPC_DECPROT1SET_OFFSET	0x810
-#define TZPC_DECPROT2SET_OFFSET	0x81C
-#define TZPC_DECPROT3SET_OFFSET	0x828
-
 /* CLK_SRC_CPU */
 #define MUX_HPM_SEL_MOUTAPLL		0x0
 #define MUX_HPM_SEL_SCLKMPLL		0x1
@@ -617,16 +604,4 @@
  * UBRFRACVAL = ((((800MHz*10/(115200*16) -10))%10)*16/10)
  */
 #define UFRACVAL_VAL		0x4
-
-/*
- * TZPC Register Value :
- * R0SIZE: 0x0 : Size of secured ram
- */
-#define R0SIZE			0x0
-
-/*
- * TZPC Decode Protection Register Value :
- * DECPROTXSET: 0xFF : Set Decode region to non-secure
- */
-#define DECPROTXSET		0xFF
 #endif
board/samsung/smdkv310/lowlevel_init.S +2 -58

75 lines not on this page · raw message

include/configs/origen.h +2 -0
index ff2b24d..e179911 100644
@@ -96,6 +96,8 @@
 #define CONFIG_SPL
 #define COPY_BL2_FNPTR_ADDR	0x02020030
 
+#define CONFIG_SPL_TEXT_BASE	0x02021410
+
 #define CONFIG_BOOTCOMMAND	"fatload mmc 0 40007000 uImage; bootm 40007000"
 
 /* Miscellaneous configurable options */
include/configs/smdkv310.h +2 -0
index b796b46..5e43066 100644
@@ -95,6 +95,8 @@
 #define CONFIG_SPL
 #define COPY_BL2_FNPTR_ADDR	0x00002488
 
+#define CONFIG_SPL_TEXT_BASE	0x02021410
+
 #define CONFIG_BOOTCOMMAND	"fatload mmc 0 40007000 uImage; bootm 40007000"
 
 /* Miscellaneous configurable options */
Signature · 1 line
1.7.9.5
#6 lore raw

v2 cover Make tzpc initialization common for exynos4 and exynos5

In reply to Inderpal Singh

Dear Minkyu,

Let me know your view about this patchset.

With Regards,
Inder

Quoted 39 lines · Inderpal Singh

The first patch moves the tzpc_init file from smdk5250 to armv7/exynos. The second makes tzpc_init common for exynos4 and exynos5. And the third makes necessary changes to exynos4 based origen and smdkv310 boards.

The patchset has been tested on exynos4 based origen and exynos5 based Arndale board.

Changes in v2:
- removed uninitialised warning for start and end variables
- corrected the SPL_TEXT_BASE for origen and smdkv310
- Added Chander's Acked-by

Inderpal Singh (3):
exynos: move tzpc_init to armv7/exynos
exynos: update tzpc_init to make it common for exynos4 and exynos5
exynos: Update origen and smdkv310 to use common tzpc_init

 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   57 +++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/s5p-common/Makefile  |    2 ++
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 +++++++++++++++
 board/samsung/origen/lowlevel_init.S    |   44 ++---------------------
 board/samsung/origen/origen_setup.h     |   25 -------------
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/lowlevel_init.S  |    2 ++
 board/samsung/smdk5250/setup.h          |   25 -------------
 board/samsung/smdk5250/tzpc_init.c      |   48 -------------------------
 board/samsung/smdkv310/lowlevel_init.S  |   60 ++-----------------------------
 include/configs/exynos5250-dt.h         |    2 --
 include/configs/origen.h                |    2 ++
 include/configs/smdkv310.h              |    2 ++
 spl/Makefile                            |    4 +++
 15 files changed, 102 insertions(+), 202 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c

--
1.7.9.5

#7 lore raw

v2 cover Make tzpc initialization common for exynos4 and exynos5

Quoted 48 lines · Inderpal Singh

Dear Minkyu,

Let me know your view about this patchset.

With Regards,
Inder

Quoted 39 lines · Inderpal Singh

The first patch moves the tzpc_init file from smdk5250 to armv7/exynos. The second makes tzpc_init common for exynos4 and exynos5. And the third makes necessary changes to exynos4 based origen and smdkv310 boards.

The patchset has been tested on exynos4 based origen and exynos5 based Arndale board.

Changes in v2:
- removed uninitialised warning for start and end variables
- corrected the SPL_TEXT_BASE for origen and smdkv310
- Added Chander's Acked-by

Inderpal Singh (3):
exynos: move tzpc_init to armv7/exynos
exynos: update tzpc_init to make it common for exynos4 and exynos5
exynos: Update origen and smdkv310 to use common tzpc_init

 arch/arm/cpu/armv7/exynos/Makefile      |    2 +-
 arch/arm/cpu/armv7/exynos/tzpc_init.c   |   57 +++++++++++++++++++++++++++++
 arch/arm/cpu/armv7/s5p-common/Makefile  |    2 ++
 arch/arm/include/asm/arch-exynos/tzpc.h |   28 +++++++++++++++
 board/samsung/origen/lowlevel_init.S    |   44 ++---------------------
 board/samsung/origen/origen_setup.h     |   25 -------------
 board/samsung/smdk5250/Makefile         |    1 -
 board/samsung/smdk5250/lowlevel_init.S  |    2 ++
 board/samsung/smdk5250/setup.h          |   25 -------------
 board/samsung/smdk5250/tzpc_init.c      |   48 -------------------------
 board/samsung/smdkv310/lowlevel_init.S  |   60 ++-----------------------------
 include/configs/exynos5250-dt.h         |    2 --
 include/configs/origen.h                |    2 ++
 include/configs/smdkv310.h              |    2 ++
 spl/Makefile                            |    4 +++
 15 files changed, 102 insertions(+), 202 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/exynos/tzpc_init.c
 delete mode 100644 board/samsung/smdk5250/tzpc_init.c

--
1.7.9.5

listed in my queue.

Thanks,
Minkyu Kang.