Skip to contentSkip to conversation

Add HopeRun HiHope RZ/G2M board support

PATCH New Biju Das 2 participants 9 messages Sep 15, 2020 – Sep 18, 2020

Subsystems (6)
lore
Share & tools
lore

Biju Das

author
#0 lore raw

cover Add HopeRun HiHope RZ/G2M board support

This patch series adds the required SoC/Board support to boot HopeRun HiHope RZ/G2M board.

Biju Das (4):
pinctrl: renesas: Fix PINCTRL_PFC_R8A774A1 help description
arm: dts: r8a774a1: Import DTS from Linux 5.9-rc4
arm: rmobile: Add RZ/G2M SoC
arm: rmobile: Add HopeRun HiHope RZ/G2M board support

 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/hihope-common.dtsi               | 377 ++++++++++++++++++
 arch/arm/dts/hihope-rev4.dtsi                 | 124 ++++++
 arch/arm/dts/hihope-rzg2-ex.dtsi              |  93 +++++
 arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts     |  21 +
 arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts |   9 +
 arch/arm/dts/r8a774a1-hihope-rzg2m.dts        |  37 ++
 arch/arm/dts/r8a774a1-u-boot.dtsi             |  55 +++
 arch/arm/dts/r8a774a1.dtsi                    |  10 +-
 arch/arm/mach-rmobile/Kconfig.64              |  14 +
 arch/arm/mach-rmobile/cpu_info.c              |  78 +++-
 arch/arm/mach-rmobile/include/mach/rmobile.h  |   1 +
 board/hoperun/hihope-rzg2/Kconfig             |  15 +
 board/hoperun/hihope-rzg2/MAINTAINERS         |   6 +
 board/hoperun/hihope-rzg2/Makefile            |   9 +
 board/hoperun/hihope-rzg2/hihope-rzg2.c       | 177 ++++++++
 configs/hihope_rzg2_defconfig                 |  73 ++++
 drivers/pinctrl/renesas/Kconfig               |  20 +-
 include/configs/hihope-rzg2.h                 |  20 +
 include/dt-bindings/clock/r8a774a1-cpg-mssr.h |  96 +++--
 include/dt-bindings/power/r8a774a1-sysc.h     |   2 -
 21 files changed, 1152 insertions(+), 86 deletions(-)
 create mode 100644 arch/arm/dts/hihope-common.dtsi
 create mode 100644 arch/arm/dts/hihope-rev4.dtsi
 create mode 100644 arch/arm/dts/hihope-rzg2-ex.dtsi
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m.dts
 create mode 100644 arch/arm/dts/r8a774a1-u-boot.dtsi
 create mode 100644 board/hoperun/hihope-rzg2/Kconfig
 create mode 100644 board/hoperun/hihope-rzg2/MAINTAINERS
 create mode 100644 board/hoperun/hihope-rzg2/Makefile
 create mode 100644 board/hoperun/hihope-rzg2/hihope-rzg2.c
 create mode 100644 configs/hihope_rzg2_defconfig
 create mode 100644 include/configs/hihope-rzg2.h
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 pinctrl: renesas: Fix PINCTRL_PFC_R8A774A1 help description

R8A774A1 is part of Renesas RZ/G2 series and not R-Car, reflect the same for PINCTRL_PFC_R8A774A1 help description

Alongside, sort the PINCTRL_PFC_R8A774A1 config option as per increasing number of the SoC.

---
 drivers/pinctrl/renesas/Kconfig | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/pinctrl/renesas/Kconfig +10 -10
index 8327bcabd6..e14294b6e7 100644
@@ -57,6 +57,16 @@ config PINCTRL_PFC_R8A7794
 	  the GPIO definitions and pin control functions for each available
 	  multiplex function.
 
+config PINCTRL_PFC_R8A774A1
+        bool "Renesas RZ/G2 R8A774A1 pin control driver"
+        depends on PINCTRL_PFC
+        help
+          Support pin multiplexing control on Renesas RZ/G2M R8A774A1 SoCs.
+
+          The driver is controlled by a device tree node which contains both
+          the GPIO definitions and pin control functions for each available
+          multiplex function.
+
 config PINCTRL_PFC_R8A7795
 	bool "Renesas RCar Gen3 R8A7795 pin control driver"
 	depends on PINCTRL_PFC
@@ -77,16 +87,6 @@ config PINCTRL_PFC_R8A7796
 	  the GPIO definitions and pin control functions for each available
 	  multiplex function.
 
-config PINCTRL_PFC_R8A774A1
-        bool "Renesas RCar Gen3 R8A774A1 pin control driver"
-        depends on PINCTRL_PFC
-        help
-          Support pin multiplexing control on Renesas RZG2M R8A774A1 SoCs.
-
-          The driver is controlled by a device tree node which contains both
-          the GPIO definitions and pin control functions for each available
-          multiplex function.
-
 config PINCTRL_PFC_R8A77965
 	bool "Renesas RCar Gen3 R8A77965 pin control driver"
 	depends on PINCTRL_PFC
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/4 arm: dts: r8a774a1: Import DTS from Linux 5.9-rc4

In reply to Biju Das

Synchronize RZ/G2M SoC DTs with mainline Linux 5.9-rc4 commit f4d51dffc6c0 ("Linux 5.9-rc4")

---
 arch/arm/dts/r8a774a1.dtsi                    | 10 +-
 include/dt-bindings/clock/r8a774a1-cpg-mssr.h | 96 +++++++++----------
 include/dt-bindings/power/r8a774a1-sysc.h     |  2 -
 3 files changed, 51 insertions(+), 57 deletions(-)
arch/arm/dts/r8a774a1.dtsi +6 -4
index a603d94797..8e80f50132 100644
@@ -10,6 +10,8 @@
 #include <dt-bindings/clock/r8a774a1-cpg-mssr.h>
 #include <dt-bindings/power/r8a774a1-sysc.h>
 
+#define CPG_AUDIO_CLK_I		R8A774A1_CLK_S0D4
+
 / {
 	compatible = "renesas,r8a774a1";
 	#address-cells = <2>;
@@ -2250,7 +2252,7 @@
 			status = "disabled";
 		};
 
-		sdhi0: sd at ee100000 {
+		sdhi0: mmc at ee100000 {
 			compatible = "renesas,sdhi-r8a774a1",
 				     "renesas,rcar-gen3-sdhi";
 			reg = <0 0xee100000 0 0x2000>;
@@ -2262,7 +2264,7 @@
 			status = "disabled";
 		};
 
-		sdhi1: sd at ee120000 {
+		sdhi1: mmc at ee120000 {
 			compatible = "renesas,sdhi-r8a774a1",
 				     "renesas,rcar-gen3-sdhi";
 			reg = <0 0xee120000 0 0x2000>;
@@ -2274,7 +2276,7 @@
 			status = "disabled";
 		};
 
-		sdhi2: sd at ee140000 {
+		sdhi2: mmc at ee140000 {
 			compatible = "renesas,sdhi-r8a774a1",
 				     "renesas,rcar-gen3-sdhi";
 			reg = <0 0xee140000 0 0x2000>;
@@ -2286,7 +2288,7 @@
 			status = "disabled";
 		};
 
-		sdhi3: sd at ee160000 {
+		sdhi3: mmc at ee160000 {
 			compatible = "renesas,sdhi-r8a774a1",
 				     "renesas,rcar-gen3-sdhi";
 			reg = <0 0xee160000 0 0x2000>;
include/dt-bindings/clock/r8a774a1-cpg-mssr.h +45 -51

101 lines not on this page · raw message

include/dt-bindings/power/r8a774a1-sysc.h +0 -2
index d84ea0eb12..d35183557c 100644
@@ -18,12 +18,10 @@
 #define R8A774A1_PD_CA53_CPU2		 7
 #define R8A774A1_PD_CA53_CPU3		 8
 #define R8A774A1_PD_CA57_SCU		12
-#define R8A774A1_PD_CR7			13
 #define R8A774A1_PD_A3VC		14
 #define R8A774A1_PD_3DG_A		17
 #define R8A774A1_PD_3DG_B		18
 #define R8A774A1_PD_CA53_SCU		21
-#define R8A774A1_PD_A3IR		24
 #define R8A774A1_PD_A2VC0		25
 #define R8A774A1_PD_A2VC1		26
 
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/4 arm: rmobile: Add RZ/G2M SoC

In reply to Biju Das

Add CPU and PRR IDs for R8A774A1(a.k.a RZ/G2M) SoC.

RZ/Gx SoC's are identical to R-Car SoC's apart from some automotive peripherals and they also share the same PRR CPU ID's.

For example the RZ/G2M SoC has the same PRR ID 0x52 as R-Car M3W SoC.

To differentiate RZ/G SoC's from R-Car SoC's add a member family_type in struct rmobile_cpuinfo and compare the compatible string from device tree for SoC identification of RZ/G SoC.

Also sorted the header alphabetically.

---
 arch/arm/mach-rmobile/cpu_info.c             | 78 +++++++++++++++-----
 arch/arm/mach-rmobile/include/mach/rmobile.h |  1 +
 2 files changed, 60 insertions(+), 19 deletions(-)
arch/arm/mach-rmobile/cpu_info.c +59 -19
index fdbbd72e28..98403f8f8b 100644
@@ -3,13 +3,23 @@
  * (C) Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
  * (C) Copyright 2012 Renesas Solutions Corp.
  */
-#include <common.h>
-#include <cpu_func.h>
 #include <asm/cache.h>
-#include <init.h>
 #include <asm/io.h>
+#include <common.h>
+#include <cpu_func.h>
+#include <dm/device.h>
 #include <env.h>
+#include <init.h>
 #include <linux/ctype.h>
+#include <linux/libfdt.h>
+
+enum soc_family_type {
+	SOC_SHMOBILE = 0,
+	SOC_RMOBILE,
+	SOC_RZG2,
+	SOC_RCAR_GEN2,
+	SOC_RCAR_GEN3,
+};
 
 #ifdef CONFIG_ARCH_CPU_INIT
 int arch_cpu_init(void)
@@ -31,6 +41,7 @@ void enable_caches(void)
 
 #ifdef CONFIG_DISPLAY_CPUINFO
 #ifndef CONFIG_RZA1
+DECLARE_GLOBAL_DATA_PTR;
 static u32 __rmobile_get_cpu_type(void)
 {
 	return 0x0;
@@ -52,36 +63,65 @@ static u32 __rmobile_get_cpu_rev_fraction(void)
 u32 rmobile_get_cpu_rev_fraction(void)
 		__attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
 
+static const struct udevice_id soc_ids[] = {
+	{ .compatible = "renesas,r8a774a1", .data = SOC_RZG2 },
+	{ },
+};
+
 /* CPU infomation table */
 static const struct {
 	u16 cpu_type;
 	u8 cpu_name[10];
+	enum soc_family_type family_type;
 } rmobile_cpuinfo[] = {
-	{ RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
-	{ RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
-	{ RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
-	{ RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
-	{ RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
-	{ RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
-	{ RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
-	{ RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
-	{ RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
-	{ RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
-	{ RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
-	{ RMOBILE_CPU_TYPE_R8A77980, "R8A77980" },
-	{ RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
-	{ RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
+	{ RMOBILE_CPU_TYPE_SH73A0, "SH73A0", SOC_SHMOBILE },
+	{ RMOBILE_CPU_TYPE_R8A7740, "R8A7740", SOC_RMOBILE },
+	{ RMOBILE_CPU_TYPE_R8A774A1, "R8A774A1", SOC_RZG2 },
+	{ RMOBILE_CPU_TYPE_R8A7790, "R8A7790", SOC_RCAR_GEN2 },
+	{ RMOBILE_CPU_TYPE_R8A7791, "R8A7791", SOC_RCAR_GEN2 },
+	{ RMOBILE_CPU_TYPE_R8A7792, "R8A7792", SOC_RCAR_GEN2 },
+	{ RMOBILE_CPU_TYPE_R8A7793, "R8A7793", SOC_RCAR_GEN2 },
+	{ RMOBILE_CPU_TYPE_R8A7794, "R8A7794", SOC_RCAR_GEN2 },
+	{ RMOBILE_CPU_TYPE_R8A7795, "R8A7795", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A7796, "R8A7796", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A77965, "R8A77965", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A77970, "R8A77970", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A77980, "R8A77980", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A77990, "R8A77990", SOC_RCAR_GEN3 },
+	{ RMOBILE_CPU_TYPE_R8A77995, "R8A77995", SOC_RCAR_GEN3 },
 	{ 0x0, "CPU" },
 };
 
+static const struct udevice_id *of_soc_match_compatible(void)
+{
+	const struct udevice_id *of_match = soc_ids;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(soc_ids); i++) {
+		if (!fdt_node_check_compatible(gd->fdt_blob, 0,
+					       of_match->compatible))
+			return of_match;
+		of_match++;
+	}
+
+	return NULL;
+}
+
 static int rmobile_cpuinfo_idx(void)
 {
 	int i = 0;
 	u32 cpu_type = rmobile_get_cpu_type();
+	const struct udevice_id *match = of_soc_match_compatible();
 
 	for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)
-		if (rmobile_cpuinfo[i].cpu_type == cpu_type)
-			break;
+		if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
+			if (match &&
+			    rmobile_cpuinfo[i].family_type == match->data)
+				break;
+			else if (!match &&
+				 rmobile_cpuinfo[i].family_type != SOC_RZG2)
+				break;
+		}
 
 	return i;
 }
arch/arm/mach-rmobile/include/mach/rmobile.h +1 -0
index a50249dc96..8bb64f59dd 100644
@@ -27,6 +27,7 @@
 /* PRR CPU IDs */
 #define RMOBILE_CPU_TYPE_SH73A0		0x37
 #define RMOBILE_CPU_TYPE_R8A7740	0x40
+#define RMOBILE_CPU_TYPE_R8A774A1	0x52
 #define RMOBILE_CPU_TYPE_R8A7790	0x45
 #define RMOBILE_CPU_TYPE_R8A7791	0x47
 #define RMOBILE_CPU_TYPE_R8A7792	0x4A
Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/4 arm: rmobile: Add RZ/G2M SoC

On 9/15/20 4:36 PM, Biju Das wrote:
[...]

Quoted 7 lines

static int rmobile_cpuinfo_idx(void)
{

arch/arm/mach-rmobile/cpu_info.c +1 -0
 	int i = 0;
 	u32 cpu_type = rmobile_get_cpu_type();
+	const struct udevice_id *match = of_soc_match_compatible();
 
 	for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)

arch/arm/mach-rmobile/cpu_info.c static u32 __rmobile_get_cpu_rev_fraction(void) · line 124

Quoted 10 lines
arch/arm/mach-rmobile/cpu_info.c +8 -2
-		if (rmobile_cpuinfo[i].cpu_type == cpu_type)
-			break;
+		if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
+			if (match &&
+			    rmobile_cpuinfo[i].family_type == match->data)
+				break;
+			else if (!match &&
+				 rmobile_cpuinfo[i].family_type != SOC_RZG2)
+				break;
+		}

Can you please add some comment on how this loop works now. It really isn't obvious, so a detailed comment would help greatly. I think it does some discerning between the RCar and RZG, right ?

author
#5 lore raw

PATCH 3/4 arm: rmobile: Add RZ/G2M SoC

Hi Marek,

Thanks for the feedback.

Quoted 20 lines

Subject: Re: [PATCH 3/4] arm: rmobile: Add RZ/G2M SoC

On 9/15/20 4:36 PM, Biju Das wrote:
[...]

Quoted 5 lines

static int rmobile_cpuinfo_idx(void)
{
int i = 0;
u32 cpu_type = rmobile_get_cpu_type();

arch/arm/mach-rmobile/cpu_info.c +1 -0
+const struct udevice_id *match = of_soc_match_compatible();

arch/arm/mach-rmobile/cpu_info.c static u32 __rmobile_get_cpu_rev_fraction(void)

Quoted 10 lines
arch/arm/mach-rmobile/cpu_info.c +6 -2
 
 for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)
-if (rmobile_cpuinfo[i].cpu_type == cpu_type)
-break;
+if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
+if (match &&
+    rmobile_cpuinfo[i].family_type == match->data)
+break;
+else if (!match &&
+ rmobile_cpuinfo[i].family_type !=

SOC_RZG2)

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+break;
+}

Can you please add some comment on how this loop works now. It really isn't obvious, so a detailed comment would help greatly. I think it does some discerning between the RCar and RZG, right ?

Yes, Will do.

Cheers,
Biju

Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647

author
#6 lore raw

PATCH 4/4 arm: rmobile: Add HopeRun HiHope RZ/G2M board support

In reply to Biju Das

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

DTS files apart from r8a774a1-hihope-rzg2m-u-boot.dts and r8a774a1-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/G2M board.

---
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/hihope-common.dtsi               | 377 ++++++++++++++++++
 arch/arm/dts/hihope-rev4.dtsi                 | 124 ++++++
 arch/arm/dts/hihope-rzg2-ex.dtsi              |  93 +++++
 arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts     |  21 +
 arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts |   9 +
 arch/arm/dts/r8a774a1-hihope-rzg2m.dts        |  37 ++
 arch/arm/dts/r8a774a1-u-boot.dtsi             |  55 +++
 arch/arm/mach-rmobile/Kconfig.64              |  14 +
 board/hoperun/hihope-rzg2/Kconfig             |  15 +
 board/hoperun/hihope-rzg2/MAINTAINERS         |   6 +
 board/hoperun/hihope-rzg2/Makefile            |   9 +
 board/hoperun/hihope-rzg2/hihope-rzg2.c       | 177 ++++++++
 configs/hihope_rzg2_defconfig                 |  73 ++++
 include/configs/hihope-rzg2.h                 |  20 +
 15 files changed, 1031 insertions(+)
 create mode 100644 arch/arm/dts/hihope-common.dtsi
 create mode 100644 arch/arm/dts/hihope-rev4.dtsi
 create mode 100644 arch/arm/dts/hihope-rzg2-ex.dtsi
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts
 create mode 100644 arch/arm/dts/r8a774a1-hihope-rzg2m.dts
 create mode 100644 arch/arm/dts/r8a774a1-u-boot.dtsi
 create mode 100644 board/hoperun/hihope-rzg2/Kconfig
 create mode 100644 board/hoperun/hihope-rzg2/MAINTAINERS
 create mode 100644 board/hoperun/hihope-rzg2/Makefile
 create mode 100644 board/hoperun/hihope-rzg2/hihope-rzg2.c
 create mode 100644 configs/hihope_rzg2_defconfig
 create mode 100644 include/configs/hihope-rzg2.h
arch/arm/dts/Makefile +1 -0
index f8f529435b..ce7b561fcb 100644
@@ -784,6 +784,7 @@ dtb-$(CONFIG_RCAR_GEN2) += \
 
 dtb-$(CONFIG_RCAR_GEN3) += \
 	r8a774a1-beacon-rzg2m-kit.dtb \
+	r8a774a1-hihope-rzg2m-u-boot.dtb \
 	r8a77950-ulcb-u-boot.dtb \
 	r8a77950-salvator-x-u-boot.dtb \
 	r8a77960-ulcb-u-boot.dtb \
arch/arm/dts/hihope-common.dtsi new file +377 -0

377 lines not on this page · raw message

arch/arm/dts/hihope-rev4.dtsi new file +124 -0

124 lines not on this page · raw message

arch/arm/dts/hihope-rzg2-ex.dtsi new file +93 -0

93 lines not on this page · raw message

arch/arm/dts/r8a774a1-hihope-rzg2m-ex.dts new file +21 -0
new file mode 100644
index 0000000000..a5ca86196a
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the HiHope RZ/G2M Rev.3.0/4.0 connected to
+ * sub board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+#include "r8a774a1-hihope-rzg2m.dts"
+#include "hihope-rzg2-ex.dtsi"
+
+/ {
+	model = "HopeRun HiHope RZ/G2M with sub board";
+	compatible = "hoperun,hihope-rzg2-ex", "hoperun,hihope-rzg2m",
+		     "renesas,r8a774a1";
+};
+
+/* SW43 should be OFF, if in ON state SATA port will be activated */
+&pciec1 {
+	status = "okay";
+};
arch/arm/dts/r8a774a1-hihope-rzg2m-u-boot.dts new file +9 -0
new file mode 100644
index 0000000000..e5872ee68c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source extras for U-Boot for the Hihope RZ/G2M board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corporation
+ */
+
+#include "r8a774a1-hihope-rzg2m-ex.dts"
+#include "r8a774a1-u-boot.dtsi"
arch/arm/dts/r8a774a1-hihope-rzg2m.dts new file +37 -0
new file mode 100644
index 0000000000..25ae255de0
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the HiHope RZ/G2M Rev.3.0/4.0 main board
+ *
+ * Copyright (C) 2020 Renesas Electronics Corp.
+ */
+
+/dts-v1/;
+#include "r8a774a1.dtsi"
+#include "hihope-rev4.dtsi"
+
+/ {
+	model = "HopeRun HiHope RZ/G2M main board based on r8a774a1";
+	compatible = "hoperun,hihope-rzg2m", "renesas,r8a774a1";
+
+	memory at 48000000 {
+		device_type = "memory";
+		/* first 128MB is reserved for secure area. */
+		reg = <0x0 0x48000000 0x0 0x78000000>;
+	};
+
+	memory at 600000000 {
+		device_type = "memory";
+		reg = <0x6 0x00000000 0x0 0x80000000>;
+	};
+};
+
+&du {
+	clocks = <&cpg CPG_MOD 724>,
+		 <&cpg CPG_MOD 723>,
+		 <&cpg CPG_MOD 722>,
+		 <&versaclock5 1>,
+		 <&x302_clk>,
+		 <&versaclock5 2>;
+	clock-names = "du.0", "du.1", "du.2",
+		      "dclkin.0", "dclkin.1", "dclkin.2";
+};
arch/arm/dts/r8a774a1-u-boot.dtsi new file +55 -0

55 lines not on this page · raw message

arch/arm/mach-rmobile/Kconfig.64 +14 -0
index 07f607dd9d..2290be725f 100644
@@ -4,6 +4,8 @@ menu "Select Target SoC"
 
 config R8A774A1
         bool "Renesas SoC R8A774A1"
+	imply CLK_R8A774A1
+	imply PINCTRL_PFC_R8A774A1
 
 config R8A7795
 	bool "Renesas SoC R8A7795"
@@ -51,6 +53,15 @@ config TARGET_BEACON_RZG2M
 	select R8A774A1
 	select PINCTRL_PFC_R8A774A1
 
+config TARGET_HIHOPE_RZG2
+	bool "HiHope RZ/G2 board"
+	imply R8A774A1
+	imply SYS_MALLOC_F
+	imply MULTI_DTB_FIT
+	imply MULTI_DTB_FIT_USER_DEFINED_AREA
+	help
+          Support for RZG2 HiHope platform
+
 config TARGET_CONDOR
 	bool "Condor board"
 	imply R8A77980
@@ -109,12 +120,15 @@ source "board/renesas/ebisu/Kconfig"
 source "board/renesas/salvator-x/Kconfig"
 source "board/renesas/ulcb/Kconfig"
 source "board/beacon/beacon-rzg2m/Kconfig"
+source "board/hoperun/hihope-rzg2/Kconfig"
 
 config MULTI_DTB_FIT_UNCOMPRESS_SZ
+	default 0x80000 if TARGET_HIHOPE_RZG2
 	default 0x80000 if TARGET_SALVATOR_X
 	default 0x80000 if TARGET_ULCB
 
 config MULTI_DTB_FIT_USER_DEF_ADDR
+	default 0x49000000 if TARGET_HIHOPE_RZG2
 	default 0x49000000 if TARGET_SALVATOR_X
 	default 0x49000000 if TARGET_ULCB
 
board/hoperun/hihope-rzg2/Kconfig new file +15 -0
new file mode 100644
index 0000000000..ee422ba6c8
@@ -0,0 +1,15 @@
+if TARGET_HIHOPE_RZG2
+
+config SYS_SOC
+	default "rmobile"
+
+config SYS_BOARD
+	default "hihope-rzg2"
+
+config SYS_VENDOR
+	default "hoperun"
+
+config SYS_CONFIG_NAME
+	default "hihope-rzg2"
+
+endif
board/hoperun/hihope-rzg2/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..e3702fd12e
@@ -0,0 +1,6 @@
+HIHOPE_RZG2 BOARD
+M:	Biju Das <[email protected]>
+S:	Maintained
+F:	board/hoperun/hihope-rzg2/
+F:	include/configs/hihope-rzg2.h
+F:	configs/hihope_rzg2_defconfig
board/hoperun/hihope-rzg2/Makefile new file +9 -0
new file mode 100644
index 0000000000..5313031109
@@ -0,0 +1,9 @@
+#
+# board/hoperun/hihope-rzg2/Makefile
+#
+# Copyright (C) 2020 Renesas Electronics Corporation
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y	:= hihope-rzg2.o
board/hoperun/hihope-rzg2/hihope-rzg2.c new file +177 -0

177 lines not on this page · raw message

configs/hihope_rzg2_defconfig new file +73 -0

73 lines not on this page · raw message

include/configs/hihope-rzg2.h new file +20 -0
new file mode 100644
index 0000000000..68a51176e3
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * include/configs/hihope-rzg2.h
+ *     This file is HOPERUN HiHope RZ/G2 board configuration.
+ *
+ * Copyright (C) 2020 Renesas Electronics Corporation
+ */
+
+#ifndef __HIHOPE_RZG2_H
+#define __HIHOPE_RZG2_H
+
+#include "rcar-gen3-common.h"
+
+/* Ethernet RAVB */
+#define CONFIG_BITBANGMII_MULTI
+
+/* Generic Timer Definitions (use in assembler source) */
+#define COUNTER_FREQUENCY	0xFE502A	/* 16.66MHz from CPclk */
+
+#endif /* __HIHOPE_RZG2_H */
Signature · 1 line
2.17.1
#7 lore raw

PATCH 4/4 arm: rmobile: Add HopeRun HiHope RZ/G2M board support

On 9/15/20 4:36 PM, Biju Das wrote:
[...]

arch/arm/mach-rmobile/Kconfig.64 menu "Select Target SoC" · line 8

Quoted 10 lines
arch/arm/mach-rmobile/Kconfig.64 +2 -0
index 07f607dd9d..2290be725f 100644
@@ -4,6 +4,8 @@ menu "Select Target SoC"
 
 config R8A774A1
         bool "Renesas SoC R8A774A1"
+	imply CLK_R8A774A1
+	imply PINCTRL_PFC_R8A774A1

Can you please fix the indent with the "bool" too ? It seems there is some inconsistency.

[...]

Quoted 1 line
arch/arm/mach-rmobile/Kconfig.64 +1 -0
+++ b/board/hoperun/hihope-rzg2/hihope-rzg2.c

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+	dm_gpio_set_dir_flags(&rev_bit1, GPIOD_IS_IN);
+	dm_gpio_set_dir_flags(&rev_bit0, GPIOD_IS_IN);
+	revision = 0x03 + ((dm_gpio_get_value(&rev_bit1) << 1) |
+			    dm_gpio_get_value(&rev_bit0));

I think dm_gpio_get_value can return error too, so applying bit ops might fail.

Quoted 2 lines
arch/arm/mach-rmobile/Kconfig.64 +2 -0
+	return revision;
+}

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 5 lines
arch/arm/mach-rmobile/Kconfig.64 +5 -0
+void clear_wlan_bt_reg_on(void)
+{
+	struct gpio_desc bt_power, wifi_power;
+	char *bt_power_gpio = "gpio at e605300013"; /* GP3_13 */
+	char *wifi_power_gpio = "gpio at e60540006"; /* GP4_06 */

Can you use DT gpio-hog to set the GPIOs instead ?

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 3 lines
arch/arm/mach-rmobile/Kconfig.64 +3 -0
+/* Kconfig forces this on, so just return 0 */
+int board_early_init_f(void)
+{

Likely should be fixed on Kconfig side.

arch/arm/mach-rmobile/Kconfig.64

Quoted 10 lines
arch/arm/mach-rmobile/Kconfig.64 +10 -0
+	return 0;
+}
+
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000;
+
+	/* USB1 pull-up */
+	setbits_le32(PFC_PUEN6, PUEN_USB1_OVC | PUEN_USB1_PWEN);

Is this USB stuff really needed on this board ?

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+int dram_init(void)
+{
+	return fdtdec_setup_mem_size_base();
+}

Isn't this already in rcar-common.c ?

arch/arm/mach-rmobile/Kconfig.64

Quoted 9 lines
arch/arm/mach-rmobile/Kconfig.64 +9 -0
+int dram_init_banksize(void)
+{
+	return fdtdec_setup_memory_banksize();
+}
+
+void reset_cpu(ulong addr)
+{
+	writel(RST_CODE, RST_CA57RESCNT);
+}

[...]
I'll apply the PFC patches to sh/next , so feel free to resend only a subset of the patches based on sh/next .

author
#8 lore raw

PATCH 4/4 arm: rmobile: Add HopeRun HiHope RZ/G2M board support

Hi Marek,

Thanks for the feedback.

Quoted 12 lines

Subject: Re: [PATCH 4/4] arm: rmobile: Add HopeRun HiHope RZ/G2M board support

On 9/15/20 4:36 PM, Biju Das wrote:
[...]

Quoted 7 lines
arch/arm/mach-rmobile/Kconfig.64 +0 -0
index 07f607dd9d..2290be725f 100644
@@ -4,6 +4,8 @@ menu "Select Target SoC"
 
Quoted 7 lines

arch/arm/mach-rmobile/Kconfig.64 menu "Select Target SoC" · line 8

Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +2 -0
 config R8A774A1
         bool "Renesas SoC R8A774A1"
+imply CLK_R8A774A1
+imply PINCTRL_PFC_R8A774A1

Can you please fix the indent with the "bool" too ? It seems there is some inconsistency.

OK, will fix this in V2.

Quoted 11 lines

[...]

Quoted 1 line

+++ b/board/hoperun/hihope-rzg2/hihope-rzg2.c

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+dm_gpio_set_dir_flags(&rev_bit1, GPIOD_IS_IN);
+dm_gpio_set_dir_flags(&rev_bit0, GPIOD_IS_IN);
+revision = 0x03 + ((dm_gpio_get_value(&rev_bit1) << 1) |
+    dm_gpio_get_value(&rev_bit0));

I think dm_gpio_get_value can return error too, so applying bit ops might fail.

I am dropping this function since there is no user for this function, after setting WLAN/BT REGON using gpio hog

Quoted 5 lines
Quoted 2 lines
arch/arm/mach-rmobile/Kconfig.64 +2 -0
+return revision;
+}

[...]

Quoted 7 lines

arch/arm/mach-rmobile/Kconfig.64

Quoted 5 lines
arch/arm/mach-rmobile/Kconfig.64 +5 -0
+void clear_wlan_bt_reg_on(void)
+{
+struct gpio_desc bt_power, wifi_power;
+char *bt_power_gpio = "gpio at e605300013"; /* GP3_13 */
+char *wifi_power_gpio = "gpio at e60540006"; /* GP4_06 */

Can you use DT gpio-hog to set the GPIOs instead ?

Will send V2 for this.

Quoted 6 lines

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 2 lines
arch/arm/mach-rmobile/Kconfig.64 +2 -0
+/* Kconfig forces this on, so just return 0 */ int
+board_early_init_f(void) {

Likely should be fixed on Kconfig side.

Ok. On V2 will add #ifdef around this function

Quoted 4 lines
Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+return 0;
+}
+
+int board_init(void)
Quoted 8 lines

arch/arm/mach-rmobile/Kconfig.64

Quoted 6 lines
arch/arm/mach-rmobile/Kconfig.64 +6 -0
+{
+/* address of boot parameters */
+gd->bd->bi_boot_params = CONFIG_SYS_TEXT_BASE + 0x50000;
+
+/* USB1 pull-up */
+setbits_le32(PFC_PUEN6, PUEN_USB1_OVC | PUEN_USB1_PWEN);

Is this USB stuff really needed on this board ?

Will drop this on v2. Without this USB2.0 host works.

Quoted 7 lines

[...]

arch/arm/mach-rmobile/Kconfig.64

Quoted 3 lines
arch/arm/mach-rmobile/Kconfig.64 +3 -0
+int dram_init(void)
+{
+return fdtdec_setup_mem_size_base(); }

Isn't this already in rcar-common.c ?

rcar-common.c is board/renesas directory and this is in board/hoperun. So I believe we should not cross reference files in board specific directory. Please correct me if I am wrong.

Quoted 4 lines
Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+int dram_init_banksize(void)
+{
+return fdtdec_setup_memory_banksize(); }
+
Quoted 8 lines

arch/arm/mach-rmobile/Kconfig.64

Quoted 4 lines
arch/arm/mach-rmobile/Kconfig.64 +4 -0
+void reset_cpu(ulong addr)
+{
+writel(RST_CODE, RST_CA57RESCNT);
+}

[...]
I'll apply the PFC patches to sh/next , so feel free to resend only a subset of the patches based on sh/next .

Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647