From 021363f1dbf48f2af6a9974b6dfdd0063b2c431f Mon Sep 17 00:00:00 2001 From: Xu Xingliang Date: Tue, 21 Dec 2021 19:55:38 +0800 Subject: [PATCH] driver/mmcsd: add option to limit block count in multiple-block transfer mode. Signed-off-by: Xu Xingliang --- arch/arm/src/cxd56xx/cxd56_sdhci.c | 2 +- .../imxrt/teensy-4.x/configs/sd-4.1/defconfig | 2 +- boards/arm/kinetis/freedom-k64f/README.txt | 4 +- .../freedom-k64f/configs/cdcacm/defconfig | 2 +- .../freedom-k64f/configs/demo/defconfig | 2 +- .../freedom-k64f/configs/nsh/defconfig | 2 +- boards/arm/kinetis/freedom-k66f/README.txt | 4 +- .../freedom-k66f/configs/nsh/defconfig | 2 +- .../configs/composite/defconfig | 2 +- .../lpc54xx/lpcxpresso-lpc54628/README.txt | 2 +- boards/arm/sam34/arduino-due/README.txt | 4 +- boards/arm/sam34/sam4e-ek/README.txt | 4 +- boards/arm/sam34/sam4l-xplained/README.txt | 4 +- boards/arm/sama5/sama5d3-xplained/README.txt | 6 +- boards/arm/sama5/sama5d3x-ek/README.txt | 6 +- .../sama5/sama5d3x-ek/configs/demo/defconfig | 2 +- .../sama5d3x-ek/configs/nxplayer/defconfig | 2 +- boards/arm/sama5/sama5d4-ek/README.txt | 6 +- .../sama5/sama5d4-ek/configs/ipv6/defconfig | 2 +- .../sama5/sama5d4-ek/configs/knsh/defconfig | 2 +- .../sama5/sama5d4-ek/configs/nsh/defconfig | 2 +- .../sama5/sama5d4-ek/configs/nxwm/defconfig | 2 +- boards/arm/samd2l2/samd20-xplained/README.txt | 4 +- boards/arm/samd2l2/samd21-xplained/README.txt | 4 +- boards/arm/samd2l2/saml21-xplained/README.txt | 4 +- boards/arm/samv7/same70-qmtech/README.txt | 2 +- .../configs/mcuboot-confirm/defconfig | 2 +- .../configs/mcuboot-loader/defconfig | 2 +- .../samv7/same70-qmtech/configs/nsh/defconfig | 2 +- boards/arm/samv7/same70-xplained/README.txt | 4 +- .../same70-xplained/configs/adc/defconfig | 2 +- .../configs/mcuboot-confirm/defconfig | 2 +- .../configs/mcuboot-loader/defconfig | 2 +- .../same70-xplained/configs/netnsh/defconfig | 2 +- .../same70-xplained/configs/nsh/defconfig | 2 +- .../same70-xplained/configs/twm4nx/defconfig | 2 +- boards/arm/samv7/samv71-xult/README.txt | 4 +- .../samv7/samv71-xult/configs/knsh/defconfig | 2 +- .../configs/mrf24j40-starhub/defconfig | 2 +- .../samv71-xult/configs/mxtxplnd/defconfig | 2 +- .../samv71-xult/configs/netnsh/defconfig | 2 +- .../samv7/samv71-xult/configs/nsh/defconfig | 2 +- .../samv7/samv71-xult/configs/nxwm/defconfig | 2 +- .../samv7/samv71-xult/configs/vnc/defconfig | 2 +- .../samv7/samv71-xult/configs/vnxwm/defconfig | 2 +- boards/arm/stm32/olimex-stm32-p407/README.txt | 2 +- boards/arm/stm32/stm3220g-eval/README.txt | 4 +- .../stm32/stm3220g-eval/configs/nsh/defconfig | 2 +- .../stm3220g-eval/configs/nsh2/defconfig | 2 +- .../stm3220g-eval/configs/nxwm/defconfig | 2 +- boards/arm/stm32/stm3240g-eval/README.txt | 4 +- .../stm3240g-eval/configs/nsh2/defconfig | 2 +- .../stm32f4discovery/configs/ipv6/defconfig | 2 +- .../stm32f4discovery/configs/netnsh/defconfig | 2 +- .../stm32f746-ws/configs/nsh/defconfig | 2 +- .../xmc4/xmc4500-relax/configs/nsh/defconfig | 2 +- .../sim/sim/configs/pf_ieee802154/defconfig | 2 +- boards/sim/sim/sim/configs/pktradio/defconfig | 2 +- .../sim/sim/sim/configs/sixlowpan/defconfig | 2 +- .../makerlisp/configs/nsh_flash/defconfig | 2 +- .../ez80/makerlisp/configs/nsh_ram/defconfig | 2 +- .../ez80/makerlisp/configs/sdboot/defconfig | 2 +- boards/z80/ez80/z20x/configs/nsh/defconfig | 2 +- boards/z80/ez80/z20x/configs/sdboot/defconfig | 2 +- drivers/mmcsd/Kconfig | 14 +- drivers/mmcsd/mmcsd_sdio.c | 129 ++++++++++-------- 66 files changed, 160 insertions(+), 147 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_sdhci.c b/arch/arm/src/cxd56xx/cxd56_sdhci.c index c736c3d43e..6914f6034d 100644 --- a/arch/arm/src/cxd56xx/cxd56_sdhci.c +++ b/arch/arm/src/cxd56xx/cxd56_sdhci.c @@ -68,7 +68,7 @@ # error "Callback support requires CONFIG_SCHED_WORKQUEUE and CONFIG_SCHED_HPWORK" #endif -#if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) && !defined(CONFIG_SDIO_BLOCKSETUP) +#if (CONFIG_MMCSD_MULTIBLOCK_LIMIT != 1) && !defined(CONFIG_SDIO_BLOCKSETUP) # error "This driver requires CONFIG_SDIO_BLOCKSETUP" #endif diff --git a/boards/arm/imxrt/teensy-4.x/configs/sd-4.1/defconfig b/boards/arm/imxrt/teensy-4.x/configs/sd-4.1/defconfig index be10f8f74b..f633e977af 100644 --- a/boards/arm/imxrt/teensy-4.x/configs/sd-4.1/defconfig +++ b/boards/arm/imxrt/teensy-4.x/configs/sd-4.1/defconfig @@ -35,7 +35,7 @@ CONFIG_IMXRT_USDHC1_WIDTH_D1_D4=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y diff --git a/boards/arm/kinetis/freedom-k64f/README.txt b/boards/arm/kinetis/freedom-k64f/README.txt index b81ff18598..cdc2414753 100644 --- a/boards/arm/kinetis/freedom-k64f/README.txt +++ b/boards/arm/kinetis/freedom-k64f/README.txt @@ -448,8 +448,8 @@ SD Card Support Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support diff --git a/boards/arm/kinetis/freedom-k64f/configs/cdcacm/defconfig b/boards/arm/kinetis/freedom-k64f/configs/cdcacm/defconfig index a24c3dc318..47b42f6bb1 100644 --- a/boards/arm/kinetis/freedom-k64f/configs/cdcacm/defconfig +++ b/boards/arm/kinetis/freedom-k64f/configs/cdcacm/defconfig @@ -38,7 +38,7 @@ CONFIG_KINETIS_SDHC=y CONFIG_KINETIS_UART0=y CONFIG_KINETIS_USBOTG=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MOTOROLA_SREC=y CONFIG_NSH_ARCHINIT=y diff --git a/boards/arm/kinetis/freedom-k64f/configs/demo/defconfig b/boards/arm/kinetis/freedom-k64f/configs/demo/defconfig index 13699fa19f..bac0ff69be 100644 --- a/boards/arm/kinetis/freedom-k64f/configs/demo/defconfig +++ b/boards/arm/kinetis/freedom-k64f/configs/demo/defconfig @@ -42,7 +42,7 @@ CONFIG_KINETIS_PORTEINTS=y CONFIG_KINETIS_SDHC=y CONFIG_KINETIS_UART0=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MOTOROLA_SREC=y CONFIG_NETDB_DNSCLIENT=y diff --git a/boards/arm/kinetis/freedom-k64f/configs/nsh/defconfig b/boards/arm/kinetis/freedom-k64f/configs/nsh/defconfig index 041fec9364..45d106c70e 100644 --- a/boards/arm/kinetis/freedom-k64f/configs/nsh/defconfig +++ b/boards/arm/kinetis/freedom-k64f/configs/nsh/defconfig @@ -37,7 +37,7 @@ CONFIG_KINETIS_PORTEINTS=y CONFIG_KINETIS_SDHC=y CONFIG_KINETIS_UART0=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MOTOROLA_SREC=y CONFIG_NSH_ARCHINIT=y diff --git a/boards/arm/kinetis/freedom-k66f/README.txt b/boards/arm/kinetis/freedom-k66f/README.txt index 53501be86d..688f8c3333 100644 --- a/boards/arm/kinetis/freedom-k66f/README.txt +++ b/boards/arm/kinetis/freedom-k66f/README.txt @@ -451,8 +451,8 @@ SD Card Support Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support diff --git a/boards/arm/kinetis/freedom-k66f/configs/nsh/defconfig b/boards/arm/kinetis/freedom-k66f/configs/nsh/defconfig index 7ae54bf493..83934bf617 100644 --- a/boards/arm/kinetis/freedom-k66f/configs/nsh/defconfig +++ b/boards/arm/kinetis/freedom-k66f/configs/nsh/defconfig @@ -63,7 +63,7 @@ CONFIG_KINETIS_UART_BREAKS=y CONFIG_KINETIS_UART_EXTEDED_BREAK=y CONFIG_LIBC_STRERROR=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y diff --git a/boards/arm/lpc214x/mcu123-lpc214x/configs/composite/defconfig b/boards/arm/lpc214x/mcu123-lpc214x/configs/composite/defconfig index 7a7afa1ec1..b01330d9cf 100644 --- a/boards/arm/lpc214x/mcu123-lpc214x/configs/composite/defconfig +++ b/boards/arm/lpc214x/mcu123-lpc214x/configs/composite/defconfig @@ -33,7 +33,7 @@ CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INIT_ENTRYPOINT="conn_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_PREALLOC_TIMERS=4 CONFIG_RAM_SIZE=32768 CONFIG_RAM_START=0x40000000 diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/README.txt b/boards/arm/lpc54xx/lpcxpresso-lpc54628/README.txt index 2c600a1be8..78b019ae70 100644 --- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/README.txt +++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/README.txt @@ -455,7 +455,7 @@ Configurations CONFIG_MMCSD=y CONFIG_MMCSD_NSLOTS=1 - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_HAVE_CARDDETECT=y CONFIG_MMCSD_HAVE_WRITEPROTECT=y CONFIG_ARCH_HAVE_SDIO=y diff --git a/boards/arm/sam34/arduino-due/README.txt b/boards/arm/sam34/arduino-due/README.txt index 9f8cee35aa..957bbce6d5 100644 --- a/boards/arm/sam34/arduino-due/README.txt +++ b/boards/arm/sam34/arduino-due/README.txt @@ -798,8 +798,8 @@ Configuration sub-directories CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot - CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers - CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers + CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required diff --git a/boards/arm/sam34/sam4e-ek/README.txt b/boards/arm/sam34/sam4e-ek/README.txt index 4b37feef3c..ff34a8da08 100644 --- a/boards/arm/sam34/sam4e-ek/README.txt +++ b/boards/arm/sam34/sam4e-ek/README.txt @@ -675,9 +675,9 @@ HSMCI Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : Probably works but is untested + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : Probably works but is untested CONFIG_SDIO_DMA=y : Use SDIO DMA CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes diff --git a/boards/arm/sam34/sam4l-xplained/README.txt b/boards/arm/sam34/sam4l-xplained/README.txt index c5211f2b5f..6d4e33f7bc 100644 --- a/boards/arm/sam34/sam4l-xplained/README.txt +++ b/boards/arm/sam34/sam4l-xplained/README.txt @@ -515,8 +515,8 @@ Configuration sub-directories CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot - CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers - CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers + CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required diff --git a/boards/arm/sama5/sama5d3-xplained/README.txt b/boards/arm/sama5/sama5d3-xplained/README.txt index 964e258370..6ed7daafe4 100644 --- a/boards/arm/sama5/sama5d3-xplained/README.txt +++ b/boards/arm/sama5/sama5d3-xplained/README.txt @@ -1224,8 +1224,8 @@ HSMCI Card Slots Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support @@ -3318,7 +3318,7 @@ To-Do List endpoint support in the EHCI driver is untested (but works in similar EHCI drivers). -2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block +2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block transfers because of some issues that I saw during testing. The is very low priority to me but might be important to you if you are need very high performance SD card accesses. diff --git a/boards/arm/sama5/sama5d3x-ek/README.txt b/boards/arm/sama5/sama5d3x-ek/README.txt index 0dc33d3457..9d81e34804 100644 --- a/boards/arm/sama5/sama5d3x-ek/README.txt +++ b/boards/arm/sama5/sama5d3x-ek/README.txt @@ -1267,8 +1267,8 @@ HSMCI Card Slots Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support @@ -3775,7 +3775,7 @@ To-Do List endpoint support in the EHCI driver is untested (but works in similar EHCI drivers). -3) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block +3) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block transfers because of some issues that I saw during testing. The is very low priority to me but might be important to you if you are need very high performance SD card accesses. diff --git a/boards/arm/sama5/sama5d3x-ek/configs/demo/defconfig b/boards/arm/sama5/sama5d3x-ek/configs/demo/defconfig index 466c7fb410..ab75638d63 100644 --- a/boards/arm/sama5/sama5d3x-ek/configs/demo/defconfig +++ b/boards/arm/sama5/sama5d3x-ek/configs/demo/defconfig @@ -34,7 +34,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MM_REGIONS=2 CONFIG_MTD=y diff --git a/boards/arm/sama5/sama5d3x-ek/configs/nxplayer/defconfig b/boards/arm/sama5/sama5d3x-ek/configs/nxplayer/defconfig index 36e0edd09d..8d2bf675d0 100644 --- a/boards/arm/sama5/sama5d3x-ek/configs/nxplayer/defconfig +++ b/boards/arm/sama5/sama5d3x-ek/configs/nxplayer/defconfig @@ -41,7 +41,7 @@ CONFIG_I2C_RESET=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MM_REGIONS=2 CONFIG_NSH_ARCHINIT=y diff --git a/boards/arm/sama5/sama5d4-ek/README.txt b/boards/arm/sama5/sama5d4-ek/README.txt index 4e7559395d..8ba43ff842 100644 --- a/boards/arm/sama5/sama5d4-ek/README.txt +++ b/boards/arm/sama5/sama5d4-ek/README.txt @@ -1633,8 +1633,8 @@ HSMCI Card Slots Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support @@ -4929,7 +4929,7 @@ To-Do List endpoint support in the EHCI driver is untested (but works in similar EHCI drivers). -2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block +2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block transfers because of some issues that I saw during testing. The is very low priority to me but might be important to you if you are need very high performance SD card accesses. diff --git a/boards/arm/sama5/sama5d4-ek/configs/ipv6/defconfig b/boards/arm/sama5/sama5d4-ek/configs/ipv6/defconfig index d9405c277c..07bc2a831b 100644 --- a/boards/arm/sama5/sama5d4-ek/configs/ipv6/defconfig +++ b/boards/arm/sama5/sama5d4-ek/configs/ipv6/defconfig @@ -55,7 +55,7 @@ CONFIG_INPUT=y CONFIG_INPUT_MXT=y CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_NET=y diff --git a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig index e97cc987b4..0efc437cb6 100644 --- a/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig +++ b/boards/arm/sama5/sama5d4-ek/configs/knsh/defconfig @@ -49,7 +49,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_EXECFUNCS=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MM_PGALLOC=y CONFIG_NSH_FILE_APPS=y diff --git a/boards/arm/sama5/sama5d4-ek/configs/nsh/defconfig b/boards/arm/sama5/sama5d4-ek/configs/nsh/defconfig index 943e50c93f..8c02248298 100644 --- a/boards/arm/sama5/sama5d4-ek/configs/nsh/defconfig +++ b/boards/arm/sama5/sama5d4-ek/configs/nsh/defconfig @@ -55,7 +55,7 @@ CONFIG_INPUT_MXT=y CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_HOSTNAME="SAMA5D4-EK" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_NET=y diff --git a/boards/arm/sama5/sama5d4-ek/configs/nxwm/defconfig b/boards/arm/sama5/sama5d4-ek/configs/nxwm/defconfig index 4ca7476168..70db44feaa 100644 --- a/boards/arm/sama5/sama5d4-ek/configs/nxwm/defconfig +++ b/boards/arm/sama5/sama5d4-ek/configs/nxwm/defconfig @@ -58,7 +58,7 @@ CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_NET=y diff --git a/boards/arm/samd2l2/samd20-xplained/README.txt b/boards/arm/samd2l2/samd20-xplained/README.txt index e89d0171bd..8fffa32ef9 100644 --- a/boards/arm/samd2l2/samd20-xplained/README.txt +++ b/boards/arm/samd2l2/samd20-xplained/README.txt @@ -750,9 +750,9 @@ Configuration sub-directories CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot - CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers + CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards - CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required diff --git a/boards/arm/samd2l2/samd21-xplained/README.txt b/boards/arm/samd2l2/samd21-xplained/README.txt index 3139739452..295242201e 100644 --- a/boards/arm/samd2l2/samd21-xplained/README.txt +++ b/boards/arm/samd2l2/samd21-xplained/README.txt @@ -621,9 +621,9 @@ Configuration sub-directories CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot - CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers + CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards - CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required diff --git a/boards/arm/samd2l2/saml21-xplained/README.txt b/boards/arm/samd2l2/saml21-xplained/README.txt index b40a3da1c0..7905048f40 100644 --- a/boards/arm/samd2l2/saml21-xplained/README.txt +++ b/boards/arm/samd2l2/saml21-xplained/README.txt @@ -782,9 +782,9 @@ Configuration sub-directories CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot - CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers + CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards - CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required diff --git a/boards/arm/samv7/same70-qmtech/README.txt b/boards/arm/samv7/same70-qmtech/README.txt index 517d5d7114..4ddc77b82c 100644 --- a/boards/arm/samv7/same70-qmtech/README.txt +++ b/boards/arm/samv7/same70-qmtech/README.txt @@ -99,7 +99,7 @@ the SD slots can be enabled with the following settings: Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support diff --git a/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig b/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig index 337f76e097..eeab5d45b2 100644 --- a/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig +++ b/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig @@ -33,7 +33,7 @@ CONFIG_FS_FAT=y CONFIG_FS_PROCFS=y CONFIG_INIT_ENTRYPOINT="mcuboot_confirm_main" CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y diff --git a/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig b/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig index 2f1518718a..d9cb7ef029 100644 --- a/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig +++ b/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig @@ -34,7 +34,7 @@ CONFIG_FS_PROCFS=y CONFIG_INIT_ENTRYPOINT="mcuboot_loader_main" CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_ENABLE_LOGGING=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y diff --git a/boards/arm/samv7/same70-qmtech/configs/nsh/defconfig b/boards/arm/samv7/same70-qmtech/configs/nsh/defconfig index a80f0c4252..02be69d598 100644 --- a/boards/arm/samv7/same70-qmtech/configs/nsh/defconfig +++ b/boards/arm/samv7/same70-qmtech/configs/nsh/defconfig @@ -33,7 +33,7 @@ CONFIG_FAT_LFN=y CONFIG_FS_FAT=y CONFIG_FS_PROCFS=y CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y diff --git a/boards/arm/samv7/same70-xplained/README.txt b/boards/arm/samv7/same70-xplained/README.txt index ab3aa025e8..5012df1492 100644 --- a/boards/arm/samv7/same70-xplained/README.txt +++ b/boards/arm/samv7/same70-xplained/README.txt @@ -162,8 +162,8 @@ the SD slots can be enabled with the following settings: Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) - CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) + CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support diff --git a/boards/arm/samv7/same70-xplained/configs/adc/defconfig b/boards/arm/samv7/same70-xplained/configs/adc/defconfig index 0090301be8..3d64e10a6a 100644 --- a/boards/arm/samv7/same70-xplained/configs/adc/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/adc/defconfig @@ -46,7 +46,7 @@ CONFIG_FS_FAT=y CONFIG_FS_PROCFS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig index 5089a976ff..395c5b49a8 100644 --- a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig @@ -43,7 +43,7 @@ CONFIG_FS_PROCFS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="mcuboot_confirm_main" CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig index fba8684292..bb2b3fd399 100644 --- a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig @@ -44,7 +44,7 @@ CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="mcuboot_loader_main" CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_ENABLE_LOGGING=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/arm/samv7/same70-xplained/configs/netnsh/defconfig b/boards/arm/samv7/same70-xplained/configs/netnsh/defconfig index ab4fc06119..f9cae39f4e 100644 --- a/boards/arm/samv7/same70-xplained/configs/netnsh/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/netnsh/defconfig @@ -44,7 +44,7 @@ CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_IOB_NBUFFERS=24 CONFIG_LIBC_HOSTNAME="SAME70-Xplained" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/same70-xplained/configs/nsh/defconfig b/boards/arm/samv7/same70-xplained/configs/nsh/defconfig index a2596f9197..725eed85f3 100644 --- a/boards/arm/samv7/same70-xplained/configs/nsh/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/nsh/defconfig @@ -42,7 +42,7 @@ CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/same70-xplained/configs/twm4nx/defconfig b/boards/arm/samv7/same70-xplained/configs/twm4nx/defconfig index 455fd0c452..e2524bc90a 100644 --- a/boards/arm/samv7/same70-xplained/configs/twm4nx/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/twm4nx/defconfig @@ -46,7 +46,7 @@ CONFIG_I2C_DRIVER=y CONFIG_INIT_ENTRYPOINT="twm4nx_main" CONFIG_IOB_NBUFFERS=24 CONFIG_LIBC_HOSTNAME="SAME70-Xplained" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MM_REGIONS=2 CONFIG_MQ_MAXMSGSIZE=64 diff --git a/boards/arm/samv7/samv71-xult/README.txt b/boards/arm/samv7/samv71-xult/README.txt index 4608515c60..1227b3bec5 100644 --- a/boards/arm/samv7/samv71-xult/README.txt +++ b/boards/arm/samv7/samv71-xult/README.txt @@ -79,7 +79,7 @@ to be resolved. General problems are listed below. But see the STATUS section associated with each configuration for additional issues specific to a particular configuration. - 1. HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block + 1. HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block transfers only because I have not yet had a chance to verify this. The is very low priority to me but might be important to you if you are need very high performance SD card accesses. @@ -275,7 +275,7 @@ Enabling HSMCI support. The SAMV7-XULT provides a one, full-size SD memory card Device Drivers -> MMC/SD Driver Support CONFIG_MMCSD=y : Enable MMC/SD support CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT) + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT) CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support diff --git a/boards/arm/samv7/samv71-xult/configs/knsh/defconfig b/boards/arm/samv7/samv71-xult/configs/knsh/defconfig index f457d2bb63..8814ca0fc0 100644 --- a/boards/arm/samv7/samv71-xult/configs/knsh/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/knsh/defconfig @@ -44,7 +44,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/samv71-xult/configs/mrf24j40-starhub/defconfig b/boards/arm/samv7/samv71-xult/configs/mrf24j40-starhub/defconfig index 15e7567e9f..6780206f42 100644 --- a/boards/arm/samv7/samv71-xult/configs/mrf24j40-starhub/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/mrf24j40-starhub/defconfig @@ -55,7 +55,7 @@ CONFIG_IOB_NBUFFERS=32 CONFIG_IOB_NCHAINS=16 CONFIG_LIBC_HOSTNAME="MRF24J40-Hub" CONFIG_MAC802154_NTXDESC=32 -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/samv71-xult/configs/mxtxplnd/defconfig b/boards/arm/samv7/samv71-xult/configs/mxtxplnd/defconfig index cd22ac4799..1c70eff3d3 100644 --- a/boards/arm/samv7/samv71-xult/configs/mxtxplnd/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/mxtxplnd/defconfig @@ -49,7 +49,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INPUT=y CONFIG_INPUT_MXT=y CONFIG_LCD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_MTD=y diff --git a/boards/arm/samv7/samv71-xult/configs/netnsh/defconfig b/boards/arm/samv7/samv71-xult/configs/netnsh/defconfig index 9436501a43..7d402a102b 100644 --- a/boards/arm/samv7/samv71-xult/configs/netnsh/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/netnsh/defconfig @@ -44,7 +44,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_LIBC_HOSTNAME="SAMV71-XULT" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/samv71-xult/configs/nsh/defconfig b/boards/arm/samv7/samv71-xult/configs/nsh/defconfig index 67f4f5cdd3..7c54a6d594 100644 --- a/boards/arm/samv7/samv71-xult/configs/nsh/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/nsh/defconfig @@ -43,7 +43,7 @@ CONFIG_HOST_WINDOWS=y CONFIG_I2CTOOL_MAXBUS=0 CONFIG_I2C_RESET=y CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_MTD_AT24XX=y diff --git a/boards/arm/samv7/samv71-xult/configs/nxwm/defconfig b/boards/arm/samv7/samv71-xult/configs/nxwm/defconfig index 943746fe0b..7c442f343e 100644 --- a/boards/arm/samv7/samv71-xult/configs/nxwm/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/nxwm/defconfig @@ -53,7 +53,7 @@ CONFIG_LCD=y CONFIG_LCD_NOGETRUN=y CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBM=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_MTD=y diff --git a/boards/arm/samv7/samv71-xult/configs/vnc/defconfig b/boards/arm/samv7/samv71-xult/configs/vnc/defconfig index 916bf6eb6c..b973bdef3f 100644 --- a/boards/arm/samv7/samv71-xult/configs/vnc/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/vnc/defconfig @@ -51,7 +51,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_IOB_NBUFFERS=72 CONFIG_IOB_THROTTLE=32 CONFIG_LIBC_HOSTNAME="SAMV71-XULT" -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_MTD=y diff --git a/boards/arm/samv7/samv71-xult/configs/vnxwm/defconfig b/boards/arm/samv7/samv71-xult/configs/vnxwm/defconfig index e0a10f2260..4238b1f73a 100644 --- a/boards/arm/samv7/samv71-xult/configs/vnxwm/defconfig +++ b/boards/arm/samv7/samv71-xult/configs/vnxwm/defconfig @@ -54,7 +54,7 @@ CONFIG_IOB_THROTTLE=32 CONFIG_LIBC_FLOATINGPOINT=y CONFIG_LIBC_HOSTNAME="SAMV71-XULT" CONFIG_LIBM=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MQ_MAXMSGSIZE=64 CONFIG_MTD=y diff --git a/boards/arm/stm32/olimex-stm32-p407/README.txt b/boards/arm/stm32/olimex-stm32-p407/README.txt index 6821698c62..db081f3dea 100644 --- a/boards/arm/stm32/olimex-stm32-p407/README.txt +++ b/boards/arm/stm32/olimex-stm32-p407/README.txt @@ -103,7 +103,7 @@ microSD Card Interface # CONFIG_MMCSD_MMCSUPPORT is not set : Interferes with some SD cards # CONFIG_MMCSD_SPI is not set : No SPI-based MMC/SD support CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support - CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : Disable to keep things simple + CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : Disable to keep things simple CONFIG_SDIO_DMA=y : Use SDIO DMA # CONFIG_SDIO_BLOCKSETUP is not set : (not implemented) diff --git a/boards/arm/stm32/stm3220g-eval/README.txt b/boards/arm/stm32/stm3220g-eval/README.txt index 0690169085..d0ba1c7e6f 100644 --- a/boards/arm/stm32/stm3220g-eval/README.txt +++ b/boards/arm/stm32/stm3220g-eval/README.txt @@ -777,9 +777,9 @@ Where is one of the following: "If you use a large I/O buffer to access the file system, then the MMCSD driver will perform multiple block SD transfers. With DMA ON, this seems to result in CRC errors detected by the hardware - during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y" + during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_LIMIT=1" - For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig + For this reason, CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 appears in the defconfig file. 7. Another DMA-related concern. I see this statement in the reference diff --git a/boards/arm/stm32/stm3220g-eval/configs/nsh/defconfig b/boards/arm/stm32/stm3220g-eval/configs/nsh/defconfig index 7c125db2b9..8bb25af193 100644 --- a/boards/arm/stm32/stm3220g-eval/configs/nsh/defconfig +++ b/boards/arm/stm32/stm3220g-eval/configs/nsh/defconfig @@ -29,7 +29,7 @@ CONFIG_I2C_POLLED=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MTD=y CONFIG_NET=y CONFIG_NETDB_DNSCLIENT=y diff --git a/boards/arm/stm32/stm3220g-eval/configs/nsh2/defconfig b/boards/arm/stm32/stm3220g-eval/configs/nsh2/defconfig index 34a1bddde5..86718023af 100644 --- a/boards/arm/stm32/stm3220g-eval/configs/nsh2/defconfig +++ b/boards/arm/stm32/stm3220g-eval/configs/nsh2/defconfig @@ -34,7 +34,7 @@ CONFIG_I2C_POLLED=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_NET=y diff --git a/boards/arm/stm32/stm3220g-eval/configs/nxwm/defconfig b/boards/arm/stm32/stm3220g-eval/configs/nxwm/defconfig index f959eb357b..abcc141f85 100644 --- a/boards/arm/stm32/stm3220g-eval/configs/nxwm/defconfig +++ b/boards/arm/stm32/stm3220g-eval/configs/nxwm/defconfig @@ -38,7 +38,7 @@ CONFIG_LCD=y CONFIG_LCD_MAXCONTRAST=1 CONFIG_LCD_NOGETRUN=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MQ_MAXMSGSIZE=64 CONFIG_NET=y CONFIG_NETINIT_NOMAC=y diff --git a/boards/arm/stm32/stm3240g-eval/README.txt b/boards/arm/stm32/stm3240g-eval/README.txt index 5a3466a59b..1cdc6068eb 100644 --- a/boards/arm/stm32/stm3240g-eval/README.txt +++ b/boards/arm/stm32/stm3240g-eval/README.txt @@ -1124,9 +1124,9 @@ Where is one of the following: "If you use a large I/O buffer to access the file system, then the MMCSD driver will perform multiple block SD transfers. With DMA ON, this seems to result in CRC errors detected by the hardware - during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y" + during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_LIMIT=1" - For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig + For this reason, CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 appears in the defconfig file. 7. Another DMA-related concern. I see this statement in the reference diff --git a/boards/arm/stm32/stm3240g-eval/configs/nsh2/defconfig b/boards/arm/stm32/stm3240g-eval/configs/nsh2/defconfig index e476abccfa..c1e9278e4f 100644 --- a/boards/arm/stm32/stm3240g-eval/configs/nsh2/defconfig +++ b/boards/arm/stm32/stm3240g-eval/configs/nsh2/defconfig @@ -35,7 +35,7 @@ CONFIG_I2C_POLLED=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MTD=y CONFIG_NET=y diff --git a/boards/arm/stm32/stm32f4discovery/configs/ipv6/defconfig b/boards/arm/stm32/stm32f4discovery/configs/ipv6/defconfig index 85d2ba89c4..b9e99f8f35 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/ipv6/defconfig +++ b/boards/arm/stm32/stm32f4discovery/configs/ipv6/defconfig @@ -34,7 +34,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_HOSTNAME="STM32F4-Discovery" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NET=y CONFIG_NETINIT_IPv6NETMASK_8=0xff80 diff --git a/boards/arm/stm32/stm32f4discovery/configs/netnsh/defconfig b/boards/arm/stm32/stm32f4discovery/configs/netnsh/defconfig index ae41695871..a3e6b97ea2 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/netnsh/defconfig +++ b/boards/arm/stm32/stm32f4discovery/configs/netnsh/defconfig @@ -34,7 +34,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_HOSTNAME="STM32F4-Discovery" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_NET=y CONFIG_NETDB_DNSCLIENT=y diff --git a/boards/arm/stm32f7/stm32f746-ws/configs/nsh/defconfig b/boards/arm/stm32f7/stm32f746-ws/configs/nsh/defconfig index 37a93732fd..c4373c0e3f 100644 --- a/boards/arm/stm32f7/stm32f746-ws/configs/nsh/defconfig +++ b/boards/arm/stm32f7/stm32f746-ws/configs/nsh/defconfig @@ -51,7 +51,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INIT_STACKSIZE=2500 CONFIG_LIBC_STRERROR=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MMCSD_SDIO=y CONFIG_MM_REGIONS=3 CONFIG_NSH_ARCHINIT=y diff --git a/boards/arm/xmc4/xmc4500-relax/configs/nsh/defconfig b/boards/arm/xmc4/xmc4500-relax/configs/nsh/defconfig index 1b015fe0f6..f267db877c 100644 --- a/boards/arm/xmc4/xmc4500-relax/configs/nsh/defconfig +++ b/boards/arm/xmc4/xmc4500-relax/configs/nsh/defconfig @@ -34,7 +34,7 @@ CONFIG_I2CTOOL_MAXBUS=0 CONFIG_I2C_RESET=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MTD=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/sim/sim/sim/configs/pf_ieee802154/defconfig b/boards/sim/sim/sim/configs/pf_ieee802154/defconfig index 8306040691..06832d2713 100644 --- a/boards/sim/sim/sim/configs/pf_ieee802154/defconfig +++ b/boards/sim/sim/sim/configs/pf_ieee802154/defconfig @@ -37,7 +37,7 @@ CONFIG_IOB_BUFSIZE=128 CONFIG_IOB_NBUFFERS=48 CONFIG_LIBC_HOSTNAME="SAMV71-XULT" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MTD=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/sim/sim/sim/configs/pktradio/defconfig b/boards/sim/sim/sim/configs/pktradio/defconfig index 18e56a7b45..543b3fdb55 100644 --- a/boards/sim/sim/sim/configs/pktradio/defconfig +++ b/boards/sim/sim/sim/configs/pktradio/defconfig @@ -52,7 +52,7 @@ CONFIG_IOB_BUFSIZE=128 CONFIG_IOB_NBUFFERS=48 CONFIG_LIBC_HOSTNAME="SAMV71-XULT" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MTD=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/sim/sim/sim/configs/sixlowpan/defconfig b/boards/sim/sim/sim/configs/sixlowpan/defconfig index 3938740013..e2bb5f6064 100644 --- a/boards/sim/sim/sim/configs/sixlowpan/defconfig +++ b/boards/sim/sim/sim/configs/sixlowpan/defconfig @@ -53,7 +53,7 @@ CONFIG_IOB_BUFSIZE=128 CONFIG_IOB_NBUFFERS=48 CONFIG_LIBC_HOSTNAME="SAMV71-XULT" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_MTD=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y diff --git a/boards/z80/ez80/makerlisp/configs/nsh_flash/defconfig b/boards/z80/ez80/makerlisp/configs/nsh_flash/defconfig index f024c094b2..91354264a3 100644 --- a/boards/z80/ez80/makerlisp/configs/nsh_flash/defconfig +++ b/boards/z80/ez80/makerlisp/configs/nsh_flash/defconfig @@ -29,7 +29,7 @@ CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_NSH_ARCHINIT=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 diff --git a/boards/z80/ez80/makerlisp/configs/nsh_ram/defconfig b/boards/z80/ez80/makerlisp/configs/nsh_ram/defconfig index db6b5c80bc..b20b984bb8 100644 --- a/boards/z80/ez80/makerlisp/configs/nsh_ram/defconfig +++ b/boards/z80/ez80/makerlisp/configs/nsh_ram/defconfig @@ -30,7 +30,7 @@ CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_NSH_ARCHINIT=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 diff --git a/boards/z80/ez80/makerlisp/configs/sdboot/defconfig b/boards/z80/ez80/makerlisp/configs/sdboot/defconfig index e876bb54bf..dbaf06e6cc 100644 --- a/boards/z80/ez80/makerlisp/configs/sdboot/defconfig +++ b/boards/z80/ez80/makerlisp/configs/sdboot/defconfig @@ -29,7 +29,7 @@ CONFIG_INIT_ENTRYPOINT="sd_main" CONFIG_LIBC_HEX2BIN=y CONFIG_MAKERLISP_SDBOOT=y CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 CONFIG_PREALLOC_TIMERS=4 CONFIG_PTHREAD_STACK_DEFAULT=1024 diff --git a/boards/z80/ez80/z20x/configs/nsh/defconfig b/boards/z80/ez80/z20x/configs/nsh/defconfig index c76f8f3b00..0bac460fa4 100644 --- a/boards/z80/ez80/z20x/configs/nsh/defconfig +++ b/boards/z80/ez80/z20x/configs/nsh/defconfig @@ -30,7 +30,7 @@ CONFIG_FS_PROCFS=y CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_NSH_ARCHINIT=y CONFIG_NSH_DISABLE_IFUPDOWN=y CONFIG_NSH_FILEIOSIZE=512 diff --git a/boards/z80/ez80/z20x/configs/sdboot/defconfig b/boards/z80/ez80/z20x/configs/sdboot/defconfig index 5a3a4e28db..e66b27c46d 100644 --- a/boards/z80/ez80/z20x/configs/sdboot/defconfig +++ b/boards/z80/ez80/z20x/configs/sdboot/defconfig @@ -27,7 +27,7 @@ CONFIG_FS_FAT=y CONFIG_HOST_WINDOWS=y CONFIG_INIT_ENTRYPOINT="sd_main" CONFIG_MMCSD=y -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 CONFIG_PREALLOC_TIMERS=4 CONFIG_PTHREAD_STACK_DEFAULT=1024 diff --git a/drivers/mmcsd/Kconfig b/drivers/mmcsd/Kconfig index 529d1331ea..912b5d2e30 100644 --- a/drivers/mmcsd/Kconfig +++ b/drivers/mmcsd/Kconfig @@ -41,13 +41,15 @@ config MMCSD_READONLY Provide read-only access. Default is Read/Write -config MMCSD_MULTIBLOCK_DISABLE - bool "Disable MMC/SD multiblock transfer" - default n +config MMCSD_MULTIBLOCK_LIMIT + int "Max block count can read/write in single transfer" + default 0 ---help--- - Use only the single block transfer method. - This setting is used to work around buggy SDIO drivers that cannot handle - multiple block transfers. + The max block can be handled in single transfer. + Default to 0, means no limitation. Block count larger than this + limit will be splited to multiple multi-block transfer. Set it to 1 will + only use single-block transfer mode, and can be used to work around + buggy SDIO drivers that cannot handle multiple block transfers. config MMCSD_MMCSUPPORT bool "MMC cards support" diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 622463c812..4943c39c0c 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -87,6 +87,12 @@ #define IS_EMPTY(priv) (priv->type == MMCSD_CARDTYPE_UNKNOWN) +#if CONFIG_MMCSD_MULTIBLOCK_LIMIT == 0 +# define MMCSD_MULTIBLOCK_LIMIT SSIZE_MAX +#else +# define MMCSD_MULTIBLOCK_LIMIT CONFIG_MMCSD_MULTIBLOCK_LIMIT +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -175,20 +181,20 @@ static bool mmcsd_wrprotected(FAR struct mmcsd_state_s *priv); static int mmcsd_eventwait(FAR struct mmcsd_state_s *priv, sdio_eventset_t failevents); static int mmcsd_transferready(FAR struct mmcsd_state_s *priv); -#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE +#if MMCSD_MULTIBLOCK_LIMIT != 1 static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv); #endif static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv, uint32_t blocklen); static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv, FAR uint8_t *buffer, off_t startblock); -#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE +#if MMCSD_MULTIBLOCK_LIMIT != 1 static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv, FAR uint8_t *buffer, off_t startblock, size_t nblocks); #endif static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv, FAR const uint8_t *buffer, off_t startblock); -#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE +#if MMCSD_MULTIBLOCK_LIMIT != 1 static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv, FAR const uint8_t *buffer, off_t startblock, size_t nblocks); @@ -1287,7 +1293,7 @@ errorout: * ****************************************************************************/ -#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE +#if MMCSD_MULTIBLOCK_LIMIT != 1 static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv) { int ret; @@ -1482,7 +1488,7 @@ static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv, * ****************************************************************************/ -#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE +#if MMCSD_MULTIBLOCK_LIMIT != 1 static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv, FAR uint8_t *buffer, off_t startblock, size_t nblocks) @@ -1793,7 +1799,7 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv, * ****************************************************************************/ -#if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) +#if MMCSD_MULTIBLOCK_LIMIT != 1 static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv, FAR const uint8_t *buffer, off_t startblock, size_t nblocks) @@ -2084,10 +2090,9 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, blkcnt_t startsector, unsigned int nsectors) { FAR struct mmcsd_state_s *priv; -#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) size_t sector; size_t endsector; -#endif + ssize_t nread; ssize_t ret = nsectors; DEBUGASSERT(inode && inode->i_private); @@ -2100,19 +2105,36 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, ret = mmcsd_takesem(priv); if (ret < 0) { - return (ssize_t)ret; + return ret; } -#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) - /* Read each block using only the single block transfer method */ - ret = nsectors; - endsector = startsector + nsectors - 1; - for (sector = startsector; sector <= endsector; sector++) + endsector = startsector + nsectors; + for (sector = startsector; sector < endsector; sector += nread) { /* Read this sector into the user buffer */ - ssize_t nread = mmcsd_readsingle(priv, buffer, sector); +#if MMCSD_MULTIBLOCK_LIMIT == 1 + /* Read each block using only the single block transfer method */ + + nread = mmcsd_readsingle(priv, buffer, sector); +#else + nread = endsector - sector; + if (nread > MMCSD_MULTIBLOCK_LIMIT) + { + nread = MMCSD_MULTIBLOCK_LIMIT; + } + + if (nread == 1) + { + nread = mmcsd_readsingle(priv, buffer, sector); + } + else + { + nread = mmcsd_readmultiple(priv, buffer, sector, nread); + } + +#endif if (nread < 0) { ret = nread; @@ -2121,22 +2143,9 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, /* Increment the buffer pointer by the sector size */ - buffer += priv->blocksize; + buffer += nread * priv->blocksize; } -#else - /* Use either the single- or multiple-block transfer method */ - - if (nsectors == 1) - { - ret = mmcsd_readsingle(priv, buffer, startsector); - } - else - { - ret = mmcsd_readmultiple(priv, buffer, startsector, nsectors); - } - -#endif mmcsd_givesem(priv); } @@ -2159,60 +2168,62 @@ static ssize_t mmcsd_write(FAR struct inode *inode, blkcnt_t startsector, unsigned int nsectors) { FAR struct mmcsd_state_s *priv; -#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) size_t sector; size_t endsector; -#endif + ssize_t nwrite; ssize_t ret = nsectors; DEBUGASSERT(inode && inode->i_private); priv = (FAR struct mmcsd_state_s *)inode->i_private; - - finfo("sector: %lu nsectors: %u sectorsize: %u\n", - (unsigned long)startsector, nsectors, priv->blocksize); + finfo("startsector: %" PRIuOFF " nsectors: %u sectorsize: %d\n", + startsector, nsectors, priv->blocksize); if (nsectors > 0) { ret = mmcsd_takesem(priv); if (ret < 0) { - return (ssize_t)ret; + return ret; } -#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) - /* Write each block using only the single block transfer method */ - ret = nsectors; - endsector = startsector + nsectors - 1; - for (sector = startsector; sector <= endsector; sector++) + endsector = startsector + nsectors; + for (sector = startsector; sector < endsector; sector += nwrite) { - /* Write this block from the user buffer */ + /* Write this sector into the user buffer */ - ssize_t nread = mmcsd_writesingle(priv, buffer, sector); - if (nread < 0) +#if MMCSD_MULTIBLOCK_LIMIT == 1 + /* Write each block using only the single block transfer method */ + + nwrite = mmcsd_writesingle(priv, buffer, sector); +#else + nwrite = endsector - sector; + if (nwrite > MMCSD_MULTIBLOCK_LIMIT) { - ret = nread; + nwrite = MMCSD_MULTIBLOCK_LIMIT; + } + + if (nwrite == 1) + { + nwrite = mmcsd_writesingle(priv, buffer, sector); + } + else + { + nwrite = mmcsd_writemultiple(priv, buffer, sector, nwrite); + } + +#endif + if (nwrite < 0) + { + ret = nwrite; break; } - /* Increment the buffer pointer by the block size */ + /* Increment the buffer pointer by the sector size */ - buffer += priv->blocksize; + buffer += nwrite * priv->blocksize; } -#else - /* Use either the single- or multiple-block transfer method */ - - if (nsectors == 1) - { - ret = mmcsd_writesingle(priv, buffer, startsector); - } - else - { - ret = mmcsd_writemultiple(priv, buffer, startsector, nsectors); - } - -#endif mmcsd_givesem(priv); }