devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: adrianhoyin.ng@altera.com
Cc: dinguyen@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, Eugeniy.Paltsev@synopsys.com,
	dmaengine@vger.kernel.org, devicetree@vger.kernel.org,
	Matthew Gerlach <matthew.gerlach@altrera.com>
Subject: Re: [PATCH v3 4/4] dma: dw-axi-dmac: Add support for dma-bit-mask property
Date: Fri, 20 Jun 2025 12:45:32 +0530	[thread overview]
Message-ID: <aFUKlJchclJSZgib@vaman> (raw)
In-Reply-To: <d28a649938adec18bb0a550b28ed86b4c711cfc1.1750084527.git.adrianhoyin.ng@altera.com>

On 16-06-25, 22:40, adrianhoyin.ng@altera.com wrote:
> From: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>

Please change subsystem tag to dmanegine: xxx

> 
> Intel Agilex5 address bus only supports up to 40 bits. Add dma-bit-mask
> property support where configure dma-bit-mask based on dma-bit-mask
> property or fallback to default value if property is not present.
> 
> Signed-off-by: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
> Reviewed-by: Matthew Gerlach <matthew.gerlach@altrera.com>
> 
> v3:
> -update to read from updated property name.
> 
> v2:
> -Fix build errors and warning
> ---
>  drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index b23536645ff7..e56ff7aadafd 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -265,13 +265,23 @@ static inline bool axi_chan_is_hw_enable(struct axi_dma_chan *chan)
>  static void axi_dma_hw_init(struct axi_dma_chip *chip)
>  {
>  	int ret;
> -	u32 i;
> +	u32 i, tmp;
>  
>  	for (i = 0; i < chip->dw->hdata->nr_channels; i++) {
>  		axi_chan_irq_disable(&chip->dw->chan[i], DWAXIDMAC_IRQ_ALL);
>  		axi_chan_disable(&chip->dw->chan[i]);
>  	}
> -	ret = dma_set_mask_and_coherent(chip->dev, DMA_BIT_MASK(64));
> +
> +	ret = device_property_read_u32(chip->dev, "snps,dma-addressable-bits", &tmp);
> +	if (ret)
> +		ret = dma_set_mask_and_coherent(chip->dev, DMA_BIT_MASK(64));
> +	else {
> +		if (tmp == 0 || tmp < 32 || tmp > 64)
> +			dev_err(chip->dev, "Invalid dma bit mask\n");
> +
> +		ret = dma_set_mask_and_coherent(chip->dev, DMA_BIT_MASK(tmp));

why not check the mask value and set that only once irrespective of
mask, it can tmp or 64!

-- 
~Vinod

      reply	other threads:[~2025-06-20  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 14:40 [PATCH v3 0/4] agilex5: Update agilex5 device tree and device tree bindings adrianhoyin.ng
2025-06-16 14:40 ` [PATCH v3 1/4] dt-bindings: dma: snps,dw-axi-dmac: Add iommus dma-coherent and dma-addressable-bits property adrianhoyin.ng
2025-06-17  6:25   ` Krzysztof Kozlowski
2025-06-26 12:19   ` Dinh Nguyen
2025-06-16 14:40 ` [PATCH v3 2/4] dt-bindings: mtd: cadence: Add iommus and dma-coherent properties adrianhoyin.ng
2025-06-17  7:19   ` Krzysztof Kozlowski
2025-06-16 14:40 ` [PATCH v3 3/4] arm64: dts: socfpga: agilex5: Update Agilex5 DTSI and DTS adrianhoyin.ng
2025-06-16 14:40 ` [PATCH v3 4/4] dma: dw-axi-dmac: Add support for dma-bit-mask property adrianhoyin.ng
2025-06-20  7:15   ` Vinod Koul [this message]

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=aFUKlJchclJSZgib@vaman \
    --to=vkoul@kernel.org \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=adrianhoyin.ng@altera.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=matthew.gerlach@altrera.com \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).