[PATCH v2] mci: sdhci: fix big-endian write for blockcount/size

Sascha Hauer sha at pengutronix.de
Mon Oct 4 04:05:16 PDT 2021


On Tue, Aug 31, 2021 at 08:47:15AM +0200, Steffen Trumtrar wrote:
> From: Steffen Trumtrar <str at pengutronix.de>
> 
> The patch
> 
>     0a47bce1b03fd236384e904dca005c0870ce8684
>     mci: imx-esdhc: Use common DMA helpers
> 
> converted the imx-esdhc driver to use the DMA helpers introduced with
> 
>     60b608b2714472aa22862a20d04f267cbbac0863
>     mci: sdhci: Add DMA transfer helpers
> 
> The common DMA helpers however break support for BE-variants (e.g.
> Layerscape) as the BLKATTR register seems to be a 32-bit register which
> internally switches bytes when used with two 16-bit write accesses.
> As the alignment should also work for LE-SDHCI-variants convert the two
> 16-bit accesses to one 32-bit access.
> 
> Signed-off-by: Steffen Trumtrar <str at pengutronix.de>
> ---
>  drivers/mci/sdhci.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
> index aca4a5a6f911..8b5520d6827a 100644
> --- a/drivers/mci/sdhci.c
> +++ b/drivers/mci/sdhci.c
> @@ -129,9 +129,8 @@ void sdhci_setup_data_pio(struct sdhci *sdhci, struct mci_data *data)
>  	if (!data)
>  		return;
>  
> -	sdhci_write16(sdhci, SDHCI_BLOCK_SIZE, sdhci->sdma_boundary |
> -		    SDHCI_TRANSFER_BLOCK_SIZE(data->blocksize));
> -	sdhci_write16(sdhci, SDHCI_BLOCK_COUNT, data->blocks);
> +	sdhci_write32(sdhci, SDHCI_BLOCK_SIZE, sdhci->sdma_boundary |
> +		      SDHCI_TRANSFER_BLOCK_SIZE(data->blocksize) | data->blocks << 16);
>  }
>  
>  void sdhci_setup_data_dma(struct sdhci *sdhci, struct mci_data *data,
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list