Skip to content

Commit c188125

Browse files
AlessandroLuokartben
authored andcommitted
soc: arm: ambiq: apollo510: Add support for Apollo510 SoC
Add all required parts (new SoC family/series, device tree) for the Ambiq Apollo510 SoC. Signed-off-by: Hao Luo <hluo@ambiq.com>
1 parent eaa1add commit c188125

File tree

13 files changed

+580
-2
lines changed

13 files changed

+580
-2
lines changed

dts/arm/ambiq/ambiq_apollo510.dtsi

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
/* Copyright (c) 2025 Ambiq Micro Inc. */
2+
/* SPDX-License-Identifier: Apache-2.0 */
3+
4+
#include <arm/armv8.1-m.dtsi>
5+
#include <mem.h>
6+
#include <freq.h>
7+
#include <apollo510/am_apollo510.h>
8+
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
9+
#include <zephyr/dt-bindings/adc/adc.h>
10+
#include <zephyr/dt-bindings/i2c/i2c.h>
11+
#include <zephyr/dt-bindings/gpio/gpio.h>
12+
13+
/ {
14+
clocks {
15+
uartclk: apb-pclk {
16+
compatible = "fixed-clock";
17+
clock-frequency = <DT_FREQ_M(24)>;
18+
#clock-cells = <0>;
19+
};
20+
21+
xo32m_xtal: xo32m_xtal {
22+
compatible = "fixed-clock";
23+
clock-frequency = <DT_FREQ_M(32)>;
24+
#clock-cells = <0>;
25+
};
26+
27+
xo32m_ext: xo32m_ext {
28+
compatible = "fixed-clock";
29+
clock-frequency = <DT_FREQ_M(32)>;
30+
#clock-cells = <0>;
31+
};
32+
33+
xo32k_xtal: xo32k_xtal {
34+
compatible = "fixed-clock";
35+
clock-frequency = <32768>;
36+
#clock-cells = <0>;
37+
};
38+
39+
xo32k_ext: xo32k_ext {
40+
compatible = "fixed-clock";
41+
clock-frequency = <32768>;
42+
#clock-cells = <0>;
43+
};
44+
45+
extrefclk: extrefclk {
46+
compatible = "fixed-clock";
47+
clock-frequency = <0>;
48+
#clock-cells = <0>;
49+
};
50+
};
51+
52+
cpus {
53+
#address-cells = <1>;
54+
#size-cells = <0>;
55+
56+
cpu0: cpu@0 {
57+
device_type = "cpu";
58+
compatible = "arm,cortex-m55";
59+
reg = <0>;
60+
#address-cells = <1>;
61+
#size-cells = <1>;
62+
cpu-power-states = <&idle &suspend_to_ram>;
63+
64+
itm: itm@e0000000 {
65+
compatible = "arm,armv8m-itm";
66+
reg = <0xe0000000 0x1000>;
67+
swo-ref-frequency = <DT_FREQ_M(48)>;
68+
};
69+
70+
mpu: mpu@e000ed90 {
71+
compatible = "arm,armv8m.1-mpu";
72+
reg = <0xe000ed90 0x40>;
73+
};
74+
};
75+
76+
power-states {
77+
idle: idle {
78+
compatible = "zephyr,power-state";
79+
power-state-name = "suspend-to-idle";
80+
min-residency-us = <2000>;
81+
exit-latency-us = <5>;
82+
};
83+
84+
suspend_to_ram: suspend_to_ram {
85+
compatible = "zephyr,power-state";
86+
power-state-name = "suspend-to-ram";
87+
min-residency-us = <5000>;
88+
exit-latency-us = <125>;
89+
};
90+
};
91+
};
92+
93+
/* MRAM region */
94+
flash0: flash@MRAM_BASE_NAME {
95+
compatible = "soc-nv-flash";
96+
reg = <MRAM_BASE_ADDR MRAM_MAX_SIZE>;
97+
};
98+
99+
/* TCM */
100+
itcm: itcm@ITCM_BASE_NAME {
101+
compatible = "zephyr,memory-region";
102+
reg = <ITCM_BASE_ADDR ITCM_MAX_SIZE>;
103+
zephyr,memory-region = "ITCM";
104+
};
105+
106+
dtcm: dtcm@DTCM_BASE_NAME {
107+
compatible = "zephyr,memory-region";
108+
reg = <DTCM_BASE_ADDR DTCM_MAX_SIZE>;
109+
zephyr,memory-region = "DTCM";
110+
};
111+
112+
/* SRAM */
113+
sram: memory@SSRAM_BASE_NAME {
114+
compatible = "mmio-sram";
115+
reg = <SSRAM_BASE_ADDR SSRAM_MAX_SIZE>;
116+
};
117+
118+
soc {
119+
compatible = "ambiq,apollo510", "ambiq,apollo5x", "simple-bus";
120+
121+
pwrcfg: pwrcfg@PWRCTRL_BASE_NAME {
122+
compatible = "ambiq,pwrctrl";
123+
reg = <PWRCTRL_REG_BASE PWRCTRL_REG_SIZE>;
124+
#pwrcfg-cells = <2>;
125+
};
126+
127+
stimer0: stimer@STIMER_BASE_NAME {
128+
compatible = "ambiq,stimer";
129+
reg = <STIMER_REG_BASE STIMER_REG_SIZE>;
130+
interrupts = <32 0>;
131+
status = "okay";
132+
};
133+
134+
wdt0: watchdog@WDT_BASE_NAME {
135+
compatible = "ambiq,watchdog";
136+
reg = <WDT_REG_BASE WDT_REG_SIZE>;
137+
interrupts = <1 0>;
138+
clock-frequency = <16>;
139+
status = "disabled";
140+
};
141+
142+
uart0: uart@UART0_BASE_NAME {
143+
compatible = "ambiq,uart", "arm,pl011";
144+
reg = <UART0_REG_BASE UART0_REG_SIZE>;
145+
interrupts = <15 0>;
146+
interrupt-names = "UART0";
147+
status = "disabled";
148+
clocks = <&uartclk>;
149+
ambiq,pwrcfg = <&pwrcfg 0x4 0x200>;
150+
};
151+
152+
uart1: uart@UART1_BASE_NAME {
153+
compatible = "ambiq,uart", "arm,pl011";
154+
reg = <UART1_REG_BASE UART1_REG_SIZE>;
155+
interrupts = <16 0>;
156+
interrupt-names = "UART1";
157+
status = "disabled";
158+
clocks = <&uartclk>;
159+
ambiq,pwrcfg = <&pwrcfg 0x4 0x400>;
160+
};
161+
162+
uart2: uart@UART2_BASE_NAME {
163+
compatible = "ambiq,uart", "arm,pl011";
164+
reg = <UART2_REG_BASE UART2_REG_SIZE>;
165+
interrupts = <17 0>;
166+
interrupt-names = "UART2";
167+
status = "disabled";
168+
clocks = <&uartclk>;
169+
ambiq,pwrcfg = <&pwrcfg 0x4 0x800>;
170+
};
171+
172+
uart3: uart@UART3_BASE_NAME {
173+
compatible = "ambiq,uart", "arm,pl011";
174+
reg = <UART3_REG_BASE UART3_REG_SIZE>;
175+
interrupts = <18 0>;
176+
interrupt-names = "UART3";
177+
status = "disabled";
178+
clocks = <&uartclk>;
179+
ambiq,pwrcfg = <&pwrcfg 0x4 0x1000>;
180+
};
181+
182+
pinctrl: pin-controller@GPIO_BASE_NAME {
183+
compatible = "ambiq,apollo5-pinctrl";
184+
reg = <GPIO_REG_BASE GPIO_REG_SIZE>;
185+
#address-cells = <1>;
186+
#size-cells = <0>;
187+
188+
gpio: gpio@GPIO_BASE_NAME {
189+
compatible = "ambiq,gpio";
190+
gpio-map-mask = <0xffffffe0 0xffffffc0>;
191+
gpio-map-pass-thru = <0x1f 0x3f>;
192+
gpio-map = <
193+
0x00 0x0 &gpio0_31 0x0 0x0
194+
0x20 0x0 &gpio32_63 0x0 0x0
195+
0x40 0x0 &gpio64_95 0x0 0x0
196+
0x60 0x0 &gpio96_127 0x0 0x0
197+
0x80 0x0 &gpio128_159 0x0 0x0
198+
0xA0 0x0 &gpio160_191 0x0 0x0
199+
0xC0 0x0 &gpio192_223 0x0 0x0
200+
>;
201+
reg = <GPIO_REG_BASE>;
202+
#gpio-cells = <2>;
203+
#address-cells = <1>;
204+
#size-cells = <0>;
205+
ranges;
206+
207+
gpio0_31: gpio0_31@0 {
208+
compatible = "ambiq,gpio-bank";
209+
gpio-controller;
210+
#gpio-cells = <2>;
211+
reg = <0>;
212+
interrupts = <56 0>;
213+
status = "disabled";
214+
};
215+
216+
gpio32_63: gpio32_63@80 {
217+
compatible = "ambiq,gpio-bank";
218+
gpio-controller;
219+
#gpio-cells = <2>;
220+
reg = <0x80>;
221+
interrupts = <57 0>;
222+
status = "disabled";
223+
};
224+
225+
gpio64_95: gpio64_95@100 {
226+
compatible = "ambiq,gpio-bank";
227+
gpio-controller;
228+
#gpio-cells = <2>;
229+
reg = <0x100>;
230+
interrupts = <58 0>;
231+
status = "disabled";
232+
};
233+
234+
gpio96_127: gpio96_127@180 {
235+
compatible = "ambiq,gpio-bank";
236+
gpio-controller;
237+
#gpio-cells = <2>;
238+
reg = <0x180>;
239+
interrupts = <59 0>;
240+
status = "disabled";
241+
};
242+
243+
gpio128_159: gpio128_159@200 {
244+
compatible = "ambiq,gpio-bank";
245+
gpio-controller;
246+
#gpio-cells = <2>;
247+
reg = <0x200>;
248+
interrupts = <60 0>;
249+
status = "disabled";
250+
};
251+
252+
gpio160_191: gpio160_191@280 {
253+
compatible = "ambiq,gpio-bank";
254+
gpio-controller;
255+
#gpio-cells = <2>;
256+
reg = <0x280>;
257+
interrupts = <61 0>;
258+
status = "disabled";
259+
};
260+
261+
gpio192_223: gpio192_223@300 {
262+
compatible = "ambiq,gpio-bank";
263+
gpio-controller;
264+
#gpio-cells = <2>;
265+
reg = <0x300>;
266+
interrupts = <62 0>;
267+
status = "disabled";
268+
};
269+
};
270+
};
271+
};
272+
};
273+
274+
&nvic {
275+
arm,num-irq-priority-bits = <4>;
276+
};

modules/hal_ambiq/Kconfig.hal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
config AMBIQ_HAL
77
bool "Ambiq HAL drivers support"
8-
depends on SOC_SERIES_APOLLO3X || SOC_SERIES_APOLLO4X
8+
depends on SOC_SERIES_APOLLO3X || SOC_SERIES_APOLLO4X || SOC_SERIES_APOLLO5X
99
help
1010
Use the Ambiq HAL
1111

soc/ambiq/apollo5x/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2025 Ambiq Micro Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
zephyr_sources(soc.c)
7+
zephyr_include_directories(.)
8+
zephyr_sources_ifdef(CONFIG_PM power.c)
9+
zephyr_include_directories(${ZEPHYR_BASE}/soc/arm/common/cortex_m)
10+
11+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "")

soc/ambiq/apollo5x/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025 Ambiq Micro Inc.
4+
5+
config SOC_SERIES_APOLLO5X
6+
select ARM
7+
select CPU_CORTEX_M55
8+
select CPU_CORTEX_M_HAS_DWT
9+
select CPU_CORTEX_M_HAS_VTOR
10+
select CPU_HAS_ARM_SAU
11+
select CPU_HAS_ARM_MPU
12+
select CPU_HAS_FPU
13+
select ARMV8_M_DSP
14+
select ARMV8_1_M_MVEI
15+
select ARMV8_1_M_MVEF
16+
select ARMV8_1_M_PMU
17+
select HAS_SWO
18+
select AMBIQ_HAL
19+
select HAS_PM
20+
select SOC_EARLY_INIT_HOOK
21+
select REQUIRES_FULL_LIBC

soc/ambiq/apollo5x/Kconfig.defconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025 Ambiq Micro Inc.
4+
5+
if SOC_SERIES_APOLLO5X
6+
7+
rsource "Kconfig.defconfig.apollo5*"
8+
9+
config CACHE_MANAGEMENT
10+
default y
11+
12+
config AMBIQ_CACHEABLE_DMA_BUFFER_ALIGNMENT
13+
int
14+
default DCACHE_LINE_SIZE
15+
16+
# Need to enlarge the IDLE stack size because the power
17+
# management operations are executed in the idle task
18+
config IDLE_STACK_SIZE
19+
default 2048 if PM
20+
21+
endif # SOC_SERIES_APOLLO5X
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025 Ambiq Micro Inc.
4+
5+
if SOC_APOLLO510
6+
7+
config NUM_IRQS
8+
default 134
9+
10+
endif # SOC_APOLLO510

soc/ambiq/apollo5x/Kconfig.soc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Copyright (c) 2025 Ambiq Micro Inc.
4+
5+
config SOC_SERIES_APOLLO5X
6+
bool
7+
select SOC_FAMILY_AMBIQ
8+
help
9+
Apollo5 Series MCU
10+
11+
config SOC_APOLLO510
12+
bool
13+
select SOC_SERIES_APOLLO5X
14+
15+
config ARMV8_1_M_PMU_EVENTCNT
16+
int
17+
default 8
18+
19+
config SOC_SERIES
20+
default "apollo5x" if SOC_SERIES_APOLLO5X
21+
22+
config SOC
23+
default "apollo510" if SOC_APOLLO510

0 commit comments

Comments
 (0)