Skip to content

Commit 31397c2

Browse files
Hieu Nguyenkartben
authored andcommitted
soc: renesas: Add support for Renesas RZ/T2L
Add support for Renesas RZ/T2L Signed-off-by: Hieu Nguyen <[email protected]> Signed-off-by: Nhut Nguyen <[email protected]>
1 parent 997c6e4 commit 31397c2

File tree

11 files changed

+386
-0
lines changed

11 files changed

+386
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <mem.h>
8+
#include <arm/armv8-r.dtsi>
9+
#include <zephyr/dt-bindings/interrupt-controller/arm-gic.h>
10+
11+
/ {
12+
compatible = "renesas,r9a07g074";
13+
#address-cells = <1>;
14+
#size-cells = <1>;
15+
16+
cpus {
17+
#address-cells = <1>;
18+
#size-cells = <0>;
19+
20+
cpu@0 {
21+
device_type = "cpu";
22+
compatible = "arm,cortex-r52";
23+
reg = <0>;
24+
};
25+
};
26+
27+
arch_timer: timer {
28+
compatible = "arm,armv8-timer";
29+
interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>,
30+
<GIC_PPI 14 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>,
31+
<GIC_PPI 11 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>,
32+
<GIC_PPI 10 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
33+
interrupt-parent = <&gic>;
34+
};
35+
36+
soc {
37+
interrupt-parent = <&gic>;
38+
39+
gic: interrupt-controller@94000000 {
40+
compatible = "arm,gic-v3", "arm,gic";
41+
reg = <0x94000000 0x10000>,
42+
<0x94100000 0x80000>;
43+
interrupt-controller;
44+
#interrupt-cells = <4>;
45+
status = "okay";
46+
};
47+
48+
atcm: memory@0 {
49+
compatible = "mmio-sram";
50+
reg = <0x00000000 DT_SIZE_K(512)>;
51+
};
52+
53+
btcm: memory@100000 {
54+
compatible = "mmio-sram";
55+
reg = <0x00100000 DT_SIZE_K(64)>;
56+
};
57+
58+
sram: memory@10000000 {
59+
compatible = "mmio-sram";
60+
reg = <0x10000000 DT_SIZE_M(1)>;
61+
};
62+
63+
xspi1_cs0: memory@68000000 {
64+
compatible = "mmio-sram";
65+
reg = <0x68000000 DT_SIZE_M(16)>;
66+
67+
partitions {
68+
compatible = "fixed-partitions";
69+
#address-cells = <1>;
70+
#size-cells = <1>;
71+
72+
loader_param: partition@0 {
73+
label = "loader-param";
74+
reg = <0x00000000 0x4C>;
75+
read-only;
76+
};
77+
78+
loader_program: partition@4C {
79+
label = "loader-program";
80+
reg = <0x0000004C (DT_SIZE_K(56) - 0x4C)>;
81+
read-only;
82+
};
83+
84+
slot0_partition: partition@E000 {
85+
label = "image-0";
86+
reg = <0x0000E000 (DT_SIZE_M(16) - DT_SIZE_K(56))>;
87+
read-only;
88+
};
89+
};
90+
};
91+
};
92+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_sources(
5+
soc.c
6+
loader_param.c
7+
../common/loader_program.S
8+
)
9+
10+
zephyr_include_directories(.)
11+
12+
zephyr_linker_sources(SECTIONS sections.ld)
13+
14+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_r/scripts/linker.ld CACHE INTERNAL "")

soc/renesas/rz/rzt2l/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RZT2L
5+
select ARM
6+
select CPU_CORTEX_R52
7+
select CPU_HAS_ARM_MPU
8+
select GIC_SINGLE_SECURITY_STATE
9+
select ARM_ARCH_TIMER
10+
select HAS_RENESAS_RZ_FSP
11+
select SOC_RESET_HOOK
12+
select SOC_EARLY_INIT_HOOK
13+
select ARM_CUSTOM_INTERRUPT_CONTROLLER
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_RZT2L
5+
6+
config NUM_IRQS
7+
default 480
8+
9+
config SYS_CLOCK_HW_CYCLES_PER_SEC
10+
default 25000000
11+
12+
config FPU
13+
default y
14+
15+
config FLASH_SIZE
16+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K)
17+
18+
config FLASH_BASE_ADDRESS
19+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
20+
21+
DT_CHOSEN_IMAGE_ZEPHYR = zephyr,code-partition
22+
23+
config BUILD_OUTPUT_ADJUST_LMA
24+
default "($(dt_chosen_reg_addr_hex,$(DT_CHOSEN_IMAGE_ZEPHYR)) + \
25+
$(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)))"
26+
27+
config BUILD_OUTPUT_ADJUST_LMA_SECTIONS
28+
default "*;!.loader"
29+
30+
endif # SOC_SERIES_RZT2L

soc/renesas/rz/rzt2l/Kconfig.soc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2025 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RZT2L
5+
bool
6+
select SOC_FAMILY_RENESAS_RZ
7+
help
8+
Renesas RZ/T2L series
9+
10+
config SOC_SERIES
11+
default "rzt2l" if SOC_SERIES_RZT2L
12+
13+
config SOC_R9A07G074M04GBG
14+
bool
15+
select SOC_SERIES_RZT2L
16+
help
17+
R9A07G074M04GBG
18+
19+
config SOC
20+
default "r9a07g074m04gbg" if SOC_R9A07G074M04GBG
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <stdint.h>
8+
#include <zephyr/linker/section_tags.h>
9+
10+
#define CACHE_FLG (0x00000000)
11+
#define CS0BCR_V_WRAPCFG_V (0x00000000)
12+
#define CS0WCR_V_COMCFG_V (0x00000000)
13+
#define DUMMY0_BMCFG_V (0x00000000)
14+
#define BSC_FLG_xSPI_FLG (0x00000000)
15+
#define LDR_ADDR_NML (0x6800004C)
16+
#define LDR_SIZE_NML (0x00006000)
17+
#define DEST_ADDR_NML (0x00102000)
18+
#define DUMMY1 (0x00000000)
19+
#define DUMMY2 (0x00000000)
20+
#define DUMMY3_CSSCTL_V (0x0000003F)
21+
#define DUMMY4_LIOCFGCS0_V (0x00070000)
22+
#define DUMMY5 (0x00000000)
23+
#define DUMMY6 (0x00000000)
24+
#define DUMMY7 (0x00000000)
25+
#define DUMMY8 (0x00000000)
26+
#define DUMMY9 (0x00000000)
27+
#define DUMMY10_ACCESS_SPEED (0x00000600)
28+
#define CHECK_SUM (0xEEA2)
29+
#define LOADER_PARAM_MAX (19)
30+
31+
#define __loader_param Z_GENERIC_SECTION(.loader_param)
32+
33+
const uint32_t loader_param[LOADER_PARAM_MAX] __loader_param = {
34+
CACHE_FLG,
35+
CS0BCR_V_WRAPCFG_V,
36+
CS0WCR_V_COMCFG_V,
37+
DUMMY0_BMCFG_V,
38+
BSC_FLG_xSPI_FLG,
39+
LDR_ADDR_NML,
40+
LDR_SIZE_NML,
41+
DEST_ADDR_NML,
42+
DUMMY1,
43+
DUMMY2,
44+
DUMMY3_CSSCTL_V,
45+
DUMMY4_LIOCFGCS0_V,
46+
DUMMY5,
47+
DUMMY6,
48+
DUMMY7,
49+
DUMMY8,
50+
DUMMY9,
51+
DUMMY10_ACCESS_SPEED,
52+
CHECK_SUM,
53+
};

soc/renesas/rz/rzt2l/pinctrl_soc.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_SOC_RENESAS_RZ_RZT2L_PINCTRL_SOC_H_
8+
#define ZEPHYR_SOC_RENESAS_RZ_RZT2L_PINCTRL_SOC_H_
9+
10+
#include <pinctrl_rzt.h>
11+
12+
#endif /* ZEPHYR_SOC_RENESAS_RZ_RZT2L_PINCTRL_SOC_H_ */

soc/renesas/rz/rzt2l/sections.ld

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include <zephyr/devicetree.h>
7+
8+
SECTION_PROLOGUE(.loader, CONFIG_FLASH_BASE_ADDRESS,)
9+
{
10+
__loader_param_start = .;
11+
KEEP(*(.loader_param))
12+
__loader_param_end = .;
13+
. = DT_REG_ADDR(DT_NODELABEL(loader_program));
14+
__loader_program_start = .;
15+
KEEP(*(.loader_text.*))
16+
__loader_program_end = .;
17+
} GROUP_LINK_IN(FLASH)

soc/renesas/rz/rzt2l/soc.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <bsp_api.h>
8+
#include <zephyr/init.h>
9+
#include <zephyr/sys/barrier.h>
10+
#include <zephyr/drivers/interrupt_controller/gic.h>
11+
#include <zephyr/irq.h>
12+
13+
extern void bsp_global_system_counter_init(void);
14+
15+
void *gp_renesas_isr_context[BSP_ICU_VECTOR_MAX_ENTRIES + BSP_CORTEX_VECTOR_TABLE_ENTRIES];
16+
IRQn_Type g_current_interrupt_num[32];
17+
uint8_t g_current_interrupt_pointer;
18+
19+
void soc_reset_hook(void)
20+
{
21+
/* Enable peripheral port access at EL1 and EL0 */
22+
__asm__ volatile("mrc p15, 0, r0, c15, c0, 0\n");
23+
__asm__ volatile("orr r0, #1\n");
24+
__asm__ volatile("mcr p15, 0, r0, c15, c0, 0\n");
25+
barrier_dsync_fence_full();
26+
barrier_isync_fence_full();
27+
}
28+
29+
void soc_early_init_hook(void)
30+
{
31+
/* Configure system clocks. */
32+
bsp_clock_init();
33+
34+
/* Initialize SystemCoreClock variable. */
35+
SystemCoreClockUpdate();
36+
37+
/* Initialize global system counter. The counter is enabled and is incrementing. */
38+
bsp_global_system_counter_init();
39+
}
40+
41+
unsigned int z_soc_irq_get_active(void)
42+
{
43+
int intid = arm_gic_get_active();
44+
45+
g_current_interrupt_num[g_current_interrupt_pointer++] = intid;
46+
47+
return intid;
48+
}
49+
50+
void z_soc_irq_eoi(unsigned int intid)
51+
{
52+
g_current_interrupt_pointer--;
53+
arm_gic_eoi(intid);
54+
}
55+
56+
void z_soc_irq_enable(unsigned int irq)
57+
{
58+
arm_gic_irq_enable(irq);
59+
}
60+
61+
void z_soc_irq_disable(unsigned int irq)
62+
{
63+
arm_gic_irq_disable(irq);
64+
}
65+
66+
int z_soc_irq_is_enabled(unsigned int irq)
67+
{
68+
return arm_gic_irq_is_enabled(irq);
69+
}
70+
71+
void z_soc_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
72+
{
73+
arm_gic_irq_set_priority(irq, prio, flags);
74+
}
75+
76+
void z_soc_irq_init(void)
77+
{
78+
g_current_interrupt_pointer = 0;
79+
}
80+
81+
/* Porting FSP IRQ configuration by an empty function */
82+
/* Let Zephyr handle IRQ configuration */
83+
void bsp_irq_core_cfg(void)
84+
{
85+
/* Do nothing */
86+
}

soc/renesas/rz/rzt2l/soc.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_SOC_RENESAS_RZT2L_SOC_H_
8+
#define ZEPHYR_SOC_RENESAS_RZT2L_SOC_H_
9+
10+
typedef enum IRQn {
11+
SoftwareGeneratedInt0 = 0,
12+
SoftwareGeneratedInt1,
13+
SoftwareGeneratedInt2,
14+
SoftwareGeneratedInt3,
15+
SoftwareGeneratedInt4,
16+
SoftwareGeneratedInt5,
17+
SoftwareGeneratedInt6,
18+
SoftwareGeneratedInt7,
19+
SoftwareGeneratedInt8,
20+
SoftwareGeneratedInt9,
21+
SoftwareGeneratedInt10,
22+
SoftwareGeneratedInt11,
23+
SoftwareGeneratedInt12,
24+
SoftwareGeneratedInt13,
25+
SoftwareGeneratedInt14,
26+
SoftwareGeneratedInt15,
27+
DebugCommunicationsChannelInt = 22,
28+
PerformanceMonitorCounterOverflowInt = 23,
29+
CrossTriggerInterfaceInt = 24,
30+
VritualCPUInterfaceMaintenanceInt = 25,
31+
HypervisorTimerInt = 26,
32+
VirtualTimerInt = 27,
33+
NonSecurePhysicalTimerInt = 30,
34+
SHARED_PERIPHERAL_INTERRUPTS_MAX_ENTRIES = CONFIG_NUM_IRQS
35+
} IRQn_Type;
36+
37+
/* Do not let CMSIS to handle GIC and Timer */
38+
#define __GIC_PRESENT 0
39+
#define __TIM_PRESENT 0
40+
#define __FPU_PRESENT 1
41+
42+
/* Porting FSP IRQ configuration by an empty function */
43+
/* Let Zephyr handle IRQ configuration */
44+
void bsp_irq_core_cfg(void);
45+
46+
#endif /* ZEPHYR_SOC_RENESAS_RZT2L_SOC_H_ */

0 commit comments

Comments
 (0)