git: 990a1dbf6fe1 - main - dwmmc: Fix MMCCAM block size support

Emmanuel Vadot manu at FreeBSD.org
Thu Jul 22 15:03:31 UTC 2021


The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=990a1dbf6fe1a9f4dc491d3e4e276034919b94f3

commit 990a1dbf6fe1a9f4dc491d3e4e276034919b94f3
Author:     Emmanuel Vadot <manu at FreeBSD.org>
AuthorDate: 2021-07-14 15:25:05 +0000
Commit:     Emmanuel Vadot <manu at FreeBSD.org>
CommitDate: 2021-07-22 15:03:14 +0000

    dwmmc: Fix MMCCAM block size support
    
    When using SDIO the block size if per function and most of the time
    not equal to MMC_SECTOR_SIZE, fix sdio on dwmmc by setting the correct
    block size in the mmc registers.
    
    MFC after:    1 month
    Sponsored by:   Diablotin Systems
---
 sys/dev/mmc/host/dwmmc.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c
index b0e13719928a..dce684ed8c7b 100644
--- a/sys/dev/mmc/host/dwmmc.c
+++ b/sys/dev/mmc/host/dwmmc.c
@@ -1153,10 +1153,18 @@ dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_command *cmd)
 			cmdr |= SDMMC_CMD_DATA_WRITE;
 
 		WRITE4(sc, SDMMC_TMOUT, 0xffffffff);
-		WRITE4(sc, SDMMC_BYTCNT, data->len);
-		blksz = (data->len < MMC_SECTOR_SIZE) ? \
-			 data->len : MMC_SECTOR_SIZE;
-		WRITE4(sc, SDMMC_BLKSIZ, blksz);
+#ifdef MMCCAM
+		if (cmd->data->flags & MMC_DATA_BLOCK_SIZE) {
+			WRITE4(sc, SDMMC_BLKSIZ, cmd->data->block_size);
+			WRITE4(sc, SDMMC_BYTCNT, cmd->data->len);
+		} else
+#endif
+		{
+			WRITE4(sc, SDMMC_BYTCNT, data->len);
+			blksz = (data->len < MMC_SECTOR_SIZE) ? \
+				data->len : MMC_SECTOR_SIZE;
+			WRITE4(sc, SDMMC_BLKSIZ, blksz);
+		}
 
 		if (sc->use_pio) {
 			pio_prepare(sc, cmd);


More information about the dev-commits-src-all mailing list