nuttx/drivers/mmcsd
DuoYuWang e84259cbcc drivers/mmcsd: fix eMMC bus width switch sequencing
Two sequencing problems in the MMC wide bus path break eMMC 4-bit
operation on hosts that program the bus width in the SDIO widebus /
clock callbacks (e.g. STM32H7):

1. The SWITCH command (CMD6) is issued before the host has switched
   to wide bus operation.  When the card completes the switch while
   the host is still in 1-bit mode the switch never takes effect and
   every following data transfer times out.  Switch the host to wide
   bus operation before issuing CMD6.

2. The transfer clock is selected only at the end of mmcsd_widebus(),
   so the whole switch sequence runs at ID-mode clock and, on the
   affected hosts, the final clock update does not take effect either,
   leaving the bus at ~400 kHz.  Select the MMC transfer clock before
   calling mmcsd_widebus(), and pick CLOCK_MMC_TRANSFER_4BIT when wide
   bus operation is active (mirroring the SD card path) so a later
   clock selection cannot revert the host to 1-bit.

No behavior change for SD cards, and no change on hosts whose widebus
callback only records the requested state.

Tested on a custom STM32H743 board with eMMC: sd_bench sequential
write ~4.1 MB/s, sequential read ~6.3 MB/s (previously all data
transfers timed out).

Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
2026-07-23 15:26:05 +08:00
..
CMakeLists.txt drivers/mmcsd: Aligned Cmake with Make 2025-12-09 14:25:40 -03:00
Kconfig sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
Make.defs drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
mmcsd.h drivers/mmcsd: Remove eMMC partitions when !CONFIG_MMCSD_MMCSUPPORT 2026-06-02 15:14:38 -03:00
mmcsd_csd.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
mmcsd_debug.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mmcsd_extcsd.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
mmcsd_procfs.c !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
mmcsd_sdio.c drivers/mmcsd: fix eMMC bus width switch sequencing 2026-07-23 15:26:05 +08:00
mmcsd_sdio.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
mmcsd_spi.c libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-07-16 23:37:22 +08:00
mmcsd_spi.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
sdio.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00