]> git.baikalelectronics.ru Git - uboot.git/commitdiff
ARM: rmobile: Factor out common R-Car V3M/V3H board code
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Wed, 31 May 2023 18:24:34 +0000 (20:24 +0200)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Thu, 8 Jun 2023 20:26:51 +0000 (22:26 +0200)
Pull common board initialization code from V3M Eagle board
into rcar-common/v3-common.c so it can be re-used by other
V3M/V3H boards.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
board/renesas/eagle/Makefile
board/renesas/eagle/eagle.c [deleted file]
board/renesas/rcar-common/v3-common.c [new file with mode: 0644]

index 062c46ba24fa2bcf958359f6c7430f1ed575f144..9fb6a7c0f0ab7f166d4ff54348ac21b4ce12aea8 100644 (file)
@@ -9,5 +9,5 @@
 ifdef CONFIG_SPL_BUILD
 obj-y  := ../rcar-common/gen3-spl.o
 else
-obj-y  := eagle.o ../rcar-common/common.o
+obj-y  := ../rcar-common/v3-common.o ../rcar-common/common.o
 endif
diff --git a/board/renesas/eagle/eagle.c b/board/renesas/eagle/eagle.c
deleted file mode 100644 (file)
index e9e8059..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * board/renesas/eagle/eagle.c
- *     This file is Eagle board support.
- *
- * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.com>
- */
-
-#include <common.h>
-#include <clock_legacy.h>
-#include <cpu_func.h>
-#include <hang.h>
-#include <init.h>
-#include <malloc.h>
-#include <netdev.h>
-#include <dm.h>
-#include <asm/global_data.h>
-#include <dm/platform_data/serial_sh.h>
-#include <asm/processor.h>
-#include <asm/mach-types.h>
-#include <asm/io.h>
-#include <linux/errno.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/gpio.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/rmobile.h>
-#include <asm/arch/rcar-mstp.h>
-#include <asm/arch/sh_sdhi.h>
-#include <i2c.h>
-#include <mmc.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define CPGWPR  0xE6150900
-#define CPGWPCR        0xE6150904
-
-/* PLL */
-#define PLL0CR         0xE61500D8
-#define PLL0_STC_MASK  0x7F000000
-#define PLL0_STC_OFFSET        24
-
-#define CLK2MHZ(clk)   (clk / 1000 / 1000)
-void s_init(void)
-{
-       struct rcar_rwdt *rwdt = (struct rcar_rwdt *)RWDT_BASE;
-       struct rcar_swdt *swdt = (struct rcar_swdt *)SWDT_BASE;
-       u32 stc;
-
-       /* Watchdog init */
-       writel(0xA5A5A500, &rwdt->rwtcsra);
-       writel(0xA5A5A500, &swdt->swtcsra);
-
-       /* CPU frequency setting. Set to 0.8GHz */
-       stc = ((800 / CLK2MHZ(get_board_sys_clk())) - 1) << PLL0_STC_OFFSET;
-       clrsetbits_le32(PLL0CR, PLL0_STC_MASK, stc);
-}
-
-int board_early_init_f(void)
-{
-       /* Unlock CPG access */
-       writel(0xA5A5FFFF, CPGWPR);
-       writel(0x5A5A0000, CPGWPCR);
-
-       return 0;
-}
-
-int board_init(void)
-{
-       return 0;
-}
diff --git a/board/renesas/rcar-common/v3-common.c b/board/renesas/rcar-common/v3-common.c
new file mode 100644 (file)
index 0000000..be8be0c
--- /dev/null
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>
+ */
+
+#include <common.h>
+#include <clock_legacy.h>
+#include <asm/io.h>
+
+#define CPGWPR  0xE6150900
+#define CPGWPCR        0xE6150904
+
+/* PLL */
+#define PLL0CR         0xE61500D8
+#define PLL0_STC_MASK  0x7F000000
+#define PLL0_STC_OFFSET        24
+
+#define CLK2MHZ(clk)   (clk / 1000 / 1000)
+void s_init(void)
+{
+       struct rcar_rwdt *rwdt = (struct rcar_rwdt *)RWDT_BASE;
+       struct rcar_swdt *swdt = (struct rcar_swdt *)SWDT_BASE;
+       u32 stc;
+
+       /* Watchdog init */
+       writel(0xA5A5A500, &rwdt->rwtcsra);
+       writel(0xA5A5A500, &swdt->swtcsra);
+
+       /* CPU frequency setting. Set to 0.8GHz */
+       stc = ((800 / CLK2MHZ(get_board_sys_clk())) - 1) << PLL0_STC_OFFSET;
+       clrsetbits_le32(PLL0CR, PLL0_STC_MASK, stc);
+}
+
+int board_early_init_f(void)
+{
+       /* Unlock CPG access */
+       writel(0xA5A5FFFF, CPGWPR);
+       writel(0x5A5A0000, CPGWPCR);
+
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}