[PATCH v2 1/2] mmc: sdhci: Add new quirks for SUPPORT_SINGLE

Jaehoon Chung jh80.chung at samsung.com
Tue Oct 25 02:00:45 CEST 2022


On 9/9/22 16:23, Kunihiko Hayashi wrote:
> This patch defines a quirk to disable the block count
> for single block transactions.
> 
> This is similar to Linux kernel commit d3fc5d71ac4d
> ("mmc: sdhci: add a quirk for single block transactions").
> 
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko at socionext.com>
> Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung


> ---
>  drivers/mmc/sdhci.c | 8 +++++---
>  include/sdhci.h     | 1 +
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index bf989a594f7e..a80ad8329a38 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -211,7 +211,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
>  	unsigned int stat = 0;
>  	int ret = 0;
>  	int trans_bytes = 0, is_aligned = 1;
> -	u32 mask, flags, mode;
> +	u32 mask, flags, mode = 0;
>  	unsigned int time = 0;
>  	int mmc_dev = mmc_get_blk_desc(mmc)->devnum;
>  	ulong start = get_timer(0);
> @@ -273,10 +273,12 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
>  	/* Set Transfer mode regarding to data flag */
>  	if (data) {
>  		sdhci_writeb(host, 0xe, SDHCI_TIMEOUT_CONTROL);
> -		mode = SDHCI_TRNS_BLK_CNT_EN;
> +
> +		if (!(host->quirks & SDHCI_QUIRK_SUPPORT_SINGLE))
> +			mode = SDHCI_TRNS_BLK_CNT_EN;
>  		trans_bytes = data->blocks * data->blocksize;
>  		if (data->blocks > 1)
> -			mode |= SDHCI_TRNS_MULTI;
> +			mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_BLK_CNT_EN;
>  
>  		if (data->flags == MMC_DATA_READ)
>  			mode |= SDHCI_TRNS_READ;
> diff --git a/include/sdhci.h b/include/sdhci.h
> index 88f1917480b6..24b4599b857d 100644
> --- a/include/sdhci.h
> +++ b/include/sdhci.h
> @@ -247,6 +247,7 @@
>  #define SDHCI_QUIRK_WAIT_SEND_CMD	(1 << 6)
>  #define SDHCI_QUIRK_USE_WIDE8		(1 << 8)
>  #define SDHCI_QUIRK_NO_1_8_V		(1 << 9)
> +#define SDHCI_QUIRK_SUPPORT_SINGLE	(1 << 10)
>  
>  /* to make gcc happy */
>  struct sdhci_host;



More information about the U-Boot mailing list