Skip to content

Commit 8a6bcb7

Browse files
committed
drivers: sdhc: Add support for Apollo510 SDIO host
This commit adds support for ambiq SDIO host driver Signed-off-by: Fan Wang <fan.wang@ambiq.com>
1 parent b15404f commit 8a6bcb7

File tree

7 files changed

+149
-0
lines changed

7 files changed

+149
-0
lines changed

boards/ambiq/apollo510_evb/apollo510_evb-pinctrl.dtsi

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,4 +405,78 @@
405405
drive-strength = "0.5";
406406
};
407407
};
408+
409+
sdio0_default: sdio0_default {
410+
group0 {
411+
pinmux = <SDIF0_DAT1_P85>,
412+
<SDIF0_DAT3_P87>,
413+
<SDIF0_DAT4_P156>,
414+
<SDIF0_DAT5_P157>,
415+
<SDIF0_DAT6_P158>,
416+
<SDIF0_DAT7_P159>;
417+
drive-strength = "1.0";
418+
};
419+
group1 {
420+
pinmux = <SDIF0_DAT0_P84>,
421+
<SDIF0_DAT2_P86>,
422+
<SDIF0_CMD_P160>,
423+
<SDIF0_CLKOUT_P88>;
424+
drive-strength = "1.0";
425+
bias-pull-up;
426+
ambiq,pull-up-ohms = <12000>;
427+
};
428+
group2 {
429+
pinmux = <GPIO_P161>;
430+
ambiq,sdif-cdwp = <1>;
431+
};
432+
group3 {
433+
pinmux = <GPIO_P175>;
434+
ambiq,sdif-cdwp = <2>;
435+
};
436+
group4 {
437+
pinmux = <GPIO_P161>;
438+
ambiq,sdif-cdwp = <3>;
439+
};
440+
group5 {
441+
pinmux = <GPIO_P175>;
442+
ambiq,sdif-cdwp = <4>;
443+
};
444+
};
445+
446+
sdio1_default: sdio1_default {
447+
group0 {
448+
pinmux = <SDIF1_DAT1_P126>,
449+
<SDIF1_DAT3_P128>,
450+
<SDIF1_DAT4_P130>,
451+
<SDIF1_DAT5_P131>,
452+
<SDIF1_DAT6_P132>,
453+
<SDIF1_DAT7_P133>;
454+
drive-strength = "1.0";
455+
};
456+
group1 {
457+
pinmux = <SDIF1_DAT0_P125>,
458+
<SDIF1_DAT2_P127>,
459+
<SDIF1_CMD_P134>,
460+
<SDIF1_CLKOUT_P129>;
461+
drive-strength = "1.0";
462+
bias-pull-up;
463+
ambiq,pull-up-ohms = <12000>;
464+
};
465+
group2 {
466+
pinmux = <GPIO_P161>;
467+
ambiq,sdif-cdwp = <1>;
468+
};
469+
group3 {
470+
pinmux = <GPIO_P175>;
471+
ambiq,sdif-cdwp = <2>;
472+
};
473+
group4 {
474+
pinmux = <GPIO_P161>;
475+
ambiq,sdif-cdwp = <3>;
476+
};
477+
group5 {
478+
pinmux = <GPIO_P175>;
479+
ambiq,sdif-cdwp = <4>;
480+
};
481+
};
408482
};

boards/ambiq/apollo510_evb/apollo510_evb.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,27 @@
199199
};
200200
};
201201

202+
&sdio0 {
203+
pinctrl-0 = <&sdio0_default>;
204+
pinctrl-names = "default";
205+
txdelay = <0>;
206+
rxdelay = <0>;
207+
status = "disabled";
208+
mmc {
209+
compatible = "zephyr,mmc-disk";
210+
disk-name = "SD2";
211+
status = "disabled";
212+
};
213+
};
214+
215+
&sdio1 {
216+
pinctrl-0 = <&sdio1_default>;
217+
pinctrl-names = "default";
218+
txdelay = <9>;
219+
rxdelay = <11>;
220+
status = "okay";
221+
};
222+
202223
zephyr_udc0: &usb {
203224
vddusb33-gpios = <&gpio64_95 27 (GPIO_PULL_UP)>;
204225
vddusb0p9-gpios = <&gpio64_95 26 (GPIO_PULL_UP)>;

boards/ambiq/apollo510_evb/apollo510_evb.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ supported:
2222
- pdm
2323
- i2s
2424
- mspi
25+
- sdio
2526
testing:
2627
ignore_tags:
2728
- net

dts/arm/ambiq/ambiq_apollo510.dtsi

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,28 @@
579579
#io-channel-cells = <1>;
580580
};
581581

582+
sdio0: sdio@SDIO0_BASE_NAME {
583+
compatible = "ambiq,sdio";
584+
reg = <SDIO0_REG_BASE SDIO0_REG_SIZE>;
585+
interrupts = <26 0>;
586+
max-bus-freq = <96000000>;
587+
min-bus-freq = <375000>;
588+
power-delay-ms = <50>;
589+
status = "disabled";
590+
zephyr,pm-device-runtime-auto;
591+
};
592+
593+
sdio1: sdio@SDIO1_BASE_NAME {
594+
compatible = "ambiq,sdio";
595+
reg = <SDIO1_REG_BASE SDIO1_REG_SIZE>;
596+
interrupts = <84 0>;
597+
max-bus-freq = <96000000>;
598+
min-bus-freq = <375000>;
599+
power-delay-ms = <50>;
600+
status = "disabled";
601+
zephyr,pm-device-runtime-auto;
602+
};
603+
582604
pinctrl: pin-controller@GPIO_BASE_NAME {
583605
compatible = "ambiq,apollo5-pinctrl";
584606
reg = <GPIO_REG_BASE GPIO_REG_SIZE>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CONFIG_DISK_DRIVER_MMC=y
2+
CONFIG_MMC_STACK=y
3+
CONFIG_SDHC=y
4+
CONFIG_MMC_SUBSYS=y
5+
6+
CONFIG_MAIN_STACK_SIZE=8192
7+
CONFIG_IDLE_STACK_SIZE=4096
8+
CONFIG_AMBIQ_SDIO_ASYNC=y
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (C) 2025 Ambiq Micro Inc. <www.ambiq.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
sdhc0 = &sdio0;
10+
};
11+
};
12+
13+
&sdio0 {
14+
status = "okay";
15+
mmc {
16+
status = "okay";
17+
};
18+
};

samples/subsys/fs/fs_sample/sample.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,8 @@ tests:
8282
sample.filesystem.fat_fs.stm32h747i_disco_m7_sdmmc:
8383
build_only: true
8484
platform_allow: stm32h747i_disco/stm32h747xx/m7
85+
sample.filesystem.fat_fs.ambiq:
86+
build_only: true
87+
platform_allow:
88+
- apollo510_evb
89+
- apollo4p_evb

0 commit comments

Comments
 (0)