Re: [PATCH RFC 1/4] mmc: host: renesas_sdhi_sys_dmac: Use dma_buswidth instead of hardcoded value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On November 22, 2019 at 7:13 AM Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote:
> 
> 
> This patch uses dma_buswidth instread of hardcoded value of
> TMIO_MMC_MIN_DMA_LEN (8) for increasing the buswidth in the future.
> Note that, since the dma_buswidth is 4 and the align is 2,
> when the sg_tmp->length is 6, it cannot transfer correcly.
> So, this patch changes the conditions.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
> ---
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> index 13ff023..30f34a3 100644
> --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> @@ -23,8 +23,6 @@
>  #include "renesas_sdhi.h"
>  #include "tmio_mmc.h"
>  
> -#define TMIO_MMC_MIN_DMA_LEN 8
> -
>  static const struct renesas_sdhi_of_data of_default_cfg = {
>  	.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
>  };
> @@ -159,11 +157,12 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
>  	int ret, i;
>  	bool aligned = true, multiple = true;
>  	unsigned int align = (1 << host->pdata->alignment_shift) - 1;
> +	unsigned int min_len = priv->dma_priv.dma_buswidth ? : align + 1;
>  
>  	for_each_sg(sg, sg_tmp, host->sg_len, i) {
>  		if (sg_tmp->offset & align)
>  			aligned = false;
> -		if (sg_tmp->length & align) {
> +		if (sg_tmp->length % min_len) {
>  			multiple = false;
>  			break;
>  		}
> @@ -175,7 +174,7 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
>  		goto pio;
>  	}
>  
> -	if (sg->length < TMIO_MMC_MIN_DMA_LEN)
> +	if (sg->length < min_len)
>  		return;
>  
>  	/* The only sg element can be unaligned, use our bounce buffer then */
> @@ -231,11 +230,12 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
>  	int ret, i;
>  	bool aligned = true, multiple = true;
>  	unsigned int align = (1 << host->pdata->alignment_shift) - 1;
> +	unsigned int min_len = priv->dma_priv.dma_buswidth ? : align + 1;
>  
>  	for_each_sg(sg, sg_tmp, host->sg_len, i) {
>  		if (sg_tmp->offset & align)
>  			aligned = false;
> -		if (sg_tmp->length & align) {
> +		if (sg_tmp->length % min_len) {
>  			multiple = false;
>  			break;
>  		}
> @@ -247,7 +247,7 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
>  		goto pio;
>  	}
>  
> -	if (sg->length < TMIO_MMC_MIN_DMA_LEN)
> +	if (sg->length < min_len)
>  		return;
>  
>  	/* The only sg element can be unaligned, use our bounce buffer then */
> -- 
> 2.7.4

Reviewed-by: Ulrich Hecht <uli+renesas@xxxxxxxx>

CU
Uli



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux