From: Andre Przywara <andre.przywara@arm.com>
To: "Csókás, Bence" <csokas.bence@prolan.hu>
Cc: <dmaengine@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-sunxi@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
Mesih Kilinc <mesihkilinc@gmail.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Vinod Koul <vkoul@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Subject: Re: [PATCH v5 2/5] dma-engine: sun4i: Add has_reset option to quirk
Date: Sat, 2 Nov 2024 17:45:16 +0000 [thread overview]
Message-ID: <20241102174516.02d124d6@minigeek.lan> (raw)
In-Reply-To: <20241102093140.2625230-3-csokas.bence@prolan.hu>
On Sat, 2 Nov 2024 10:31:41 +0100
"Csókás, Bence" <csokas.bence@prolan.hu> wrote:
Hi,
> From: Mesih Kilinc <mesihkilinc@gmail.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@gmail.com>
> [ csokas.bence: Rebased and addressed comments ]
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>
> Notes:
> Changes in v2:
> * Call reset_control_deassert() unconditionally, as it supports optional resets
> * Use dev_err_probe()
> * Whitespace
> Changes in v3:
> * More dev_err_probe() fixes
> Changes in v4:
> * Use return value of dev_err_probe()
> Changes in v5:
> * More whitespace
>
> drivers/dma/sun4i-dma.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c
> index b2c1e4b9f696..9d1e3c51342d 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,13 @@ 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);
Can't we use devm_reset_control_get_optional_exclusive(), and then save
this whole has_reset bit?
> + if (IS_ERR(priv->rst))
> + return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst),
> + "Failed to get reset control\n");
> + }
> +
> platform_set_drvdata(pdev, priv);
> spin_lock_init(&priv->lock);
>
> @@ -1287,6 +1297,14 @@ static int sun4i_dma_probe(struct platform_device *pdev)
> return ret;
> }
>
> + /* Deassert the reset control */
> + ret = reset_control_deassert(priv->rst);
> + if (ret) {
> + dev_err_probe(&pdev->dev, ret,
> + "Failed to deassert the reset control\n");
> + goto err_clk_disable;
> + }
> +
> /*
> * Make sure the IRQs are all disabled and accounted for. The bootloader
> * likes to leave these dirty
> @@ -1355,6 +1373,7 @@ static struct sun4i_dma_config sun4i_a10_dma_cfg = {
> .ddma_drq_sdram = SUN4I_DDMA_DRQ_TYPE_SDRAM,
>
> .max_burst = SUN4I_MAX_BURST,
> + .has_reset = false,
> };
>
> static const struct of_device_id sun4i_dma_match[] = {
next prev parent reply other threads:[~2024-11-02 17:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241102093140.2625230-1-csokas.bence@prolan.hu>
2024-11-02 9:31 ` [PATCH v5 1/5] dma-engine: sun4i: Add a quirk to support different chips Csókás, Bence
2024-11-02 9:31 ` [PATCH v5 2/5] dma-engine: sun4i: Add has_reset option to quirk Csókás, Bence
2024-11-02 17:45 ` Andre Przywara [this message]
2024-11-04 7:41 ` Csókás Bence
2024-11-02 9:31 ` [PATCH v5 3/5] dt-bindings: dmaengine: Add Allwinner suniv F1C100s DMA Csókás, Bence
2024-11-02 9:31 ` [PATCH v5 4/5] dma-engine: sun4i: Add support for Allwinner suniv F1C100s Csókás, Bence
2024-11-02 9:31 ` [PATCH v5 5/5] ARM: dts: suniv: f1c100s: Add support for DMA Csókás, Bence
2024-11-15 13:10 ` [PATCH v5 0/5] Add support for DMA of F1C100s Csókás Bence
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=20241102174516.02d124d6@minigeek.lan \
--to=andre.przywara@arm.com \
--cc=csokas.bence@prolan.hu \
--cc=dmaengine@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mesihkilinc@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=samuel@sholland.org \
--cc=vkoul@kernel.org \
--cc=wens@csie.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