Skip to content

Commit 7ea2804

Browse files
fanwang-ambiqcfriedt
authored andcommitted
drivers: sdhc: Add support for Apollo510 SDIO host
This commit added support for Apollo510 SDIO host driver and ambiq board configuration in fs_sample and disk_performance Signed-off-by: Fan Wang <[email protected]>
1 parent 366d938 commit 7ea2804

File tree

12 files changed

+143
-23
lines changed

12 files changed

+143
-23
lines changed

boards/ambiq/apollo4p_evb/apollo4p_evb.dts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@
177177
pinctrl-names = "default";
178178
txdelay = <0>;
179179
rxdelay = <0>;
180-
status = "disabled";
180+
status = "okay";
181181
mmc {
182182
compatible = "zephyr,mmc-disk";
183183
disk-name = "SD2";
184-
status = "disabled";
184+
status = "okay";
185185
};
186186
};
187187

boards/ambiq/apollo4p_evb/apollo4p_evb.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ supported:
1818
- adc
1919
- hwinfo
2020
- usbd
21+
- sdhc
2122
testing:
2223
ignore_tags:
2324
- net

boards/ambiq/apollo510_evb/apollo510_evb-pinctrl.dtsi

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

boards/ambiq/apollo510_evb/apollo510_evb.dts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,27 @@
219219
};
220220
};
221221

222+
&sdio0 {
223+
pinctrl-0 = <&sdio0_default>;
224+
pinctrl-names = "default";
225+
txdelay = <0>;
226+
rxdelay = <0>;
227+
status = "okay";
228+
mmc {
229+
compatible = "zephyr,mmc-disk";
230+
disk-name = "SD2";
231+
status = "okay";
232+
};
233+
};
234+
235+
&sdio1 {
236+
pinctrl-0 = <&sdio1_default>;
237+
pinctrl-names = "default";
238+
txdelay = <9>;
239+
rxdelay = <11>;
240+
status = "okay";
241+
};
242+
222243
zephyr_udc0: &usb {
223244
vddusb33-gpios = <&gpio64_95 27 (GPIO_PULL_UP)>;
224245
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+
- sdhc
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
@@ -692,6 +692,28 @@
692692
#io-channel-cells = <1>;
693693
};
694694

695+
sdio0: sdio@SDIO0_BASE_NAME {
696+
compatible = "ambiq,sdio";
697+
reg = <SDIO0_REG_BASE SDIO0_REG_SIZE>;
698+
interrupts = <26 0>;
699+
max-bus-freq = <96000000>;
700+
min-bus-freq = <375000>;
701+
power-delay-ms = <50>;
702+
status = "disabled";
703+
zephyr,pm-device-runtime-auto;
704+
};
705+
706+
sdio1: sdio@SDIO1_BASE_NAME {
707+
compatible = "ambiq,sdio";
708+
reg = <SDIO1_REG_BASE SDIO1_REG_SIZE>;
709+
interrupts = <84 0>;
710+
max-bus-freq = <96000000>;
711+
min-bus-freq = <375000>;
712+
power-delay-ms = <50>;
713+
status = "disabled";
714+
zephyr,pm-device-runtime-auto;
715+
};
716+
695717
pinctrl: pin-controller@GPIO_BASE_NAME {
696718
compatible = "ambiq,apollo5-pinctrl";
697719
reg = <GPIO_REG_BASE GPIO_REG_SIZE>;

samples/subsys/fs/fs_sample/boards/apollo4p_evb.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
CONFIG_DISK_DRIVER_MMC=y
21
CONFIG_MMC_STACK=y
3-
CONFIG_SDHC=y
4-
CONFIG_MMC_SUBSYS=y
52

63
CONFIG_MAIN_STACK_SIZE=8192
74
CONFIG_IDLE_STACK_SIZE=4096

samples/subsys/fs/fs_sample/boards/apollo4p_evb.overlay

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_MMC_STACK=y
2+
3+
CONFIG_MAIN_STACK_SIZE=8192
4+
CONFIG_IDLE_STACK_SIZE=4096
5+
CONFIG_AMBIQ_SDIO_ASYNC=y

soc/ambiq/apollo5x/soc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ void soc_early_init_hook(void)
5757

5858
/* Enable Dcache */
5959
sys_cache_data_enable();
60+
61+
#ifdef CONFIG_CORTEX_M_DWT
62+
am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_PERIPH_DEBUG);
63+
#endif
6064
}
6165

6266
#if CONFIG_CACHE_MANAGEMENT

0 commit comments

Comments
 (0)