All of lore.kernel.org
 help / color / mirror / Atom feed
From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-renesas-soc@vger.kernel.org
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Vinod Koul <vkoul@kernel.org>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	dmaengine@vger.kernel.org
Subject: Re: [PATCH 1/3] dmaengine: sh: rz-dmac: handle configs where one address is zero
Date: Tue, 1 Oct 2024 09:29:58 +0300	[thread overview]
Message-ID: <f7b6ead3-a8f3-4d07-a56b-27a23701c7c3@tuxon.dev> (raw)
In-Reply-To: <20240930145955.4248-2-wsa+renesas@sang-engineering.com>



On 30.09.2024 17:59, Wolfram Sang wrote:
> Configs like the ones coming from the MMC subsystem will have either
> 'src' or 'dst' zeroed, resulting in an unknown bus width. This will bail
> out on the RZ DMA driver because of the sanity check for a valid bus
> width. Reorder the code, so that the check will only be applied when the
> corresponding address is non-zero.
> 
> Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

> ---
>  drivers/dma/sh/rz-dmac.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index 65a27c5a7bce..811389fc9cb8 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -601,22 +601,25 @@ static int rz_dmac_config(struct dma_chan *chan,
>  	struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
>  	u32 val;
>  
> -	channel->src_per_address = config->src_addr;
>  	channel->dst_per_address = config->dst_addr;
> -
> -	val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
> -	if (val == CHCFG_DS_INVALID)
> -		return -EINVAL;
> -
>  	channel->chcfg &= ~CHCFG_FILL_DDS_MASK;
> -	channel->chcfg |= FIELD_PREP(CHCFG_FILL_DDS_MASK, val);
> +	if (channel->dst_per_address) {
> +		val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
> +		if (val == CHCFG_DS_INVALID)
> +			return -EINVAL;
>  
> -	val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
> -	if (val == CHCFG_DS_INVALID)
> -		return -EINVAL;
> +		channel->chcfg |= FIELD_PREP(CHCFG_FILL_DDS_MASK, val);
> +	}
>  
> +	channel->src_per_address = config->src_addr;
>  	channel->chcfg &= ~CHCFG_FILL_SDS_MASK;
> -	channel->chcfg |= FIELD_PREP(CHCFG_FILL_SDS_MASK, val);
> +	if (channel->src_per_address) {
> +		val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
> +		if (val == CHCFG_DS_INVALID)
> +			return -EINVAL;
> +
> +		channel->chcfg |= FIELD_PREP(CHCFG_FILL_SDS_MASK, val);
> +	}
>  
>  	return 0;
>  }

  parent reply	other threads:[~2024-10-01  6:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 14:59 [PATCH 0/3] dmaengine: sh: rz-dmac: add r7s72100 support Wolfram Sang
2024-09-30 14:59 ` [PATCH 1/3] dmaengine: sh: rz-dmac: handle configs where one address is zero Wolfram Sang
2024-09-30 16:40   ` Biju Das
2024-09-30 19:25     ` Wolfram Sang
2024-10-01  8:56       ` Biju Das
2024-10-01  6:29   ` claudiu beznea [this message]
2024-09-30 14:59 ` [PATCH 2/3] dt-bindings: dma: rz-dmac: Document RZ/A1L SoC Wolfram Sang
2024-09-30 15:18   ` Geert Uytterhoeven
2024-09-30 19:26     ` Wolfram Sang
2024-10-01  7:44       ` Biju Das
2024-09-30 14:59 ` [PATCH 3/3] dmaengine: sh: rz-dmac: add r7s72100 support Wolfram Sang
2024-09-30 15:12   ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7b6ead3-a8f3-4d07-a56b-27a23701c7c3@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.