Skip to content

Commit f2bf305

Browse files
author
Raffael Rostagno
committed
soc: esp32h2: Add initial support
Add initial support files for ESP32-H2 SoC. Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 49fb053 commit f2bf305

22 files changed

+1911
-4
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include <mem.h>
7+
#include <freq.h>
8+
#include <zephyr/dt-bindings/gpio/gpio.h>
9+
#include <zephyr/dt-bindings/interrupt-controller/esp-esp32h2-intmux.h>
10+
#include <zephyr/dt-bindings/clock/esp32h2_clock.h>
11+
#include <dt-bindings/pinctrl/esp32h2-pinctrl.h>
12+
13+
/ {
14+
#address-cells = <1>;
15+
#size-cells = <1>;
16+
17+
aliases {
18+
die-temp0 = &coretemp;
19+
};
20+
21+
chosen {
22+
zephyr,entropy = &trng0;
23+
zephyr,flash-controller = &flash;
24+
};
25+
26+
cpus {
27+
#address-cells = <1>;
28+
#size-cells = <0>;
29+
30+
cpu0: cpu@0 {
31+
device_type = "cpu";
32+
compatible = "espressif,riscv";
33+
riscv,isa = "rv32imac_zicsr";
34+
reg = <0>;
35+
clock-source = <ESP32_CPU_CLK_SRC_PLL>;
36+
clock-frequency = <DT_FREQ_M(96)>;
37+
xtal-freq = <DT_FREQ_M(32)>;
38+
};
39+
};
40+
41+
pinctrl: pin-controller {
42+
compatible = "espressif,esp32-pinctrl";
43+
status = "okay";
44+
};
45+
46+
clock: clock {
47+
compatible = "espressif,esp32-clock";
48+
fast-clk-src = <ESP32_RTC_FAST_CLK_SRC_RC_FAST>;
49+
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_SLOW>;
50+
#clock-cells = <1>;
51+
status = "okay";
52+
};
53+
54+
soc {
55+
#address-cells = <1>;
56+
#size-cells = <1>;
57+
compatible = "simple-bus";
58+
ranges;
59+
60+
sramhp: memory@40800000 {
61+
compatible = "zephyr,memory-region", "mmio-sram";
62+
reg = <0x40800000 DT_SIZE_K(320)>;
63+
zephyr,memory-region = "SRAMHP";
64+
};
65+
66+
sramlp: memory@50000000 {
67+
#address-cells = <1>;
68+
#size-cells = <1>;
69+
compatible = "zephyr,memory-region", "mmio-sram";
70+
reg = <0x50000000 DT_SIZE_K(4)>;
71+
zephyr,memory-region = "SRAMLP";
72+
};
73+
74+
intc: interrupt-controller@60010000 {
75+
compatible = "espressif,esp32-intc";
76+
#address-cells = <0>;
77+
#interrupt-cells = <3>;
78+
interrupt-controller;
79+
reg = <0x60010000 DT_SIZE_K(4)>;
80+
status = "okay";
81+
};
82+
83+
systimer0: systimer@6000b000 {
84+
compatible = "espressif,esp32-systimer";
85+
reg = <0x6000B000 DT_SIZE_K(4)>;
86+
interrupts = <SYSTIMER_TARGET0_EDGE_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
87+
interrupt-parent = <&intc>;
88+
status = "okay";
89+
};
90+
91+
timer0: counter@60009000 {
92+
compatible = "espressif,esp32-timer";
93+
reg = <0x60009000 DT_SIZE_K(4)>;
94+
clocks = <&clock ESP32_TIMG0_MODULE>;
95+
group = <0>;
96+
index = <0>;
97+
interrupts = <TG0_T0_LEVEL_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
98+
interrupt-parent = <&intc>;
99+
status = "disabled";
100+
101+
counter {
102+
compatible = "espressif,esp32-counter";
103+
status = "disabled";
104+
};
105+
};
106+
107+
timer1: counter@6000a000 {
108+
compatible = "espressif,esp32-timer";
109+
reg = <0x6000A000 DT_SIZE_K(4)>;
110+
clocks = <&clock ESP32_TIMG1_MODULE>;
111+
group = <1>;
112+
index = <0>;
113+
interrupts = <TG1_T0_LEVEL_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
114+
interrupt-parent = <&intc>;
115+
status = "disabled";
116+
117+
counter {
118+
compatible = "espressif,esp32-counter";
119+
status = "disabled";
120+
};
121+
};
122+
123+
rtc_timer: rtc_timer@600b0c00 {
124+
compatible = "espressif,esp32-rtc_timer";
125+
reg = <0x600B0C00 DT_SIZE_K(1)>;
126+
clocks = <&clock ESP32_MODULE_MAX>;
127+
interrupts = <LP_RTC_TIMER_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
128+
interrupt-parent = <&intc>;
129+
status = "disabled";
130+
};
131+
132+
trng0: trng@600b2808 {
133+
compatible = "espressif,esp32-trng";
134+
reg = <0x600B2808 0x4>;
135+
clocks = <&clock ESP32_RNG_MODULE>;
136+
status = "disabled";
137+
};
138+
139+
wdt0: watchdog@60009048 {
140+
compatible = "espressif,esp32-watchdog";
141+
reg = <0x60009048 0x20>;
142+
interrupts = <TG0_WDT_LEVEL_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
143+
interrupt-parent = <&intc>;
144+
clocks = <&clock ESP32_TIMG0_MODULE>;
145+
status = "disabled";
146+
};
147+
148+
wdt1: watchdog@6000a048 {
149+
compatible = "espressif,esp32-watchdog";
150+
reg = <0x6000A048 0x20>;
151+
interrupts = <TG1_WDT_LEVEL_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
152+
interrupt-parent = <&intc>;
153+
clocks = <&clock ESP32_TIMG1_MODULE>;
154+
status = "disabled";
155+
};
156+
157+
flash: flash-controller@60002000 {
158+
compatible = "espressif,esp32-flash-controller";
159+
reg = <0x60002000 0x1000>;
160+
161+
#address-cells = <1>;
162+
#size-cells = <1>;
163+
164+
flash0: flash@0 {
165+
compatible = "soc-nv-flash";
166+
erase-block-size = <4096>;
167+
write-block-size = <4>;
168+
/* Flash size is specified in SOC/SIP dtsi */
169+
};
170+
};
171+
172+
coretemp: coretemp@6000e058 {
173+
compatible = "espressif,esp32-temp";
174+
friendly-name = "coretemp";
175+
reg = <0x6000E058 0x4>;
176+
status = "disabled";
177+
};
178+
179+
gpio0: gpio@60091000 {
180+
compatible = "espressif,esp32-gpio";
181+
gpio-controller;
182+
#gpio-cells = <2>;
183+
reg = <0x60091000 DT_SIZE_K(4)>;
184+
interrupts = <GPIO_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
185+
interrupt-parent = <&intc>;
186+
ngpios = <32>;
187+
gpio-reserved-ranges =
188+
<6 2>, /* GPIO6–7 */
189+
<15 7>, /* GPIO15–21 */
190+
<28 4>; /* GPIO28–31 */
191+
};
192+
193+
uart0: uart@60000000 {
194+
compatible = "espressif,esp32-uart";
195+
reg = <0x60000000 DT_SIZE_K(4)>;
196+
status = "disabled";
197+
interrupts = <UART0_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
198+
interrupt-parent = <&intc>;
199+
clocks = <&clock ESP32_UART0_MODULE>;
200+
};
201+
202+
uart1: uart@60001000 {
203+
compatible = "espressif,esp32-uart";
204+
reg = <0x60001000 DT_SIZE_K(4)>;
205+
status = "disabled";
206+
interrupts = <UART1_INTR_SOURCE IRQ_DEFAULT_PRIORITY 0>;
207+
interrupt-parent = <&intc>;
208+
clocks = <&clock ESP32_UART1_MODULE>;
209+
};
210+
};
211+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "esp32h2_common.dtsi"
8+
9+
/* 2MB flash */
10+
&flash0 {
11+
reg = <0x0 DT_SIZE_M(2)>;
12+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "esp32h2_common.dtsi"
8+
9+
/* 4MB flash */
10+
&flash0 {
11+
reg = <0x0 DT_SIZE_M(4)>;
12+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "esp32h2_common.dtsi"
8+
9+
/* 2MB flash */
10+
&flash0 {
11+
reg = <0x0 DT_SIZE_M(2)>;
12+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "esp32h2_common.dtsi"
8+
9+
/* 4MB flash */
10+
&flash0 {
11+
reg = <0x0 DT_SIZE_M(4)>;
12+
};

soc/espressif/common/Kconfig.defconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
1+
# Copyright (c) 2024-2025 Espressif Systems (Shanghai) Co., Ltd.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6
4+
if SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32H2
55

66
config GEN_ISR_TABLES
77
default y if !SOC_ESP32C6_LPCORE
@@ -30,6 +30,7 @@ config XTAL_FREQ_HZ
3030

3131
config SYS_CLOCK_HW_CYCLES_PER_SEC
3232
default 10400000 if XTAL_FREQ_HZ = 26000000
33+
default 16000000 if XTAL_FREQ_HZ = 32000000
3334
default 16000000 if XTAL_FREQ_HZ = 40000000
3435

3536
config SYS_CLOCK_TICKS_PER_SEC
@@ -51,7 +52,7 @@ config ROM_START_OFFSET
5152

5253
endif # BOOTLOADER_MCUBOOT
5354

54-
endif # SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6
55+
endif # SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32H2
5556

5657
if SOC_SERIES_ESP32 || SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3
5758

soc/espressif/common/Kconfig.esptool

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ config ESPTOOLPY_FLASHMODE
8181
choice ESPTOOLPY_FLASHFREQ
8282
prompt "Flash SPI speed"
8383
default ESPTOOLPY_FLASHFREQ_40M if SOC_SERIES_ESP32
84+
default ESPTOOLPY_FLASHFREQ_48M if SOC_SERIES_ESP32H2
8485
default ESPTOOLPY_FLASHFREQ_60M if SOC_SERIES_ESP32C2
8586
default ESPTOOLPY_FLASHFREQ_80M if ESPTOOLPY_FLASHFREQ_80M_DEFAULT
8687

@@ -102,6 +103,8 @@ config ESPTOOLPY_FLASHFREQ_80M
102103
bool "80 MHz"
103104
config ESPTOOLPY_FLASHFREQ_60M
104105
bool "60 MHz"
106+
config ESPTOOLPY_FLASHFREQ_48M
107+
bool "48 MHz"
105108
config ESPTOOLPY_FLASHFREQ_40M
106109
bool "40 MHz"
107110
config ESPTOOLPY_FLASHFREQ_26M
@@ -125,6 +128,7 @@ config ESPTOOLPY_FLASHFREQ
125128
default '80m' if ESPTOOLPY_FLASHFREQ_120M
126129
default '80m' if ESPTOOLPY_FLASHFREQ_80M
127130
default '60m' if ESPTOOLPY_FLASHFREQ_60M
131+
default '48m' if ESPTOOLPY_FLASHFREQ_48M
128132
default '40m' if ESPTOOLPY_FLASHFREQ_40M
129133
default '26m' if ESPTOOLPY_FLASHFREQ_26M
130134
default '20m' if ESPTOOLPY_FLASHFREQ_20M

soc/espressif/common/Kconfig.flash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ config BOOTLOADER_FLASH_XMC_SUPPORT
9494
choice BOOTLOADER_VDDSDIO_BOOST
9595
bool "VDDSDIO LDO voltage"
9696
default BOOTLOADER_VDDSDIO_BOOST_1_9V
97-
depends on !SOC_SERIES_ESP32C2 && !SOC_SERIES_ESP32C3 && !SOC_SERIES_ESP32C6
97+
depends on !SOC_SERIES_ESP32C2 && !SOC_SERIES_ESP32C3 && !SOC_SERIES_ESP32C6 && !SOC_SERIES_ESP32H2
9898
help
9999
If this option is enabled, and VDDSDIO LDO is set to 1.8V (using eFuse
100100
or MTDI bootstrapping pin), bootloader will change LDO settings to

soc/espressif/esp32h2/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
zephyr_sources(
4+
vectors.S
5+
soc_irq.S
6+
soc.c
7+
../common/loader.c
8+
)
9+
10+
zephyr_include_directories(.)
11+
12+
zephyr_sources_ifndef(CONFIG_BOOTLOADER_MCUBOOT hw_init.c)

soc/espressif/esp32h2/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_ESP32H2
5+
select RISCV
6+
select RISCV_SOC_HAS_GP_RELATIVE_ADDRESSING
7+
select DYNAMIC_INTERRUPTS
8+
select CLOCK_CONTROL
9+
select PINCTRL
10+
select RISCV_ISA_RV32I
11+
select RISCV_ISA_EXT_A
12+
select RISCV_ISA_EXT_M
13+
select RISCV_ISA_EXT_C
14+
select RISCV_ISA_EXT_ZICSR
15+
select RISCV_ISA_EXT_ZIFENCEI
16+
select HAS_ESPRESSIF_HAL

0 commit comments

Comments
 (0)