Windrow14 opened a new pull request, #12898:
URL: https://github.com/apache/nuttx/pull/12898
## Summary
*Following commits are in a series. They have dependencies on commit(s)
before them, so cannot be put in separate pull requests.*
[1/7] mmcsd: fix unable to switch eMMC device to 4-bit bus width modeAll
eMMC devices support 4-bit bus width, so we should mark the device as
supporting 4-bit bus width after detecting that the device type is eMMC.
[2/7] mmcsd: optimize macros for setting EXT_CSD
CMD6 can use these macros to set any writable EXT_CSD field, not just
the bus width, so optimize these macro definitions to make them general.
[3/7] mmcsd: support MMC high speed SDR mode
According to the eMMC specification, in Backwards Compatibility with
legacy MMC card mode, the frequency of the SD clock must be 0-26 MHZ; in high
speed SDR mode, it must be 0-52MHZ. So we should switch to high speed SDR mode
if the clock frequency is higher than 26MHZ.
[4/7] mmcsd: show eMMC information after initialization is completed
Prompts for capacity, speed mode and bus width after eMMC
initialization is completed.
[5/7] mmcsd: enable clock before issue CMD0
In mmcsd_cardidentify(), the clock is not enabled before issuing CMD0,
and the clock has been disabled in mmcsd_removed(). It makes no sense to enable
the clock after issuing CMD0, because when CMD0 is issued, it will exit with
error due to the clock is not enabled.
[6/7] esp32s3: add SD/mmc driver
Support 1-bit bus width and 4-bit bus width. Support eMMC high speed
SDR mode. Support transfer data with DMA. Support SD clock frequency up to
40MHZ.
[7/7] mmcsd: check ready without sleep
If per tick is set to 10ms, it will cause nxsig_usleep(1000) in the
sdio driver to sleep for 19ms, which is much longer than the expected 1ms,
resulting in very low write performance. Add option to reduce CPU hogging by
using sched_yield(), though it may also affect write performance when the CPU
is busy.
## Impact
[1/7] mmcsd: fix unable to switch eMMC device to 4-bit bus width mode
1. drivers/mmcsd/mmcsd_sdio.c: ->buswith indicates the bus widthes supported
by the device, and ->caps indicates the bus width supported by the host.
Therefore, switch to 4-bit bus width only when both the device and the host
support 4-bit bus width.
[2/7] mmcsd: optimize macros for setting EXT_CSD
1. drivers/mmcsd/mmcsd_sdio.c: switch to new macro definition usage
2. drivers/mmcsd/mmcsd_sdio.h: modify MMCSD_CMD5 macros for common MMC_CMD6
use. Add EXT_CSD bit mode macros.
[3/7] mmcsd: support MMC high speed SDR mode
1. drivers/mmcsd/mmcsd.h: make mode use 4 bits instead of 2.
2. drivers/mmcsd/mmcsd_sdio.c: add setting MMC speed mode.
3. drivers/mmcsd/mmcsd_sdio.h: high speed macro definitions.
4. include/nuttx/sdio.h: mmc high speed mode macro definition.
[4/7] mmcsd: show eMMC information after initialization is completed
1. drivers/mmcsd/mmcsd_sdio.c: add syslog for speed mode after
initialization.
[5/7] mmcsd: enable clock before issue CMD0
1. drivers/mmcsd/mmcsd_sdio.c: enable clock before issuing CMD0.
[6/7] esp32s3: add SD/mmc driver
1. arch/xtensa/src/esp32s3/Kconfig|Make.defs|esp32s3_sdmmc.c: add SD/MMC
configurations, build flag, and feature source code.
2. arch/xtensa/src/esp32s3/hardware/esp32s3_sdmmc.h|esp32s3_soc.h: SD/MMC
register definitions for esp32s3.
3. boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h: head file for
initialization function.
4. boards/xtensa/esp32s3/common/src/Make.defs|esp32s3_board_sdmmc.c:
initialization function implementation.
5. boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c: calling the
initialization function.
[7/7] mmcsd: check ready without sleep
1. drivers/mmcsd/Kconfig|mmcsd_sdio.c: use sched_yield to replace sleep if
tick time is large, also add an option to skip sched_yield.
## Testing
Build an image based on esp32s3-devkit:nsh.
Run it on an esp32s3 with an Emmc device.
Format the Emmc to FAT file system and mount it.
Run tests including sdbench, sdstress, smart_test with and without debugging
information:
Test logs:
https://gist.github.com/Windrow14/422abb515c34d181ca2c8bf75c98ef63.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]