Skip to content

Commit 6e6403d

Browse files
quytranpzznashif
authored andcommitted
soc: renesas: Add initial support for RA4W1 SOC
Initial commit to support Renesas RA4W1 SOC Signed-off-by: Quy Tran <[email protected]>
1 parent d95ebf9 commit 6e6403d

File tree

11 files changed

+480
-0
lines changed

11 files changed

+480
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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/ra4-cm4-common.dtsi>
9+
10+
/ {
11+
soc {
12+
sram0: memory@20000000 {
13+
compatible = "mmio-sram";
14+
reg = <0x20000000 DT_SIZE_K(96)>;
15+
};
16+
17+
flash-controller@407e0000 {
18+
flash0: flash@0 {
19+
compatible = "soc-nv-flash";
20+
reg = <0x0 DT_SIZE_K(512)>;
21+
};
22+
};
23+
24+
sci4: sci4@40070080 {
25+
compatible = "renesas,ra-sci";
26+
interrupts = <16 1>, <17 1>, <18 1>, <19 1>;
27+
interrupt-names = "rxi", "txi", "tei", "eri";
28+
reg = <0x40070080 0x20>;
29+
clocks = <&pclka MSTPB 26>;
30+
status = "disabled";
31+
uart {
32+
compatible = "renesas,ra-sci-uart";
33+
channel = <4>;
34+
status = "disabled";
35+
};
36+
};
37+
};
38+
39+
clocks: clocks {
40+
xtal: clock-xtal {
41+
compatible = "renesas,ra-cgc-external-clock";
42+
clock-frequency = <DT_FREQ_M(8)>;
43+
#clock-cells = <0>;
44+
status = "disabled";
45+
};
46+
47+
hoco: clock-hoco {
48+
compatible = "fixed-clock";
49+
clock-frequency = <DT_FREQ_M(48)>;
50+
#clock-cells = <0>;
51+
};
52+
53+
moco: clock-moco {
54+
compatible = "fixed-clock";
55+
clock-frequency = <DT_FREQ_M(8)>;
56+
#clock-cells = <0>;
57+
};
58+
59+
loco: clock-loco {
60+
compatible = "fixed-clock";
61+
clock-frequency = <32768>;
62+
#clock-cells = <0>;
63+
};
64+
65+
subclk: clock-subclk {
66+
compatible = "renesas,ra-cgc-subclk";
67+
clock-frequency = <32768>;
68+
#clock-cells = <0>;
69+
status = "disabled";
70+
};
71+
72+
pll: pll {
73+
compatible = "renesas,ra-cgc-pll";
74+
#clock-cells = <0>;
75+
76+
/* PLL */
77+
source = <RA_PLL_SOURCE_MAIN_OSC>;
78+
div = <RA_PLL_DIV_2>;
79+
mul = <12 0>;
80+
freq = <DT_FREQ_M(48)>;
81+
status = "disabled";
82+
};
83+
84+
pclkblock: pclkblock {
85+
compatible = "renesas,ra-cgc-pclk-block";
86+
#clock-cells = <0>;
87+
sysclock-src = <RA_CLOCK_SOURCE_HOCO>;
88+
status = "okay";
89+
90+
iclk: iclk {
91+
compatible = "renesas,ra-cgc-pclk";
92+
clk_div = <RA_SYS_CLOCK_DIV_1>;
93+
#clock-cells = <2>;
94+
status = "okay";
95+
};
96+
97+
pclka: pclka {
98+
compatible = "renesas,ra-cgc-pclk";
99+
clk_div = <RA_SYS_CLOCK_DIV_1>;
100+
#clock-cells = <2>;
101+
status = "okay";
102+
};
103+
104+
pclkb: pclkb {
105+
compatible = "renesas,ra-cgc-pclk";
106+
clk_div = <RA_SYS_CLOCK_DIV_2>;
107+
#clock-cells = <2>;
108+
status = "okay";
109+
};
110+
111+
pclkc: pclkc {
112+
compatible = "renesas,ra-cgc-pclk";
113+
clk_div = <RA_SYS_CLOCK_DIV_1>;
114+
#clock-cells = <2>;
115+
status = "okay";
116+
};
117+
118+
pclkd: pclkd {
119+
compatible = "renesas,ra-cgc-pclk";
120+
clk_div = <RA_SYS_CLOCK_DIV_1>;
121+
#clock-cells = <2>;
122+
status = "okay";
123+
};
124+
125+
fclk: fclk {
126+
compatible = "renesas,ra-cgc-pclk";
127+
clk_div = <RA_SYS_CLOCK_DIV_2>;
128+
#clock-cells = <2>;
129+
status = "okay";
130+
};
131+
132+
clkout: clkout {
133+
compatible = "renesas,ra-cgc-pclk";
134+
#clock-cells = <2>;
135+
status = "disabled";
136+
};
137+
138+
uclk: uclk {
139+
compatible = "renesas,ra-cgc-pclk";
140+
clk_div = <RA_USB_CLOCK_DIV_1>;
141+
#clock-cells = <2>;
142+
status = "okay";
143+
};
144+
};
145+
};
146+
};
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <mem.h>
8+
#include <arm/armv7-m.dtsi>
9+
#include <zephyr/dt-bindings/pinctrl/renesas/pinctrl-ra.h>
10+
#include <freq.h>
11+
12+
/ {
13+
cpus {
14+
#address-cells = <1>;
15+
#size-cells = <0>;
16+
17+
cpu@0 {
18+
device_type = "cpu";
19+
compatible = "arm,cortex-m4";
20+
reg = <0>;
21+
#address-cells = <1>;
22+
#size-cells = <1>;
23+
24+
mpu: mpu@e000ed90 {
25+
compatible = "arm,armv7m-mpu";
26+
reg = <0xe000ed90 0x40>;
27+
};
28+
29+
};
30+
};
31+
32+
soc {
33+
system: system@4001e000 {
34+
compatible = "renesas,ra-system";
35+
reg = <0x4001e000 0x1000>;
36+
status = "okay";
37+
};
38+
39+
flash-controller@407e0000 {
40+
reg = <0x407e0000 0x10000>;
41+
#address-cells = <1>;
42+
#size-cells = <1>;
43+
};
44+
45+
ioport0: gpio@40040000 {
46+
compatible = "renesas,ra-gpio-ioport";
47+
reg = <0x40040000 0x20>;
48+
port = <0>;
49+
gpio-controller;
50+
#gpio-cells = <2>;
51+
ngpios = <16>;
52+
status = "disabled";
53+
};
54+
55+
ioport1: gpio@40040020 {
56+
compatible = "renesas,ra-gpio-ioport";
57+
reg = <0x40040020 0x20>;
58+
port = <1>;
59+
gpio-controller;
60+
#gpio-cells = <2>;
61+
ngpios = <16>;
62+
status = "disabled";
63+
};
64+
65+
ioport2: gpio@40040040 {
66+
compatible = "renesas,ra-gpio-ioport";
67+
reg = <0x40040040 0x20>;
68+
port = <2>;
69+
gpio-controller;
70+
#gpio-cells = <2>;
71+
ngpios = <16>;
72+
status = "disabled";
73+
};
74+
75+
ioport3: gpio@40040060 {
76+
compatible = "renesas,ra-gpio-ioport";
77+
reg = <0x40040060 0x20>;
78+
port = <3>;
79+
gpio-controller;
80+
#gpio-cells = <2>;
81+
ngpios = <16>;
82+
status = "disabled";
83+
};
84+
85+
ioport4: gpio@40040080 {
86+
compatible = "renesas,ra-gpio-ioport";
87+
reg = <0x40040080 0x20>;
88+
port = <4>;
89+
gpio-controller;
90+
#gpio-cells = <2>;
91+
ngpios = <16>;
92+
status = "disabled";
93+
};
94+
95+
ioport5: gpio@400400a0 {
96+
compatible = "renesas,ra-gpio-ioport";
97+
reg = <0x400400a0 0x20>;
98+
port = <5>;
99+
gpio-controller;
100+
#gpio-cells = <2>;
101+
ngpios = <16>;
102+
status = "disabled";
103+
};
104+
105+
ioport9: gpio@40040120 {
106+
compatible = "renesas,ra-gpio-ioport";
107+
reg = <0x40040120 0x20>;
108+
port = <9>;
109+
gpio-controller;
110+
#gpio-cells = <2>;
111+
ngpios = <16>;
112+
status = "disabled";
113+
};
114+
115+
pinctrl: pin-controller@40040800 {
116+
compatible = "renesas,ra-pinctrl-pfs";
117+
reg = <0x40040800 0x3c0>;
118+
status = "okay";
119+
};
120+
121+
sci0: sci0@40070000 {
122+
compatible = "renesas,ra-sci";
123+
interrupts = <0 1>, <1 1>, <2 1>, <3 1>;
124+
interrupt-names = "rxi", "txi", "tei", "eri";
125+
reg = <0x40070000 0x20>;
126+
clocks = <&pclka MSTPB 31>;
127+
status = "disabled";
128+
uart {
129+
compatible = "renesas,ra-sci-uart";
130+
channel = <0>;
131+
status = "disabled";
132+
};
133+
};
134+
135+
sci1: sci1@40070020 {
136+
compatible = "renesas,ra-sci";
137+
interrupts = <4 1>, <5 1>, <6 1>, <7 1>;
138+
interrupt-names = "rxi", "txi", "tei", "eri";
139+
reg = <0x40070020 0x20>;
140+
clocks = <&pclka MSTPB 30>;
141+
status = "disabled";
142+
uart {
143+
compatible = "renesas,ra-sci-uart";
144+
channel = <1>;
145+
status = "disabled";
146+
};
147+
};
148+
149+
sci9: sci9@40070120 {
150+
compatible = "renesas,ra-sci";
151+
interrupts = <36 1>, <37 1>, <38 1>, <39 1>;
152+
interrupt-names = "rxi", "txi", "tei", "eri";
153+
reg = <0x40070120 0x20>;
154+
clocks = <&pclka MSTPB 22>;
155+
status = "disabled";
156+
uart {
157+
compatible = "renesas,ra-sci-uart";
158+
channel = <9>;
159+
status = "disabled";
160+
};
161+
};
162+
163+
id_code: id_code@1010018 {
164+
compatible = "zephyr,memory-region";
165+
reg = <0x01010018 0x20>;
166+
zephyr,memory-region = "ID_CODE";
167+
status = "okay";
168+
};
169+
};
170+
};
171+
172+
&nvic {
173+
arm,num-irq-priority-bits = <4>;
174+
};
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+
zephyr_include_directories(.)
5+
6+
zephyr_sources(
7+
soc.c
8+
)
9+
10+
zephyr_linker_sources(ROM_START opt_set_mem.ld)
11+
12+
zephyr_linker_sources(SECTIONS sections.ld)
13+
14+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

soc/renesas/ra/ra4w1/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2024 Renesas Electronics Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_RA4W1
5+
select ARM
6+
select CPU_HAS_ARM_MPU
7+
select CPU_CORTEX_M4
8+
select HAS_RENESAS_RA_FSP
9+
select CPU_CORTEX_M_HAS_DWT
10+
select CPU_HAS_FPU
11+
select FPU
12+
select HAS_SWO
13+
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_RA4W1
5+
6+
config NUM_IRQS
7+
default 32
8+
9+
config PINCTRL
10+
default y
11+
12+
endif # SOC_SERIES_RA4W1

soc/renesas/ra/ra4w1/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_RA4W1
5+
bool
6+
select SOC_FAMILY_RENESAS_RA
7+
help
8+
Renesas RA4W1 series
9+
10+
config SOC_R7FA4W1AD2CNG
11+
bool
12+
select SOC_SERIES_RA4W1
13+
help
14+
R7FA4W1AD2CNG
15+
16+
config SOC_SERIES
17+
default "ra4w1" if SOC_SERIES_RA4W1
18+
19+
config SOC
20+
default "r7fa4w1ad2cng" if SOC_R7FA4W1AD2CNG
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* ROM Registers start at address 0x00000400 */
8+
. = 0x400;
9+
KEEP(*(.rom_registers*))
10+
/* Reserving 0x100 bytes of space for ROM registers. */
11+
. = 0x500;

0 commit comments

Comments
 (0)