Skip to content

Commit 54c6264

Browse files
fanwang-ambiqAlessandroLuo
authored andcommitted
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 d41716f commit 54c6264

File tree

6 files changed

+133
-0
lines changed

6 files changed

+133
-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
@@ -380,4 +380,78 @@
380380
drive-strength = "0.5";
381381
};
382382
};
383+
384+
sdio0_default: sdio0_default {
385+
group0 {
386+
pinmux = <SDIF0_DAT1_P85>,
387+
<SDIF0_DAT3_P87>,
388+
<SDIF0_DAT4_P156>,
389+
<SDIF0_DAT5_P157>,
390+
<SDIF0_DAT6_P158>,
391+
<SDIF0_DAT7_P159>;
392+
drive-strength = "1.0";
393+
};
394+
group1 {
395+
pinmux = <SDIF0_DAT0_P84>,
396+
<SDIF0_DAT2_P86>,
397+
<SDIF0_CMD_P160>,
398+
<SDIF0_CLKOUT_P88>;
399+
drive-strength = "1.0";
400+
bias-pull-up;
401+
ambiq,pull-up-ohms = <12000>;
402+
};
403+
group2 {
404+
pinmux = <GPIO_P161>;
405+
ambiq,sdif-cdwp = <1>;
406+
};
407+
group3 {
408+
pinmux = <GPIO_P175>;
409+
ambiq,sdif-cdwp = <2>;
410+
};
411+
group4 {
412+
pinmux = <GPIO_P161>;
413+
ambiq,sdif-cdwp = <3>;
414+
};
415+
group5 {
416+
pinmux = <GPIO_P175>;
417+
ambiq,sdif-cdwp = <4>;
418+
};
419+
};
420+
421+
sdio1_default: sdio1_default {
422+
group0 {
423+
pinmux = <SDIF1_DAT1_P126>,
424+
<SDIF1_DAT3_P128>,
425+
<SDIF1_DAT4_P130>,
426+
<SDIF1_DAT5_P131>,
427+
<SDIF1_DAT6_P132>,
428+
<SDIF1_DAT7_P133>;
429+
drive-strength = "1.0";
430+
};
431+
group1 {
432+
pinmux = <SDIF1_DAT0_P125>,
433+
<SDIF1_DAT2_P127>,
434+
<SDIF1_CMD_P134>,
435+
<SDIF1_CLKOUT_P129>;
436+
drive-strength = "1.0";
437+
bias-pull-up;
438+
ambiq,pull-up-ohms = <12000>;
439+
};
440+
group2 {
441+
pinmux = <GPIO_P161>;
442+
ambiq,sdif-cdwp = <1>;
443+
};
444+
group3 {
445+
pinmux = <GPIO_P175>;
446+
ambiq,sdif-cdwp = <2>;
447+
};
448+
group4 {
449+
pinmux = <GPIO_P161>;
450+
ambiq,sdif-cdwp = <3>;
451+
};
452+
group5 {
453+
pinmux = <GPIO_P175>;
454+
ambiq,sdif-cdwp = <4>;
455+
};
456+
};
383457
};

boards/ambiq/apollo510_evb/apollo510_evb.dts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@
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+
202215
zephyr_udc0: &usb {
203216
vddusb33-gpios = <&gpio64_95 27 (GPIO_PULL_UP)>;
204217
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
@@ -20,6 +20,7 @@ supported:
2020
- clock_control
2121
- usbd
2222
- mspi
23+
- sdio
2324
testing:
2425
ignore_tags:
2526
- net

dts/arm/ambiq/ambiq_apollo510.dtsi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,22 @@
559559
#io-channel-cells = <1>;
560560
};
561561

562+
sdio0: sdio@SDIO0_BASE_NAME {
563+
compatible = "ambiq,sdio";
564+
reg = <SDIO0_REG_BASE SDIO0_REG_SIZE>;
565+
interrupts = <26 0>;
566+
status = "disabled";
567+
zephyr,pm-device-runtime-auto;
568+
};
569+
570+
sdio1: sdio@SDIO1_BASE_NAME {
571+
compatible = "ambiq,sdio";
572+
reg = <SDIO1_REG_BASE SDIO1_REG_SIZE>;
573+
interrupts = <84 0>;
574+
status = "disabled";
575+
zephyr,pm-device-runtime-auto;
576+
};
577+
562578
pinctrl: pin-controller@GPIO_BASE_NAME {
563579
compatible = "ambiq,apollo5-pinctrl";
564580
reg = <GPIO_REG_BASE GPIO_REG_SIZE>;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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
9+
CONFIG_PM=y
10+
CONFIG_PM_DEVICE=y
11+
CONFIG_PM_DEVICE_RUNTIME=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+
};

0 commit comments

Comments
 (0)