# SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y  := alt.o qos.o
+obj-y  := alt.o qos.o ../rcar-gen2-common/common.o
 
        return 0;
 }
 
-void arch_preboot_os(void)
-{
-       /* Disable TMU0 */
-       mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 int board_init(void)
 {
        /* adress of boot parameters */
 
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y  := gose.o qos.o
+obj-y  := gose.o qos.o ../rcar-gen2-common/common.o
 
        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)
 
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y  := koelsch.o qos.o
+obj-y  := koelsch.o qos.o ../rcar-gen2-common/common.o
 
        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
 
 # SPDX-License-Identifier: GPL-2.0
 #
 
-obj-y  := lager.o qos.o
+obj-y  := lager.o qos.o ../rcar-gen2-common/common.o
 
        return 0;
 }
 
-void arch_preboot_os(void)
-{
-       /* Disable TMU0 */
-       mstp_setbits_le32(MSTPSR1, SMSTPCR1, TMU0_MSTP125);
-}
-
 DECLARE_GLOBAL_DATA_PTR;
 int board_init(void)
 {
 
--- /dev/null
+/*
+ * board/renesas/rcar-gen2-common/common.c
+ *
+ * Copyright (C) 2013 Renesas Electronics Corporation
+ * Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@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);
+}