Skip to content

Commit 5437eed

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 5437eed

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