From: Vinod Koul <vkoul@kernel.org>
To: Dinh Nguyen <dinguyen@kernel.org>
Cc: dmaengine@vger.kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] dmagengine: pl330: add code to get reset property
Date: Tue, 4 Jun 2019 17:44:24 +0530 [thread overview]
Message-ID: <20190604121424.GW15118@vkoul-mobl> (raw)
In-Reply-To: <20190524002847.30961-2-dinguyen@kernel.org>
On 23-05-19, 19:28, Dinh Nguyen wrote:
> The DMA controller on some SoCs can be held in reset, and thus requires
> the reset signal(s) to deasserted. Most SoCs will have just one reset
> signal, but there are others, i.e. Arria10/Stratix10 will have an
> additional reset signal, referred to as the OCP.
>
> Add code to get the reset property from the device tree for deassert and
> assert.
>
> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
> ---
> drivers/dma/pl330.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 6e6837214210..6018c43e785d 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -29,6 +29,7 @@
> #include <linux/err.h>
> #include <linux/pm_runtime.h>
> #include <linux/bug.h>
> +#include <linux/reset.h>
>
> #include "dmaengine.h"
> #define PL330_MAX_CHAN 8
> @@ -500,6 +501,9 @@ struct pl330_dmac {
> unsigned int num_peripherals;
> struct dma_pl330_chan *peripherals; /* keep at end */
> int quirks;
> +
> + struct reset_control *rstc;
> + struct reset_control *rstc_ocp;
> };
>
> static struct pl330_of_quirks {
> @@ -3028,6 +3032,30 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>
> amba_set_drvdata(adev, pl330);
>
> + pl330->rstc = devm_reset_control_get_optional(&adev->dev, "dma");
> + if (IS_ERR(pl330->rstc)) {
> + dev_err(&adev->dev, "No reset controller specified.\n");
Wasnt this optional??
> + return PTR_ERR(pl330->rstc);
> + } else {
> + ret = reset_control_deassert(pl330->rstc);
> + if (ret) {
> + dev_err(&adev->dev, "Couldn't deassert the device from reset!\n");
> + return ret;
> + }
> + }
> +
> + pl330->rstc_ocp = devm_reset_control_get_optional(&adev->dev, "dma-ocp");
> + if (IS_ERR(pl330->rstc_ocp)) {
> + dev_err(&adev->dev, "No reset controller specified.\n");
> + return PTR_ERR(pl330->rstc_ocp);
> + } else {
> + ret = reset_control_deassert(pl330->rstc_ocp);
> + if (ret) {
> + dev_err(&adev->dev, "Couldn't deassert the device from OCP reset!\n");
> + return ret;
> + }
> + }
> +
> for (i = 0; i < AMBA_NR_IRQS; i++) {
> irq = adev->irq[i];
> if (irq) {
> @@ -3168,6 +3196,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> probe_err2:
> pl330_del(pl330);
>
> + if (pl330->rstc_ocp)
> + reset_control_assert(pl330->rstc_ocp);
> +
> + if (pl330->rstc)
> + reset_control_assert(pl330->rstc);
> return ret;
> }
>
> @@ -3206,6 +3239,11 @@ static int pl330_remove(struct amba_device *adev)
>
> pl330_del(pl330);
>
> + if (pl330->rstc_ocp)
> + reset_control_assert(pl330->rstc_ocp);
> +
> + if (pl330->rstc)
> + reset_control_assert(pl330->rstc);
> return 0;
> }
>
> --
> 2.20.0
--
~Vinod
next prev parent reply other threads:[~2019-06-04 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 0:28 [PATCH 1/2] dt-bindings: pl330: document the optional resets property Dinh Nguyen
2019-05-24 0:28 ` [PATCH 2/2] dmagengine: pl330: add code to get reset property Dinh Nguyen
2019-06-04 12:14 ` Vinod Koul [this message]
2019-06-04 14:21 ` Dinh Nguyen
2019-06-04 16:31 ` Geert Uytterhoeven
2019-06-05 14:41 ` Dinh Nguyen
2019-06-05 15:31 ` Dinh Nguyen
2019-06-07 7:37 ` Geert Uytterhoeven
2019-06-10 23:40 ` Dinh Nguyen
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=20190604121424.GW15118@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@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).