Skip to content

Commit 41e140d

Browse files
quytranpzznashif
authored andcommitted
soc: renesas: Add initial support for RA4M3 SOC
Initial commit to support Renesas RA4M3 SOC Signed-off-by: Quy Tran <[email protected]>
1 parent 7638952 commit 41e140d

File tree

10 files changed

+466
-0
lines changed

10 files changed

+466
-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/r7fa4m3ax.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_M(1)>;
19+
};
20+
};
21+
};
22+
};
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
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+
ioport8: gpio@40080100 {
38+
compatible = "renesas,ra-gpio-ioport";
39+
reg = <0x40080100 0x20>;
40+
port = <8>;
41+
gpio-controller;
42+
#gpio-cells = <2>;
43+
ngpios = <16>;
44+
status = "disabled";
45+
};
46+
47+
sci1: sci1@40118100 {
48+
compatible = "renesas,ra-sci";
49+
interrupts = <4 1>, <5 1>, <6 1>, <7 1>;
50+
interrupt-names = "rxi", "txi", "tei", "eri";
51+
reg = <0x40118100 0x100>;
52+
clocks = <&pclka MSTPB 30>;
53+
status = "disabled";
54+
uart {
55+
compatible = "renesas,ra-sci-uart";
56+
channel = <1>;
57+
status = "disabled";
58+
};
59+
};
60+
61+
sci2: sci2@40118200 {
62+
compatible = "renesas,ra-sci";
63+
interrupts = <8 1>, <9 1>, <10 1>, <11 1>;
64+
interrupt-names = "rxi", "txi", "tei", "eri";
65+
reg = <0x40118200 0x100>;
66+
clocks = <&pclka MSTPB 29>;
67+
status = "disabled";
68+
uart {
69+
compatible = "renesas,ra-sci-uart";
70+
channel = <2>;
71+
status = "disabled";
72+
};
73+
};
74+
75+
sci3: sci3@40118300 {
76+
compatible = "renesas,ra-sci";
77+
interrupts = <12 1>, <13 1>, <14 1>, <15 1>;
78+
interrupt-names = "rxi", "txi", "tei", "eri";
79+
reg = <0x40118300 0x100>;
80+
clocks = <&pclka MSTPB 28>;
81+
status = "disabled";
82+
uart {
83+
compatible = "renesas,ra-sci-uart";
84+
channel = <3>;
85+
status = "disabled";
86+
};
87+
};
88+
89+
sci4: sci4@40118400 {
90+
compatible = "renesas,ra-sci";
91+
interrupts = <16 1>, <17 1>, <18 1>, <19 1>;
92+
interrupt-names = "rxi", "txi", "tei", "eri";
93+
reg = <0x40118400 0x100>;
94+
clocks = <&pclka MSTPB 27>;
95+
status = "disabled";
96+
uart {
97+
compatible = "renesas,ra-sci-uart";
98+
channel = <4>;
99+
status = "disabled";
100+
};
101+
};
102+
};
103+
104+
clocks: clocks {
105+
xtal: clock-xtal {
106+
compatible = "renesas,ra-cgc-external-clock";
107+
clock-frequency = <DT_FREQ_M(24)>;
108+
#clock-cells = <0>;
109+
status = "disabled";
110+
};
111+
112+
hoco: clock-hoco {
113+
compatible = "fixed-clock";
114+
clock-frequency = <DT_FREQ_M(20)>;
115+
#clock-cells = <0>;
116+
};
117+
118+
moco: clock-moco {
119+
compatible = "fixed-clock";
120+
clock-frequency = <DT_FREQ_M(8)>;
121+
#clock-cells = <0>;
122+
};
123+
124+
loco: clock-loco {
125+
compatible = "fixed-clock";
126+
clock-frequency = <32768>;
127+
#clock-cells = <0>;
128+
};
129+
130+
subclk: clock-subclk {
131+
compatible = "renesas,ra-cgc-subclk";
132+
clock-frequency = <32768>;
133+
#clock-cells = <0>;
134+
status = "disabled";
135+
};
136+
137+
pll: pll {
138+
compatible = "renesas,ra-cgc-pll";
139+
#clock-cells = <0>;
140+
141+
/* PLL */
142+
source = <RA_PLL_SOURCE_MAIN_OSC>;
143+
div = <RA_PLL_DIV_3>;
144+
mul = <25 0>;
145+
status = "disabled";
146+
freq = <DT_FREQ_M(200)>;
147+
};
148+
149+
pll2: pll2 {
150+
compatible = "renesas,ra-cgc-pll";
151+
#clock-cells = <0>;
152+
source = <RA_PLL_SOURCE_DISABLE>;
153+
div = <RA_PLL_DIV_2>;
154+
mul = <20 0>;
155+
status = "disabled";
156+
};
157+
158+
pclkblock: pclkblock {
159+
compatible = "renesas,ra-cgc-pclk-block";
160+
#clock-cells = <0>;
161+
sysclock-src = <RA_CLOCK_SOURCE_PLL>;
162+
status = "okay";
163+
164+
iclk: iclk {
165+
compatible = "renesas,ra-cgc-pclk";
166+
clk_div = <RA_SYS_CLOCK_DIV_2>;
167+
#clock-cells = <2>;
168+
status = "okay";
169+
};
170+
171+
pclka: pclka {
172+
compatible = "renesas,ra-cgc-pclk";
173+
clk_div = <RA_SYS_CLOCK_DIV_2>;
174+
#clock-cells = <2>;
175+
status = "okay";
176+
};
177+
178+
pclkb: pclkb {
179+
compatible = "renesas,ra-cgc-pclk";
180+
clk_div = <RA_SYS_CLOCK_DIV_4>;
181+
#clock-cells = <2>;
182+
status = "okay";
183+
};
184+
185+
pclkc: pclkc {
186+
compatible = "renesas,ra-cgc-pclk";
187+
clk_div = <RA_SYS_CLOCK_DIV_4>;
188+
#clock-cells = <2>;
189+
status = "okay";
190+
};
191+
192+
pclkd: pclkd {
193+
compatible = "renesas,ra-cgc-pclk";
194+
clk_div = <RA_SYS_CLOCK_DIV_2>;
195+
#clock-cells = <2>;
196+
status = "okay";
197+
};
198+
199+
fclk: fclk {
200+
compatible = "renesas,ra-cgc-pclk";
201+
clk_div = <RA_SYS_CLOCK_DIV_4>;
202+
#clock-cells = <2>;
203+
status = "okay";
204+
};
205+
206+
clkout: clkout {
207+
compatible = "renesas,ra-cgc-pclk";
208+
#clock-cells = <2>;
209+
status = "disabled";
210+
};
211+
212+
uclk: uclk {
213+
compatible = "renesas,ra-cgc-pclk";
214+
#clock-cells = <2>;
215+
status = "disabled";
216+
};
217+
};
218+
};
219+
};
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/ra4m3/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_RA4M3
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_RA4M3
5+
6+
config NUM_IRQS
7+
default 96
8+
9+
config PINCTRL
10+
default y
11+
12+
endif # SOC_SERIES_RA4M3

soc/renesas/ra/ra4m3/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_RA4M3
5+
bool
6+
select SOC_FAMILY_RENESAS_RA
7+
help
8+
Renesas RA4M3 series
9+
10+
config SOC_R7FA4M3AF3CFB
11+
bool
12+
select SOC_SERIES_RA4M3
13+
help
14+
R7FA4M3AF3CFB
15+
16+
config SOC_SERIES
17+
default "ra4m3" if SOC_SERIES_RA4M3
18+
19+
config SOC
20+
default "r7fa4m3af3cfb" if SOC_R7FA4M3AF3CFB

soc/renesas/ra/ra4m3/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)