aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>2021-03-19 12:01:00 +0000
committerLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>2021-04-20 16:17:50 +0100
commita4d86f6767083b5236ebf1d2cb60fe3d1713f7ba (patch)
tree84df6d85988ede5000ad27c55fca3be6ec5c62a4
parentbf007a56e725eb2aff8be50c6b94aa0e7dffb6f2 (diff)
downloadtrusted-firmware-a-a4d86f6767083b5236ebf1d2cb60fe3d1713f7ba.tar.gz
renesas: rzg: Add support to identify HopeRun HiHope RZ/G2N board
Add support to identify HopeRun HiHope RZ/G2N board. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Change-Id: Ib47aba84b63488247f6e9da1f5878140129766ce
-rw-r--r--drivers/renesas/rzg/board/board.c15
-rw-r--r--drivers/renesas/rzg/board/board.h1
-rw-r--r--plat/renesas/common/bl2_cpg_init.c8
-rw-r--r--plat/renesas/rzg/bl2_plat_setup.c20
-rw-r--r--plat/renesas/rzg/platform.mk17
5 files changed, 54 insertions, 7 deletions
diff --git a/drivers/renesas/rzg/board/board.c b/drivers/renesas/rzg/board/board.c
index 5c99ba9b61..60e6380dea 100644
--- a/drivers/renesas/rzg/board/board.c
+++ b/drivers/renesas/rzg/board/board.c
@@ -15,6 +15,8 @@
#ifndef BOARD_DEFAULT
#if (RCAR_LSI == RZ_G2H)
#define BOARD_DEFAULT (BOARD_HIHOPE_RZ_G2H << BOARD_CODE_SHIFT)
+#elif (RCAR_LSI == RZ_G2N)
+#define BOARD_DEFAULT (BOARD_HIHOPE_RZ_G2N << BOARD_CODE_SHIFT)
#else
#define BOARD_DEFAULT (BOARD_HIHOPE_RZ_G2M << BOARD_CODE_SHIFT)
#endif /* RCAR_LSI == RZ_G2H */
@@ -32,10 +34,12 @@
#define HM_ID { 0x10U, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU }
#define HH_ID HM_ID
+#define HN_ID { 0x20U, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU }
const char *g_board_tbl[] = {
[BOARD_HIHOPE_RZ_G2M] = "HiHope RZ/G2M",
[BOARD_HIHOPE_RZ_G2H] = "HiHope RZ/G2H",
+ [BOARD_HIHOPE_RZ_G2N] = "HiHope RZ/G2N",
[BOARD_UNKNOWN] = "unknown"
};
@@ -45,6 +49,7 @@ void rzg_get_board_type(uint32_t *type, uint32_t *rev)
const uint8_t board_tbl[][8] = {
[BOARD_HIHOPE_RZ_G2M] = HM_ID,
[BOARD_HIHOPE_RZ_G2H] = HH_ID,
+ [BOARD_HIHOPE_RZ_G2N] = HN_ID,
};
uint32_t reg, boardInfo;
@@ -65,8 +70,12 @@ void rzg_get_board_type(uint32_t *type, uint32_t *rev)
*rev = board_tbl[*type][(uint8_t)(board_id & BOARD_REV_MASK)];
} else {
reg = mmio_read_32(GPIO_INDT5);
- boardInfo = reg & (GP5_19_BIT | GP5_21_BIT);
- *rev = (((boardInfo & GP5_19_BIT) >> 14) |
- ((boardInfo & GP5_21_BIT) >> 17)) + 0x30U;
+ if (reg & GP5_25_BIT) {
+ *rev = board_tbl[*type][(uint8_t)(board_id & BOARD_REV_MASK)];
+ } else {
+ boardInfo = reg & (GP5_19_BIT | GP5_21_BIT);
+ *rev = (((boardInfo & GP5_19_BIT) >> 14) |
+ ((boardInfo & GP5_21_BIT) >> 17)) + 0x30U;
+ }
}
}
diff --git a/drivers/renesas/rzg/board/board.h b/drivers/renesas/rzg/board/board.h
index 9a3fc1ffe6..7165d45520 100644
--- a/drivers/renesas/rzg/board/board.h
+++ b/drivers/renesas/rzg/board/board.h
@@ -10,6 +10,7 @@
enum rzg2_board_id {
BOARD_HIHOPE_RZ_G2M = 0,
BOARD_HIHOPE_RZ_G2H,
+ BOARD_HIHOPE_RZ_G2N,
BOARD_UNKNOWN
};
diff --git a/plat/renesas/common/bl2_cpg_init.c b/plat/renesas/common/bl2_cpg_init.c
index bd82308f57..0c2fe8826a 100644
--- a/plat/renesas/common/bl2_cpg_init.c
+++ b/plat/renesas/common/bl2_cpg_init.c
@@ -24,7 +24,7 @@ static void bl2_realtime_cpg_init_m3(void);
static void bl2_system_cpg_init_m3(void);
#endif
-#if (RCAR_LSI == RCAR_AUTO) || (RCAR_LSI == RCAR_M3N)
+#if (RCAR_LSI == RCAR_AUTO) || (RCAR_LSI == RCAR_M3N) || (RCAR_LSI == RZ_G2N)
static void bl2_realtime_cpg_init_m3n(void);
static void bl2_system_cpg_init_m3n(void);
#endif
@@ -187,7 +187,7 @@ static void bl2_system_cpg_init_m3(void)
}
#endif
-#if (RCAR_LSI == RCAR_AUTO) || (RCAR_LSI == RCAR_M3N)
+#if (RCAR_LSI == RCAR_AUTO) || (RCAR_LSI == RCAR_M3N) || (RCAR_LSI == RZ_G2N)
static void bl2_realtime_cpg_init_m3n(void)
{
/* Realtime Module Stop Control Registers */
@@ -366,7 +366,7 @@ void bl2_cpg_init(void)
bl2_realtime_cpg_init_h3();
#elif (RCAR_LSI == RCAR_M3) || (RCAR_LSI == RZ_G2M)
bl2_realtime_cpg_init_m3();
-#elif RCAR_LSI == RCAR_M3N
+#elif RCAR_LSI == RCAR_M3N || (RCAR_LSI == RZ_G2N)
bl2_realtime_cpg_init_m3n();
#elif RCAR_LSI == RCAR_V3M
bl2_realtime_cpg_init_v3m();
@@ -412,7 +412,7 @@ void bl2_system_cpg_init(void)
bl2_system_cpg_init_h3();
#elif (RCAR_LSI == RCAR_M3) || (RCAR_LSI == RZ_G2M)
bl2_system_cpg_init_m3();
-#elif RCAR_LSI == RCAR_M3N
+#elif RCAR_LSI == RCAR_M3N || (RCAR_LSI == RZ_G2N)
bl2_system_cpg_init_m3n();
#elif RCAR_LSI == RCAR_V3M
bl2_system_cpg_init_v3m();
diff --git a/plat/renesas/rzg/bl2_plat_setup.c b/plat/renesas/rzg/bl2_plat_setup.c
index 520e86e723..8851796ca5 100644
--- a/plat/renesas/rzg/bl2_plat_setup.c
+++ b/plat/renesas/rzg/bl2_plat_setup.c
@@ -81,6 +81,9 @@ static void bl2_init_generic_timer(void);
#elif RCAR_LSI == RZ_G2H
#define TARGET_PRODUCT PRR_PRODUCT_H3
#define TARGET_NAME "RZ/G2H"
+#elif RCAR_LSI == RZ_G2N
+#define TARGET_PRODUCT PRR_PRODUCT_M3N
+#define TARGET_NAME "RZ/G2N"
#elif RCAR_LSI == RCAR_AUTO
#define TARGET_NAME "RZ/G2M"
#endif /* RCAR_LSI == RZ_G2M */
@@ -431,6 +434,10 @@ static void bl2_populate_compatible_string(void *dt)
ret = fdt_setprop_string(dt, 0, "compatible",
"hoperun,hihope-rzg2h");
break;
+ case BOARD_HIHOPE_RZ_G2N:
+ ret = fdt_setprop_string(dt, 0, "compatible",
+ "hoperun,hihope-rzg2n");
+ break;
default:
NOTICE("BL2: Cannot set compatible string, board unsupported\n");
panic();
@@ -452,6 +459,10 @@ static void bl2_populate_compatible_string(void *dt)
ret = fdt_appendprop_string(dt, 0, "compatible",
"renesas,r8a774e1");
break;
+ case PRR_PRODUCT_M3N:
+ ret = fdt_appendprop_string(dt, 0, "compatible",
+ "renesas,r8a774b1");
+ break;
default:
NOTICE("BL2: Cannot set compatible string, SoC unsupported\n");
panic();
@@ -591,6 +602,10 @@ static void bl2_advertise_dram_size(uint32_t product)
dram_config[7] = 0x80000000ULL;
#endif /* RCAR_DRAM_LPDDR4_MEMCONF == 0 */
break;
+ case PRR_PRODUCT_M3N:
+ /* 4GB(4GBx1) */
+ dram_config[1] = 0x100000000ULL;
+ break;
default:
NOTICE("BL2: Detected invalid DRAM entries\n");
break;
@@ -611,6 +626,7 @@ void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
const char *cpu_ca53 = "CA53";
const char *product_g2h = "G2H";
const char *product_g2m = "G2M";
+ const char *product_g2n = "G2N";
const char *boot_hyper80 = "HyperFlash(80MHz)";
const char *boot_qspi40 = "QSPI Flash(40MHz)";
const char *boot_qspi80 = "QSPI Flash(80MHz)";
@@ -681,6 +697,9 @@ void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
case PRR_PRODUCT_H3:
str = product_g2h;
break;
+ case PRR_PRODUCT_M3N:
+ str = product_g2n;
+ break;
default:
str = unknown;
break;
@@ -707,6 +726,7 @@ void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
switch (type) {
case BOARD_HIHOPE_RZ_G2M:
case BOARD_HIHOPE_RZ_G2H:
+ case BOARD_HIHOPE_RZ_G2N:
break;
default:
type = BOARD_UNKNOWN;
diff --git a/plat/renesas/rzg/platform.mk b/plat/renesas/rzg/platform.mk
index 15767b9b18..329569436b 100644
--- a/plat/renesas/rzg/platform.mk
+++ b/plat/renesas/rzg/platform.mk
@@ -47,6 +47,23 @@ else
endif
$(eval $(call add_define,RCAR_LSI_CUT))
endif
+ else ifeq (${LSI},G2N)
+ RCAR_LSI:=${RZ_G2N}
+ ifndef LSI_CUT
+ # enable compatible function.
+ RCAR_LSI_CUT_COMPAT := 1
+ $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
+ else
+ # disable compatible function.
+ ifeq (${LSI_CUT},10)
+ RCAR_LSI_CUT:=0
+ else ifeq (${LSI_CUT},11)
+ RCAR_LSI_CUT:=1
+ else
+ $(error "Error: ${LSI_CUT} is not supported.")
+ endif
+ $(eval $(call add_define,RCAR_LSI_CUT))
+ endif
else
$(error "Error: ${LSI} is not supported.")
endif