public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: <Tudor.Ambarus@microchip.com>
To: <Claudiu.Beznea@microchip.com>, <Ludovic.Desroches@microchip.com>,
	<vkoul@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] dmaengine: at_xdmac: call at_xdmac_axi_config() on resume path
Date: Fri, 15 Oct 2021 07:49:16 +0000	[thread overview]
Message-ID: <2d6e2df6-93e0-311b-6a78-91b6a88bec18@microchip.com> (raw)
In-Reply-To: <20211007111230.2331837-2-claudiu.beznea@microchip.com>

On 10/7/21 2:12 PM, Claudiu Beznea wrote:
> at_xdmac could be used on SoCs which supports backup mode (where most
> of the SoC power, including power to DMA controller, is closed at suspend
> time). Thus, on resume, the settings which were previously done need to be
> restored. Do the same for axi configuration.
> 
> Fixes: f40566f220a1 ("dmaengine: at_xdmac: add AXI priority support and recommended settings")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>

> ---
>  drivers/dma/at_xdmac.c | 51 ++++++++++++++++++++++--------------------
>  1 file changed, 27 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index ab78e0f6afd7..c66ad5706cb5 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1926,6 +1926,30 @@ static void at_xdmac_free_chan_resources(struct dma_chan *chan)
>  	return;
>  }
>  
> +static void at_xdmac_axi_config(struct platform_device *pdev)
> +{
> +	struct at_xdmac	*atxdmac = (struct at_xdmac *)platform_get_drvdata(pdev);
> +	bool dev_m2m = false;
> +	u32 dma_requests;
> +
> +	if (!atxdmac->layout->axi_config)
> +		return; /* Not supported */
> +
> +	if (!of_property_read_u32(pdev->dev.of_node, "dma-requests",
> +				  &dma_requests)) {
> +		dev_info(&pdev->dev, "controller in mem2mem mode.\n");
> +		dev_m2m = true;
> +	}
> +
> +	if (dev_m2m) {
> +		at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_M2M);
> +		at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_M2M);
> +	} else {
> +		at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_P2M);
> +		at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_P2M);
> +	}
> +}
> +
>  #ifdef CONFIG_PM
>  static int atmel_xdmac_prepare(struct device *dev)
>  {
> @@ -1975,6 +1999,7 @@ static int atmel_xdmac_resume(struct device *dev)
>  	struct at_xdmac		*atxdmac = dev_get_drvdata(dev);
>  	struct at_xdmac_chan	*atchan;
>  	struct dma_chan		*chan, *_chan;
> +	struct platform_device	*pdev = container_of(dev, struct platform_device, dev);
>  	int			i;
>  	int ret;
>  
> @@ -1982,6 +2007,8 @@ static int atmel_xdmac_resume(struct device *dev)
>  	if (ret)
>  		return ret;
>  
> +	at_xdmac_axi_config(pdev);
> +
>  	/* Clear pending interrupts. */
>  	for (i = 0; i < atxdmac->dma.chancnt; i++) {
>  		atchan = &atxdmac->chan[i];
> @@ -2007,30 +2034,6 @@ static int atmel_xdmac_resume(struct device *dev)
>  }
>  #endif /* CONFIG_PM_SLEEP */
>  
> -static void at_xdmac_axi_config(struct platform_device *pdev)
> -{
> -	struct at_xdmac	*atxdmac = (struct at_xdmac *)platform_get_drvdata(pdev);
> -	bool dev_m2m = false;
> -	u32 dma_requests;
> -
> -	if (!atxdmac->layout->axi_config)
> -		return; /* Not supported */
> -
> -	if (!of_property_read_u32(pdev->dev.of_node, "dma-requests",
> -				  &dma_requests)) {
> -		dev_info(&pdev->dev, "controller in mem2mem mode.\n");
> -		dev_m2m = true;
> -	}
> -
> -	if (dev_m2m) {
> -		at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_M2M);
> -		at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_M2M);
> -	} else {
> -		at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_P2M);
> -		at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_P2M);
> -	}
> -}
> -
>  static int at_xdmac_probe(struct platform_device *pdev)
>  {
>  	struct at_xdmac	*atxdmac;
> 


  reply	other threads:[~2021-10-15  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 11:12 [PATCH 0/4] dmaengine: at_xdmac: fixes and code enhancements Claudiu Beznea
2021-10-07 11:12 ` [PATCH 1/4] dmaengine: at_xdmac: call at_xdmac_axi_config() on resume path Claudiu Beznea
2021-10-15  7:49   ` Tudor.Ambarus [this message]
2021-10-07 11:12 ` [PATCH 2/4] dmaengine: at_xdmac: fix AT_XDMAC_CC_PERID() macro Claudiu Beznea
2021-10-15  7:50   ` Tudor.Ambarus
2021-10-07 11:12 ` [PATCH 3/4] dmaengine: at_xdmac: use __maybe_unused for pm functions Claudiu Beznea
2021-10-15  8:01   ` Tudor.Ambarus
2021-10-07 11:12 ` [PATCH 4/4] dmaengine: at_xdmac: use pm_ptr() Claudiu Beznea
2021-10-15  8:03   ` Tudor.Ambarus
2021-10-18  6:12 ` [PATCH 0/4] dmaengine: at_xdmac: fixes and code enhancements Vinod Koul

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=2d6e2df6-93e0-311b-6a78-91b6a88bec18@microchip.com \
    --to=tudor.ambarus@microchip.com \
    --cc=Claudiu.Beznea@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@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