Skip to content

drivers: sdhc: Add support for Apollo510 SDIO host #92455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/ambiq/apollo4p_evb/apollo4p_evb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ supported:
- adc
- hwinfo
- usbd
- sdhc
testing:
ignore_tags:
- net
Expand Down
74 changes: 74 additions & 0 deletions boards/ambiq/apollo510_evb/apollo510_evb-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,78 @@
drive-strength = "0.5";
};
};

sdio0_default: sdio0_default {
group0 {
pinmux = <SDIF0_DAT1_P85>,
<SDIF0_DAT3_P87>,
<SDIF0_DAT4_P156>,
<SDIF0_DAT5_P157>,
<SDIF0_DAT6_P158>,
<SDIF0_DAT7_P159>;
drive-strength = "1.0";
};
group1 {
pinmux = <SDIF0_DAT0_P84>,
<SDIF0_DAT2_P86>,
<SDIF0_CMD_P160>,
<SDIF0_CLKOUT_P88>;
drive-strength = "1.0";
bias-pull-up;
ambiq,pull-up-ohms = <12000>;
};
group2 {
pinmux = <GPIO_P161>;
ambiq,sdif-cdwp = <1>;
};
group3 {
pinmux = <GPIO_P175>;
ambiq,sdif-cdwp = <2>;
};
group4 {
pinmux = <GPIO_P161>;
ambiq,sdif-cdwp = <3>;
};
group5 {
pinmux = <GPIO_P175>;
ambiq,sdif-cdwp = <4>;
};
};

sdio1_default: sdio1_default {
group0 {
pinmux = <SDIF1_DAT1_P126>,
<SDIF1_DAT3_P128>,
<SDIF1_DAT4_P130>,
<SDIF1_DAT5_P131>,
<SDIF1_DAT6_P132>,
<SDIF1_DAT7_P133>;
drive-strength = "1.0";
};
group1 {
pinmux = <SDIF1_DAT0_P125>,
<SDIF1_DAT2_P127>,
<SDIF1_CMD_P134>,
<SDIF1_CLKOUT_P129>;
drive-strength = "1.0";
bias-pull-up;
ambiq,pull-up-ohms = <12000>;
};
group2 {
pinmux = <GPIO_P161>;
ambiq,sdif-cdwp = <1>;
};
group3 {
pinmux = <GPIO_P175>;
ambiq,sdif-cdwp = <2>;
};
group4 {
pinmux = <GPIO_P161>;
ambiq,sdif-cdwp = <3>;
};
group5 {
pinmux = <GPIO_P175>;
ambiq,sdif-cdwp = <4>;
};
};
};
21 changes: 21 additions & 0 deletions boards/ambiq/apollo510_evb/apollo510_evb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,27 @@
};
};

&sdio0 {
pinctrl-0 = <&sdio0_default>;
pinctrl-names = "default";
txdelay = <0>;
rxdelay = <0>;
status = "disabled";
mmc {
compatible = "zephyr,mmc-disk";
disk-name = "SD2";
status = "disabled";
};
};

&sdio1 {
pinctrl-0 = <&sdio1_default>;
pinctrl-names = "default";
txdelay = <9>;
rxdelay = <11>;
status = "okay";
};

zephyr_udc0: &usb {
vddusb33-gpios = <&gpio64_95 27 (GPIO_PULL_UP)>;
vddusb0p9-gpios = <&gpio64_95 26 (GPIO_PULL_UP)>;
Expand Down
1 change: 1 addition & 0 deletions boards/ambiq/apollo510_evb/apollo510_evb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ supported:
- pdm
- i2s
- mspi
- sdhc
testing:
ignore_tags:
- net
Expand Down
22 changes: 22 additions & 0 deletions dts/arm/ambiq/ambiq_apollo510.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,28 @@
#io-channel-cells = <1>;
};

sdio0: sdio@SDIO0_BASE_NAME {
compatible = "ambiq,sdio";
reg = <SDIO0_REG_BASE SDIO0_REG_SIZE>;
interrupts = <26 0>;
max-bus-freq = <96000000>;
min-bus-freq = <375000>;
power-delay-ms = <50>;
status = "disabled";
zephyr,pm-device-runtime-auto;
};

sdio1: sdio@SDIO1_BASE_NAME {
compatible = "ambiq,sdio";
reg = <SDIO1_REG_BASE SDIO1_REG_SIZE>;
interrupts = <84 0>;
max-bus-freq = <96000000>;
min-bus-freq = <375000>;
power-delay-ms = <50>;
status = "disabled";
zephyr,pm-device-runtime-auto;
};

pinctrl: pin-controller@GPIO_BASE_NAME {
compatible = "ambiq,apollo5-pinctrl";
reg = <GPIO_REG_BASE GPIO_REG_SIZE>;
Expand Down
8 changes: 8 additions & 0 deletions samples/subsys/fs/fs_sample/boards/apollo510_evb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CONFIG_DISK_DRIVER_MMC=y
CONFIG_MMC_STACK=y
CONFIG_SDHC=y
CONFIG_MMC_SUBSYS=y

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=4096
CONFIG_AMBIQ_SDIO_ASYNC=y
18 changes: 18 additions & 0 deletions samples/subsys/fs/fs_sample/boards/apollo510_evb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2025 Ambiq Micro Inc. <www.ambiq.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
sdhc0 = &sdio0;
};
};

&sdio0 {
status = "okay";
mmc {
status = "okay";
};
};
8 changes: 8 additions & 0 deletions tests/drivers/disk/disk_performance/boards/apollo4p_evb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CONFIG_DISK_DRIVER_MMC=y
CONFIG_MMC_STACK=y
CONFIG_SDHC=y
CONFIG_MMC_SUBSYS=y

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=4096
CONFIG_AMBIQ_SDIO_ASYNC=y
18 changes: 18 additions & 0 deletions tests/drivers/disk/disk_performance/boards/apollo4p_evb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2025 Ambiq Micro Inc. <www.ambiq.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
sdhc0 = &sdio0;
};
};

&sdio0 {
status = "okay";
mmc {
status = "okay";
};
};
8 changes: 8 additions & 0 deletions tests/drivers/disk/disk_performance/boards/apollo510_evb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CONFIG_DISK_DRIVER_MMC=y
CONFIG_MMC_STACK=y
CONFIG_SDHC=y
CONFIG_MMC_SUBSYS=y

CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=4096
CONFIG_AMBIQ_SDIO_ASYNC=y
18 changes: 18 additions & 0 deletions tests/drivers/disk/disk_performance/boards/apollo510_evb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2025 Ambiq Micro Inc. <www.ambiq.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
sdhc0 = &sdio0;
};
};

&sdio0 {
status = "okay";
mmc {
status = "okay";
};
};