[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83b9d2855f9513b2431fe31c43a992eb952f9b05.camel@pengutronix.de>
Date: Thu, 24 Oct 2024 10:11:35 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Csókás, Bence <csokas.bence@...lan.hu>,
dmaengine@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-sunxi@...ts.linux.dev, linux-kernel@...r.kernel.org
Cc: Mesih Kilinc <mesihkilinc@...il.com>, Vinod Koul <vkoul@...nel.org>,
Chen-Yu Tsai
<wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>, Samuel Holland
<samuel@...lland.org>
Subject: Re: [PATCH 02/10] dma-engine: sun4i: Add has_reset option to quirk
On Do, 2024-10-24 at 08:49 +0200, Csókás, Bence wrote:
> From: Mesih Kilinc <mesihkilinc@...il.com>
>
> Allwinner suniv F1C100s has a reset bit for DMA in CCU. Sun4i do not
> has this bit but in order to support suniv we need to add it. So add
> support for reset bit.
>
> Signed-off-by: Mesih Kilinc <mesihkilinc@...il.com>
> ---
> drivers/dma/sun4i-dma.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
> index 5efbed7c546f..0b99b3884971 100644
> --- a/drivers/dma/sun4i-dma.c
> +++ b/drivers/dma/sun4i-dma.c
> @@ -15,6 +15,7 @@
> #include <linux/of_dma.h>
> #include <linux/of_device.h>
> #include <linux/platform_device.h>
> +#include <linux/reset.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
>
> @@ -159,6 +160,7 @@ struct sun4i_dma_config {
> u8 ddma_drq_sdram;
>
> u8 max_burst;
> + bool has_reset;
> };
>
> struct sun4i_dma_pchan {
> @@ -208,6 +210,7 @@ struct sun4i_dma_dev {
> int irq;
> spinlock_t lock;
> const struct sun4i_dma_config *cfg;
> + struct reset_control *rst;
> };
>
> static struct sun4i_dma_dev *to_sun4i_dma_dev(struct dma_device *dev)
> @@ -1215,6 +1218,15 @@ static int sun4i_dma_probe(struct platform_device *pdev)
> return PTR_ERR(priv->clk);
> }
>
> + if (priv->cfg->has_reset) {
> + priv->rst = devm_reset_control_get_exclusive(&pdev->dev,
> + NULL);
Aligning to open parenthesis will make checkpatch --strict happy.
> + if (IS_ERR(priv->rst)) {
> + dev_err(&pdev->dev, "Failed to get reset control\n");
Consider using dev_err_probe() here.
> + return PTR_ERR(priv->rst);
> + }
> + }
> +
> platform_set_drvdata(pdev, priv);
> spin_lock_init(&priv->lock);
>
> @@ -1287,6 +1299,16 @@ static int sun4i_dma_probe(struct platform_device *pdev)
> return ret;
> }
>
> + /* Deassert the reset control */
> + if (priv->rst) {
> + ret = reset_control_deassert(priv->rst);
> + if (ret) {
> + dev_err(&pdev->dev,
> + "Failed to deassert the reset control\n");
> + goto err_clk_disable;
> + }
> + }
You can just call reset_control_deassert() unconditionally, it accepts
a NULL parameter:
https://docs.kernel.org/driver-api/reset.html#c.reset_control_deassert
regards
Philipp
Powered by blists - more mailing lists