Skip to content

Commit 5f53861

Browse files
duynguyenxanashif
authored andcommitted
soc: renesas: Add initial support for RA6M2 SoC
- Initial support for RA6M2 SoC Signed-off-by: Tri Nguyen <[email protected]> Signed-off-by: Danh Doan <[email protected]> Signed-off-by: Duy Phuong Hoang. Nguyen <[email protected]>
1 parent 1e20f0c commit 5f53861

File tree

11 files changed

+371
-0
lines changed

11 files changed

+371
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <arm/renesas/ra/ra6/r7fa6m2ax.dtsi>
8+
9+
/ {
10+
soc {
11+
flash-controller@407e0000 {
12+
compatible = "renesas,ra6-flash-controller";
13+
reg = <0x407e0000 0x10000>;
14+
#address-cells = <1>;
15+
#size-cells = <1>;
16+
interrupts = <4 1>, <5 1>;
17+
interrupt-names = "frdyi", "fiferr";
18+
19+
flash0: flash@0 {
20+
compatible = "soc-nv-flash";
21+
reg = <0x0 DT_SIZE_M(1)>;
22+
write-block-size = <128>;
23+
erase-block-size = <8192>;
24+
};
25+
};
26+
};
27+
};
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <arm/renesas/ra/ra6/ra6-cm4-common.dtsi>
8+
#include <zephyr/dt-bindings/clock/ra_clock.h>
9+
10+
/ {
11+
soc {
12+
sram0: memory@1ffe0000 {
13+
compatible = "mmio-sram";
14+
reg = <0x1ffe0000 DT_SIZE_K(384)>;
15+
};
16+
17+
sci5: sci5@400700a0 {
18+
compatible = "renesas,ra-sci";
19+
interrupts = <20 1>, <21 1>, <22 1>, <23 1>;
20+
interrupt-names = "rxi", "txi", "tei", "eri";
21+
reg = <0x400700a0 0x20>;
22+
clocks = <&pclka MSTPB 26>;
23+
status = "disabled";
24+
uart {
25+
compatible = "renesas,ra-sci-uart";
26+
channel = <5>;
27+
status = "disabled";
28+
};
29+
};
30+
31+
sci6: sci6@400700c0 {
32+
compatible = "renesas,ra-sci";
33+
interrupts = <24 1>, <25 1>, <26 1>, <27 1>;
34+
interrupt-names = "rxi", "txi", "tei", "eri";
35+
reg = <0x400700c0 0x20>;
36+
clocks = <&pclka MSTPB 25>;
37+
status = "disabled";
38+
uart {
39+
compatible = "renesas,ra-sci-uart";
40+
channel = <6>;
41+
status = "disabled";
42+
};
43+
};
44+
45+
sci7: sci7@400700e0 {
46+
compatible = "renesas,ra-sci";
47+
interrupts = <28 1>, <29 1>, <30 1>, <31 1>;
48+
interrupt-names = "rxi", "txi", "tei", "eri";
49+
reg = <0x400700e0 0x20>;
50+
clocks = <&pclka MSTPB 24>;
51+
status = "disabled";
52+
uart {
53+
compatible = "renesas,ra-sci-uart";
54+
channel = <7>;
55+
status = "disabled";
56+
};
57+
};
58+
};
59+
60+
clocks: clocks {
61+
xtal: clock-xtal {
62+
compatible = "renesas,ra-cgc-external-clock";
63+
clock-frequency = <DT_FREQ_M(12)>;
64+
#clock-cells = <0>;
65+
status = "disabled";
66+
};
67+
68+
hoco: clock-hoco {
69+
compatible = "fixed-clock";
70+
clock-frequency = <DT_FREQ_M(20)>;
71+
#clock-cells = <0>;
72+
};
73+
74+
moco: clock-moco {
75+
compatible = "fixed-clock";
76+
clock-frequency = <DT_FREQ_M(8)>;
77+
#clock-cells = <0>;
78+
};
79+
80+
loco: clock-loco {
81+
compatible = "fixed-clock";
82+
clock-frequency = <32768>;
83+
#clock-cells = <0>;
84+
};
85+
86+
subclk: clock-subclk {
87+
compatible = "renesas,ra-cgc-subclk";
88+
clock-frequency = <32768>;
89+
#clock-cells = <0>;
90+
status = "disabled";
91+
};
92+
93+
pll: pll {
94+
compatible = "renesas,ra-cgc-pll";
95+
#clock-cells = <0>;
96+
97+
/* PLL */
98+
source = <RA_PLL_SOURCE_MAIN_OSC>;
99+
div = <RA_PLL_DIV_1>;
100+
mul = <20 0>;
101+
status = "disabled";
102+
};
103+
104+
pclkblock: pclkblock {
105+
compatible = "renesas,ra-cgc-pclk-block";
106+
#clock-cells = <0>;
107+
sysclock-src = <RA_CLOCK_SOURCE_PLL>;
108+
status = "okay";
109+
110+
iclk: iclk {
111+
compatible = "renesas,ra-cgc-pclk";
112+
clk_div = <RA_SYS_CLOCK_DIV_2>;
113+
#clock-cells = <2>;
114+
status = "okay";
115+
};
116+
117+
pclka: pclka {
118+
compatible = "renesas,ra-cgc-pclk";
119+
clk_div = <RA_SYS_CLOCK_DIV_2>;
120+
#clock-cells = <2>;
121+
status = "okay";
122+
};
123+
124+
pclkb: pclkb {
125+
compatible = "renesas,ra-cgc-pclk";
126+
clk_div = <RA_SYS_CLOCK_DIV_4>;
127+
#clock-cells = <2>;
128+
status = "okay";
129+
};
130+
131+
pclkc: pclkc {
132+
compatible = "renesas,ra-cgc-pclk";
133+
clk_div = <RA_SYS_CLOCK_DIV_4>;
134+
#clock-cells = <2>;
135+
status = "okay";
136+
};
137+
138+
pclkd: pclkd {
139+
compatible = "renesas,ra-cgc-pclk";
140+
clk_div = <RA_SYS_CLOCK_DIV_2>;
141+
#clock-cells = <2>;
142+
status = "okay";
143+
};
144+
145+
bclk: bclk {
146+
compatible = "renesas,ra-cgc-pclk";
147+
clk_div = <RA_SYS_CLOCK_DIV_2>;
148+
bclkout: bclkout {
149+
compatible = "renesas,ra-cgc-busclk";
150+
clk_out_div = <2>;
151+
sdclk = <1>;
152+
#clock-cells = <0>;
153+
};
154+
#clock-cells = <2>;
155+
status = "okay";
156+
};
157+
158+
uclk: uclk {
159+
compatible = "renesas,ra-cgc-pclk";
160+
clk_div = <RA_USB_CLOCK_DIV_5>;
161+
#clock-cells = <2>;
162+
status = "okay";
163+
};
164+
165+
fclk: fclk {
166+
compatible = "renesas,ra-cgc-pclk";
167+
clk_div = <RA_SYS_CLOCK_DIV_4>;
168+
#clock-cells = <2>;
169+
status = "okay";
170+
};
171+
172+
clkout: clkout {
173+
compatible = "renesas,ra-cgc-pclk";
174+
#clock-cells = <2>;
175+
status = "disabled";
176+
};
177+
};
178+
};
179+
};
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/ra6m2/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_RA6M2
5+
select ARM
6+
select CPU_CORTEX_M4
7+
select CPU_HAS_ARM_MPU
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_RA6M2
5+
6+
config NUM_IRQS
7+
default 96
8+
9+
config PINCTRL
10+
default y
11+
12+
endif # SOC_SERIES_RA6M2

soc/renesas/ra/ra6m2/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_RA6M2
5+
bool
6+
select SOC_FAMILY_RENESAS_RA
7+
help
8+
Renesas RA6M2 series
9+
10+
config SOC_R7FA6M2AF3CFB
11+
bool
12+
select SOC_SERIES_RA6M2
13+
help
14+
R7FA6M2AF3CFB
15+
16+
config SOC_SERIES
17+
default "ra6m2" if SOC_SERIES_RA6M2
18+
19+
config SOC
20+
default "r7fa6m2af3cfb" if SOC_R7FA6M2AF3CFB
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;

soc/renesas/ra/ra6m2/sections.ld

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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(.id_code,,)
23+
{
24+
KEEP(*(.id_code*))
25+
} GROUP_LINK_IN(ID_CODE)

soc/renesas/ra/ra6m2/soc.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file
9+
* @brief System/hardware module for Renesas RA6M2 family processor
10+
*/
11+
12+
#include <zephyr/device.h>
13+
#include <zephyr/init.h>
14+
#include <zephyr/kernel.h>
15+
#include <zephyr/arch/cpu.h>
16+
#include <cmsis_core.h>
17+
#include <zephyr/irq.h>
18+
#include <zephyr/logging/log.h>
19+
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
20+
21+
#include "bsp_cfg.h"
22+
#include <bsp_api.h>
23+
24+
uint32_t SystemCoreClock BSP_SECTION_EARLY_INIT;
25+
26+
volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT;
27+
28+
/**
29+
* @brief Perform basic hardware initialization at boot.
30+
*
31+
* This needs to be run from the very beginning.
32+
* So the init priority has to be 0 (zero).
33+
*
34+
* @return 0
35+
*/
36+
static int renesas_ra6m2_init(void)
37+
{
38+
uint32_t key;
39+
40+
key = irq_lock();
41+
42+
SystemCoreClock = BSP_MOCO_HZ;
43+
g_protect_pfswe_counter = 0;
44+
bsp_clock_init();
45+
46+
irq_unlock(key);
47+
48+
return 0;
49+
}
50+
51+
SYS_INIT(renesas_ra6m2_init, PRE_KERNEL_1, 0);

soc/renesas/ra/ra6m2/soc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2024 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @file SoC configuration macros for the Renesas RA6M2 family MCU
9+
*/
10+
11+
#ifndef ZEPHYR_SOC_RENESAS_RA6M2_SOC_H_
12+
#define ZEPHYR_SOC_RENESAS_RA6M2_SOC_H_
13+
14+
#include <bsp_api.h>
15+
16+
#endif /* ZEPHYR_SOC_RENESAS_RA6M2_SOC_H_ */

0 commit comments

Comments
 (0)