[U-Boot] [PATCH v2 3/7] arm: rmobile: rcar: Move arch_preboot_os function to rcar-gen2-common/common.c

Nobuhiro Iwamatsu nobuhiro.iwamatsu.yj at renesas.com
Tue Dec 2 08:52:20 CET 2014


The arch_preboot_os function used in boards using R-Car ARM SoC (r8a7790,
r8a7791, r8a7793 and r8a7794) is common.
This makes rcar-gen2-common/common.c file providing common function for
R-Car ARM SoC, and moves this function to this file.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
---
 board/renesas/alt/Makefile              |  2 +-
 board/renesas/alt/alt.c                 |  6 ------
 board/renesas/gose/Makefile             |  2 +-
 board/renesas/gose/gose.c               | 10 ----------
 board/renesas/koelsch/Makefile          |  2 +-
 board/renesas/koelsch/koelsch.c         |  6 ------
 board/renesas/lager/Makefile            |  2 +-
 board/renesas/lager/lager.c             |  6 ------
 board/renesas/rcar-gen2-common/common.c | 27 +++++++++++++++++++++++++++
 9 files changed, 31 insertions(+), 32 deletions(-)
 create mode 100644 board/renesas/rcar-gen2-common/common.c

diff --git a/board/renesas/alt/Makefile b/board/renesas/alt/Makefile
index 9ed12bd..6904e39 100644
--- a/board/renesas/alt/Makefile
+++ b/board/renesas/alt/Makefile
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y	:= alt.o qos.o
+obj-y	:= alt.o qos.o ../rcar-gen2-common/common.o
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index e3cfe54..c794d43 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -60,12 +60,6 @@ int board_early_init_f(void)
 	return 0;
 }
 
-void arch_preboot_os(void)
-{
-	/* Disable TMU0 */
-	mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 int board_init(void)
 {
 	/* adress of boot parameters */
diff --git a/board/renesas/gose/Makefile b/board/renesas/gose/Makefile
index a4fb6cc..2dac748 100644
--- a/board/renesas/gose/Makefile
+++ b/board/renesas/gose/Makefile
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y	:= gose.o qos.o
+obj-y	:= gose.o qos.o ../rcar-gen2-common/common.o
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index 0b2d904..677b976 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -60,16 +60,6 @@ int board_early_init_f(void)
 	return 0;
 }
 
-#define TSTR0		0x04
-#define TSTR0_STR0	0x01
-void arch_preboot_os(void)
-{
-	/* stop TMU0 */
-	mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0);
-	/* Disable TMU0 */
-	mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 #define PUPR5		0xE6060114
 #define PUPR5_ETH	0x3FFC0000
 #define PUPR5_ETH_MAGIC	(1 << 27)
diff --git a/board/renesas/koelsch/Makefile b/board/renesas/koelsch/Makefile
index b4d0183..c10bba5 100644
--- a/board/renesas/koelsch/Makefile
+++ b/board/renesas/koelsch/Makefile
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y	:= koelsch.o qos.o
+obj-y	:= koelsch.o qos.o ../rcar-gen2-common/common.o
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index 5ebbfcf..10fa571 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -61,12 +61,6 @@ int board_early_init_f(void)
 	return 0;
 }
 
-void arch_preboot_os(void)
-{
-	/* Disable TMU0 */
-	mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 /* LSI pin pull-up control */
 #define PUPR5 0xe6060114
 #define PUPR5_ETH 0x3FFC0000
diff --git a/board/renesas/lager/Makefile b/board/renesas/lager/Makefile
index 034c6f8..8d03461 100644
--- a/board/renesas/lager/Makefile
+++ b/board/renesas/lager/Makefile
@@ -6,4 +6,4 @@
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y	:= lager.o qos.o
+obj-y	:= lager.o qos.o ../rcar-gen2-common/common.o
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 47cf51b..4afb1ac 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -67,12 +67,6 @@ int board_early_init_f(void)
 	return 0;
 }
 
-void arch_preboot_os(void)
-{
-	/* Disable TMU0 */
-	mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 DECLARE_GLOBAL_DATA_PTR;
 int board_init(void)
 {
diff --git a/board/renesas/rcar-gen2-common/common.c b/board/renesas/rcar-gen2-common/common.c
new file mode 100644
index 0000000..23010ee
--- /dev/null
+++ b/board/renesas/rcar-gen2-common/common.c
@@ -0,0 +1,27 @@
+/*
+ * board/renesas/rcar-gen2-common/common.c
+ *
+ * Copyright (C) 2013 Renesas Electronics Corporation
+ * Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/rmobile.h>
+#include <asm/arch/rcar-mstp.h>
+
+#define TSTR0		0x04
+#define TSTR0_STR0	0x01
+
+#define TMU0_MSTP125	(1 << 25)
+void arch_preboot_os(void)
+{
+	/* stop TMU0 */
+	mstp_clrbits_le32(TMU_BASE + TSTR0, TMU_BASE + TSTR0, TSTR0_STR0);
+
+	/* Disable TMU0 */
+	mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
+}
-- 
2.1.3



More information about the U-Boot mailing list