Skip to content

Commit 7384843

Browse files
quytranpzznashif
authored andcommitted
soc: renesas: Add initial support for RA4M2 SoC
Initial commit to support Renesas RA4M2 Soc Signed-off-by: Quy Tran <[email protected]>
1 parent 5663c88 commit 7384843

File tree

10 files changed

+458
-0
lines changed

10 files changed

+458
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/clock/ra_clock.h>
8+
#include <arm/renesas/ra/ra4/r7fa4m2ax.dtsi>
9+
10+
/ {
11+
soc {
12+
flash-controller@407e0000 {
13+
reg = <0x407e0000 0x1000>;
14+
#address-cells = <1>;
15+
#size-cells = <1>;
16+
flash0: flash@0 {
17+
compatible = "soc-nv-flash";
18+
reg = <0x0 DT_SIZE_K(512)>;
19+
};
20+
};
21+
};
22+
};
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <arm/renesas/ra/ra4/ra4-cm33-common.dtsi>
8+
#include <zephyr/dt-bindings/clock/ra_clock.h>
9+
10+
/ {
11+
soc {
12+
sram0: memory@20000000 {
13+
compatible = "mmio-sram";
14+
reg = <0x20000000 DT_SIZE_K(128)>;
15+
};
16+
17+
ioport6: gpio@400800c0 {
18+
compatible = "renesas,ra-gpio-ioport";
19+
reg = <0x400800c0 0x20>;
20+
port = <6>;
21+
gpio-controller;
22+
#gpio-cells = <2>;
23+
ngpios = <16>;
24+
status = "disabled";
25+
};
26+
27+
ioport7: gpio@400800e0 {
28+
compatible = "renesas,ra-gpio-ioport";
29+
reg = <0x400800e0 0x20>;
30+
port = <7>;
31+
gpio-controller;
32+
#gpio-cells = <2>;
33+
ngpios = <16>;
34+
status = "disabled";
35+
};
36+
37+
sci1: sci1@40118100 {
38+
compatible = "renesas,ra-sci";
39+
interrupts = <4 1>, <5 1>, <6 1>, <7 1>;
40+
interrupt-names = "rxi", "txi", "tei", "eri";
41+
reg = <0x40118100 0x100>;
42+
clocks = <&pclka MSTPB 30>;
43+
status = "disabled";
44+
uart {
45+
compatible = "renesas,ra-sci-uart";
46+
channel = <1>;
47+
status = "disabled";
48+
};
49+
};
50+
51+
sci2: sci2@40118200 {
52+
compatible = "renesas,ra-sci";
53+
interrupts = <8 1>, <9 1>, <10 1>, <11 1>;
54+
interrupt-names = "rxi", "txi", "tei", "eri";
55+
reg = <0x40118200 0x100>;
56+
clocks = <&pclka MSTPB 29>;
57+
status = "disabled";
58+
uart {
59+
compatible = "renesas,ra-sci-uart";
60+
channel = <2>;
61+
status = "disabled";
62+
};
63+
};
64+
65+
sci3: sci3@40118300 {
66+
compatible = "renesas,ra-sci";
67+
interrupts = <12 1>, <13 1>, <14 1>, <15 1>;
68+
interrupt-names = "rxi", "txi", "tei", "eri";
69+
reg = <0x40118300 0x100>;
70+
clocks = <&pclka MSTPB 28>;
71+
status = "disabled";
72+
uart {
73+
compatible = "renesas,ra-sci-uart";
74+
channel = <3>;
75+
status = "disabled";
76+
};
77+
};
78+
79+
sci4: sci4@40118400 {
80+
compatible = "renesas,ra-sci";
81+
interrupts = <16 1>, <17 1>, <18 1>, <19 1>;
82+
interrupt-names = "rxi", "txi", "tei", "eri";
83+
reg = <0x40118400 0x100>;
84+
clocks = <&pclka MSTPB 27>;
85+
status = "disabled";
86+
uart {
87+
compatible = "renesas,ra-sci-uart";
88+
channel = <4>;
89+
status = "disabled";
90+
};
91+
};
92+
};
93+
94+
clocks: clocks {
95+
xtal: clock-xtal {
96+
compatible = "renesas,ra-cgc-external-clock";
97+
clock-frequency = <DT_FREQ_M(24)>;
98+
#clock-cells = <0>;
99+
status = "disabled";
100+
};
101+
102+
hoco: clock-hoco {
103+
compatible = "fixed-clock";
104+
clock-frequency = <DT_FREQ_M(20)>;
105+
#clock-cells = <0>;
106+
};
107+
108+
moco: clock-moco {
109+
compatible = "fixed-clock";
110+
clock-frequency = <DT_FREQ_M(8)>;
111+
#clock-cells = <0>;
112+
};
113+
114+
loco: clock-loco {
115+
compatible = "fixed-clock";
116+
clock-frequency = <32768>;
117+
#clock-cells = <0>;
118+
};
119+
120+
subclk: clock-subclk {
121+
compatible = "renesas,ra-cgc-subclk";
122+
clock-frequency = <32768>;
123+
#clock-cells = <0>;
124+
status = "disabled";
125+
};
126+
127+
pll: pll {
128+
compatible = "renesas,ra-cgc-pll";
129+
#clock-cells = <0>;
130+
131+
/* PLL */
132+
source = <RA_PLL_SOURCE_MAIN_OSC>;
133+
div = <RA_PLL_DIV_3>;
134+
mul = <25 0>;
135+
status = "disabled";
136+
freq = <DT_FREQ_M(200)>;
137+
};
138+
139+
pll2: pll2 {
140+
compatible = "renesas,ra-cgc-pll";
141+
#clock-cells = <0>;
142+
143+
/* PLL */
144+
source = <RA_PLL_SOURCE_DISABLE>;
145+
div = <RA_PLL_DIV_2>;
146+
mul = <20 0>;
147+
status = "disabled";
148+
};
149+
150+
pclkblock: pclkblock {
151+
compatible = "renesas,ra-cgc-pclk-block";
152+
#clock-cells = <0>;
153+
sysclock-src = <RA_CLOCK_SOURCE_PLL>;
154+
status = "okay";
155+
156+
iclk: iclk {
157+
compatible = "renesas,ra-cgc-pclk";
158+
clk_div = <RA_SYS_CLOCK_DIV_2>;
159+
#clock-cells = <2>;
160+
status = "okay";
161+
};
162+
163+
pclka: pclka {
164+
compatible = "renesas,ra-cgc-pclk";
165+
clk_div = <RA_SYS_CLOCK_DIV_2>;
166+
#clock-cells = <2>;
167+
status = "okay";
168+
};
169+
170+
pclkb: pclkb {
171+
compatible = "renesas,ra-cgc-pclk";
172+
clk_div = <RA_SYS_CLOCK_DIV_4>;
173+
#clock-cells = <2>;
174+
status = "okay";
175+
};
176+
177+
pclkc: pclkc {
178+
compatible = "renesas,ra-cgc-pclk";
179+
clk_div = <RA_SYS_CLOCK_DIV_4>;
180+
#clock-cells = <2>;
181+
status = "okay";
182+
};
183+
184+
pclkd: pclkd {
185+
compatible = "renesas,ra-cgc-pclk";
186+
clk_div = <RA_SYS_CLOCK_DIV_2>;
187+
#clock-cells = <2>;
188+
status = "okay";
189+
};
190+
191+
fclk: fclk {
192+
compatible = "renesas,ra-cgc-pclk";
193+
clk_div = <RA_SYS_CLOCK_DIV_4>;
194+
#clock-cells = <2>;
195+
status = "okay";
196+
};
197+
198+
clkout: clkout {
199+
compatible = "renesas,ra-cgc-pclk";
200+
#clock-cells = <2>;
201+
status = "disabled";
202+
};
203+
204+
uclk: uclk {
205+
compatible = "renesas,ra-cgc-pclk";
206+
#clock-cells = <2>;
207+
status = "disabled";
208+
};
209+
};
210+
};
211+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
6+
zephyr_sources(
7+
soc.c
8+
)
9+
10+
zephyr_linker_sources(SECTIONS sections.ld)
11+
12+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

soc/renesas/ra/ra4m2/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RA4M2
5+
select ARM
6+
select CPU_HAS_ARM_MPU
7+
select CPU_CORTEX_M33
8+
select HAS_RENESAS_RA_FSP
9+
select CPU_CORTEX_M_HAS_DWT
10+
select ARMV8_M_DSP
11+
select CPU_HAS_FPU
12+
select FPU
13+
select HAS_SWO
14+
select XIP
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_RA4M2
5+
6+
config NUM_IRQS
7+
default 96
8+
9+
config PINCTRL
10+
default y
11+
12+
endif # SOC_SERIES_RA4M2

soc/renesas/ra/ra4m2/Kconfig.soc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RA4M2
5+
bool
6+
select SOC_FAMILY_RENESAS_RA
7+
help
8+
Renesas RA4M2 series
9+
10+
config SOC_R7FA4M2AD3CFP
11+
bool
12+
select SOC_SERIES_RA4M2
13+
help
14+
R7FA4M2AD3CFP
15+
16+
config SOC_SERIES
17+
default "ra4m2" if SOC_SERIES_RA4M2
18+
19+
config SOC
20+
default "r7fa4m2ad3cfp" if SOC_R7FA4M2AD3CFP

soc/renesas/ra/ra4m2/sections.ld

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
.code_in_ram :
8+
{
9+
. = ALIGN(4);
10+
__Code_In_RAM_Start = .;
11+
KEEP(*(.code_in_ram*))
12+
__Code_In_RAM_End = .;
13+
} > RAMABLE_REGION
14+
15+
SECTION_DATA_PROLOGUE(.fsp_dtc_vector_table,(NOLOAD),)
16+
{
17+
/* If DTC is used, put the DTC vector table at the start of SRAM.
18+
This avoids memory holes due to 1K alignment required by it. */
19+
*(.fsp_dtc_vector_table)
20+
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
21+
22+
SECTION_PROLOGUE(.option_setting_ofs,,)
23+
{
24+
__OPTION_SETTING_OFS_Start = .;
25+
KEEP(*(.option_setting_ofs0))
26+
. = __OPTION_SETTING_OFS_Start + 0x04;
27+
KEEP(*(.option_setting_ofs2))
28+
. = __OPTION_SETTING_OFS_Start + 0x10;
29+
KEEP(*(.option_setting_dualsel))
30+
__OPTION_SETTING_OFS_End = .;
31+
} GROUP_LINK_IN(OPTION_SETTING_OFS) = 0xFF
32+
33+
SECTION_PROLOGUE(.option_setting_sas,,)
34+
{
35+
__OPTION_SETTING_SAS_Start = .;
36+
KEEP(*(.option_setting_sas))
37+
__OPTION_SETTING_SAS_End = .;
38+
} GROUP_LINK_IN(OPTION_SETTING_SAS) = 0xFF
39+
40+
SECTION_PROLOGUE(.option_setting_s,,)
41+
{
42+
__OPTION_SETTING_S_Start = .;
43+
KEEP(*(.option_setting_ofs1_sec))
44+
. = __OPTION_SETTING_S_Start + 0x04;
45+
KEEP(*(.option_setting_ofs3_sec))
46+
. = __OPTION_SETTING_S_Start + 0x10;
47+
KEEP(*(.option_setting_banksel_sec))
48+
. = __OPTION_SETTING_S_Start + 0x40;
49+
KEEP(*(.option_setting_bps_sec0))
50+
. = __OPTION_SETTING_S_Start + 0x44;
51+
KEEP(*(.option_setting_bps_sec1))
52+
. = __OPTION_SETTING_S_Start + 0x48;
53+
KEEP(*(.option_setting_bps_sec2))
54+
. = __OPTION_SETTING_S_Start + 0x4C;
55+
KEEP(*(.option_setting_bps_sec3))
56+
. = __OPTION_SETTING_S_Start + 0x60;
57+
KEEP(*(.option_setting_pbps_sec0))
58+
. = __OPTION_SETTING_S_Start + 0x64;
59+
KEEP(*(.option_setting_pbps_sec1))
60+
. = __OPTION_SETTING_S_Start + 0x68;
61+
KEEP(*(.option_setting_pbps_sec2))
62+
. = __OPTION_SETTING_S_Start + 0x6C;
63+
KEEP(*(.option_setting_pbps_sec3))
64+
. = __OPTION_SETTING_S_Start + 0x80;
65+
KEEP(*(.option_setting_ofs1_sel))
66+
. = __OPTION_SETTING_S_Start + 0x84;
67+
KEEP(*(.option_setting_ofs3_sel))
68+
. = __OPTION_SETTING_S_Start + 0x90;
69+
KEEP(*(.option_setting_banksel_sel))
70+
. = __OPTION_SETTING_S_Start + 0xC0;
71+
KEEP(*(.option_setting_bps_sel0))
72+
. = __OPTION_SETTING_S_Start + 0xC4;
73+
KEEP(*(.option_setting_bps_sel1))
74+
. = __OPTION_SETTING_S_Start + 0xC8;
75+
KEEP(*(.option_setting_bps_sel2))
76+
. = __OPTION_SETTING_S_Start + 0xCC;
77+
KEEP(*(.option_setting_bps_sel3))
78+
__OPTION_SETTING_S_End = .;
79+
} GROUP_LINK_IN(OPTION_SETTING_S) = 0xFF

0 commit comments

Comments
 (0)