[PATCH 6/6] arm: rmobile: Add HopeRun HiHope RZ/G2N board support

Biju Das biju.das.jz at bp.renesas.com
Wed Sep 16 10:05:10 CEST 2020


The HiHope RZ/G2N board from HopeRun consists of main board
(HopeRun HiHope RZ/G2N main board) and sub board(HopeRun
HiHope RZ/G2N sub board). The HiHope RZ/G2N sub board sits
below the HiHope RZ/G2N main board.

DTS files apart from r8a774b1-hihope-rzg2n-u-boot.dts and
r8a774b1-u-boot.dtsi have been imported from Linux kernel 5.9-rc4, commit
f4d51dffc6c0 ("Linux 5.9-rc4")

This patch adds the required board support to boot HopeRun HiHope
RZ/G2N board.

Signed-off-by: Biju Das <biju.das.jz at bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
---
 arch/arm/dts/Makefile                         |  1 +
 arch/arm/dts/r8a774b1-hihope-rzg2n-ex.dts     | 16 ++++++
 arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts |  9 ++++
 arch/arm/dts/r8a774b1-hihope-rzg2n.dts        | 41 ++++++++++++++
 arch/arm/dts/r8a774b1-u-boot.dtsi             | 53 +++++++++++++++++++
 arch/arm/mach-rmobile/Kconfig.64              |  1 +
 board/hoperun/hihope-rzg2/hihope-rzg2.c       | 20 ++++++-
 configs/hihope_rzg2_defconfig                 |  2 +-
 8 files changed, 140 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/dts/r8a774b1-hihope-rzg2n-ex.dts
 create mode 100644 arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts
 create mode 100644 arch/arm/dts/r8a774b1-hihope-rzg2n.dts
 create mode 100644 arch/arm/dts/r8a774b1-u-boot.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ce7b561fcb..75a23020ef 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -785,6 +785,7 @@ dtb-$(CONFIG_RCAR_GEN2) += \
 dtb-$(CONFIG_RCAR_GEN3) += \
 	r8a774a1-beacon-rzg2m-kit.dtb \
 	r8a774a1-hihope-rzg2m-u-boot.dtb \
+	r8a774b1-hihope-rzg2n-u-boot.dtb \
 	r8a77950-ulcb-u-boot.dtb \
 	r8a77950-salvator-x-u-boot.dtb \
 	r8a77960-ulcb-u-boot.dtb \
diff --git a/arch/arm/dts/r8a774b1-hihope-rzg2n-ex.dts b/arch/arm/dts/r8a774b1-hihope-rzg2n-ex.dts
new file mode 100644
index 0000000000..a3edd55113
--- /dev/null
+++ b/arch/arm/dts/r8a774b1-hihope-rzg2n-ex.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the HiHope RZ/G2N Rev.3.0/4.0 connected to
+ * sub board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a774b1-hihope-rzg2n.dts"
+#include "hihope-rzg2-ex.dtsi"
+
+/ {
+	model = "HopeRun HiHope RZ/G2N with sub board";
+	compatible = "hoperun,hihope-rzg2-ex", "hoperun,hihope-rzg2n",
+		     "renesas,r8a774b1";
+};
diff --git a/arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts b/arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts
new file mode 100644
index 0000000000..43254ce4cb
--- /dev/null
+++ b/arch/arm/dts/r8a774b1-hihope-rzg2n-u-boot.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source extras for U-Boot for the Hihope RZ/G2N board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a774b1-hihope-rzg2n-ex.dts"
+#include "r8a774b1-u-boot.dtsi"
diff --git a/arch/arm/dts/r8a774b1-hihope-rzg2n.dts b/arch/arm/dts/r8a774b1-hihope-rzg2n.dts
new file mode 100644
index 0000000000..f1883cbd1a
--- /dev/null
+++ b/arch/arm/dts/r8a774b1-hihope-rzg2n.dts
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the HiHope RZ/G2N main board Rev.3.0/4.0
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r8a774b1.dtsi"
+#include "hihope-rev4.dtsi"
+
+/ {
+	model = "HopeRun HiHope RZ/G2N main board based on r8a774b1";
+	compatible = "hoperun,hihope-rzg2n", "renesas,r8a774b1";
+
+	memory at 48000000 {
+		device_type = "memory";
+		/* first 128MB is reserved for secure area. */
+		reg = <0x0 0x48000000 0x0 0x78000000>;
+	};
+
+	memory at 480000000 {
+		device_type = "memory";
+		reg = <0x4 0x80000000 0x0 0x80000000>;
+	};
+};
+
+&du {
+	clocks = <&cpg CPG_MOD 724>,
+		 <&cpg CPG_MOD 723>,
+		 <&cpg CPG_MOD 721>,
+		 <&versaclock5 1>,
+		 <&x302_clk>,
+		 <&versaclock5 2>;
+	clock-names = "du.0", "du.1", "du.3",
+		      "dclkin.0", "dclkin.1", "dclkin.3";
+};
+
+&sdhi3 {
+	mmc-hs400-1_8v;
+};
diff --git a/arch/arm/dts/r8a774b1-u-boot.dtsi b/arch/arm/dts/r8a774b1-u-boot.dtsi
new file mode 100644
index 0000000000..2c0319fc39
--- /dev/null
+++ b/arch/arm/dts/r8a774b1-u-boot.dtsi
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source extras for U-Boot on RZ/G2 R8A774B1 SoC
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a779x-u-boot.dtsi"
+
+&extalr_clk {
+	u-boot,dm-pre-reloc;
+};
+
+/delete-node/ &audma0;
+/delete-node/ &audma1;
+/delete-node/ &can0;
+/delete-node/ &can1;
+/delete-node/ &canfd;
+/delete-node/ &csi20;
+/delete-node/ &csi40;
+/delete-node/ &du;
+/delete-node/ &fcpf0;
+/delete-node/ &fcpvb0;
+/delete-node/ &fcpvd0;
+/delete-node/ &fcpvd1;
+/delete-node/ &fcpvi0;
+/delete-node/ &hdmi0;
+/delete-node/ &lvds0;
+/delete-node/ &rcar_sound;
+/delete-node/ &sdhi2;
+/delete-node/ &sound_card;
+/delete-node/ &vin0;
+/delete-node/ &vin1;
+/delete-node/ &vin2;
+/delete-node/ &vin3;
+/delete-node/ &vin4;
+/delete-node/ &vin5;
+/delete-node/ &vin6;
+/delete-node/ &vin7;
+/delete-node/ &vspb;
+/delete-node/ &vspd0;
+/delete-node/ &vspd1;
+/delete-node/ &vspi0;
+
+/ {
+	/delete-node/ hdmi0-out;
+};
+
+/ {
+	soc {
+		/delete-node/ fdp1 at fe940000;
+	};
+};
diff --git a/arch/arm/mach-rmobile/Kconfig.64 b/arch/arm/mach-rmobile/Kconfig.64
index b3931b8d18..46407ecf79 100644
--- a/arch/arm/mach-rmobile/Kconfig.64
+++ b/arch/arm/mach-rmobile/Kconfig.64
@@ -61,6 +61,7 @@ config TARGET_BEACON_RZG2M
 config TARGET_HIHOPE_RZG2
 	bool "HiHope RZ/G2 board"
 	imply R8A774A1
+	imply R8A774B1
 	imply SYS_MALLOC_F
 	imply MULTI_DTB_FIT
 	imply MULTI_DTB_FIT_USER_DEFINED_AREA
diff --git a/board/hoperun/hihope-rzg2/hihope-rzg2.c b/board/hoperun/hihope-rzg2/hihope-rzg2.c
index 826a403178..31551d10ef 100644
--- a/board/hoperun/hihope-rzg2/hihope-rzg2.c
+++ b/board/hoperun/hihope-rzg2/hihope-rzg2.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * board/hoperun/hihope-rzg2/hihope-rzg2.c
- *     This file is HiHope RZ/G2M board support.
+ *     This file is HiHope RZ/G2[MN] board support.
  *
  * Copyright (C) 2020 Renesas Electronics Corporation
  */
@@ -73,13 +73,25 @@ static int get_board_revision_for_rzg2(void)
 
 static int get_board_revision(void)
 {
-	u32 cpu_type = rmobile_get_cpu_type();
+	const u32 cpu_type = rmobile_get_cpu_type();
+	struct gpio_desc rev2_check;
 	int revision = 2;
 
 	if (cpu_type == RMOBILE_CPU_TYPE_R8A774A1) {
 		if (rmobile_get_cpu_rev_integer() == 1 &&
 		    rmobile_get_cpu_rev_fraction() == 3)
 			revision = get_board_revision_for_rzg2();
+	} else if (cpu_type == RMOBILE_CPU_TYPE_R8A774B1) {
+		if (dm_gpio_lookup_name("gpio at e605500025", &rev2_check) ||
+		    dm_gpio_request(&rev2_check, "rev2_check")) {
+			printf("Cannot get GPIO5_25\n");
+		} else {
+			dm_gpio_set_dir_flags(&rev2_check, GPIOD_IS_IN);
+			if (!dm_gpio_get_value(&rev2_check))
+				revision = get_board_revision_for_rzg2();
+		}
+	} else {
+		revision = get_board_revision_for_rzg2();
 	}
 
 	return revision;
@@ -172,6 +184,10 @@ int board_fit_config_name_match(const char *name)
 	    !strcmp(name, "r8a774a1-hihope-rzg2m-u-boot"))
 		return 0;
 
+	if (cpu_type == RMOBILE_CPU_TYPE_R8A774B1 &&
+	    !strcmp(name, "r8a774b1-hihope-rzg2n-u-boot"))
+		return 0;
+
 	return -1;
 }
 #endif
diff --git a/configs/hihope_rzg2_defconfig b/configs/hihope_rzg2_defconfig
index 1a77e140f7..1c20206e1b 100644
--- a/configs/hihope_rzg2_defconfig
+++ b/configs/hihope_rzg2_defconfig
@@ -32,7 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
-CONFIG_OF_LIST="r8a774a1-hihope-rzg2m-u-boot"
+CONFIG_OF_LIST="r8a774a1-hihope-rzg2m-u-boot r8a774b1-hihope-rzg2n-u-boot"
 CONFIG_MULTI_DTB_FIT_LZO=y
 CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
 CONFIG_ENV_OVERWRITE=y
-- 
2.17.1



More information about the U-Boot mailing list