From: Philipp Zabel <p.zabel@pengutronix.de>
To: Yang Xiwen <forbidden405@outlook.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org,
linux-watchdog@vger.kernel.org, linux@roeck-us.net,
robh+dt@kernel.org, vireshk@kernel.org, wim@linux-watchdog.org
Subject: Re: [PATCH v2 1/2] watchdog: sp805_wdt: deassert the reset if available
Date: Wed, 21 Feb 2024 13:00:38 +0100 [thread overview]
Message-ID: <ddecea158d5ea0cd2d682f8f9577ee0c78a755d9.camel@pengutronix.de> (raw)
In-Reply-To: <SEZPR06MB6959D4BEC90745D94BF02BF596512@SEZPR06MB6959.apcprd06.prod.outlook.com>
On Di, 2024-02-20 at 03:00 +0800, Yang Xiwen wrote:
> On 2/20/2024 2:22 AM, Christophe JAILLET wrote:
> > Le 19/02/2024 à 19:14, Yang Xiwen via B4 Relay a écrit :
> > > From: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org>
> > >
> > > According to the datasheet, the core has an WDOGRESn input signal that
> > > needs to be deasserted before being operational. Implement it in the
> > > driver.
> > >
> > > Signed-off-by: Yang Xiwen
> > > <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org>
> > > ---
> > > drivers/watchdog/sp805_wdt.c | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> > > index 2756ed54ca3d..b4bcfdeb39e6 100644
> > > --- a/drivers/watchdog/sp805_wdt.c
> > > +++ b/drivers/watchdog/sp805_wdt.c
> > > @@ -25,6 +25,7 @@
> > > #include <linux/moduleparam.h>
> > > #include <linux/pm.h>
> > > #include <linux/property.h>
> > > +#include <linux/reset.h>
> > > #include <linux/slab.h>
> > > #include <linux/spinlock.h>
> > > #include <linux/types.h>
> > > @@ -59,6 +60,7 @@
> > > * @lock: spin lock protecting dev structure and io access
> > > * @base: base address of wdt
> > > * @clk: (optional) clock structure of wdt
> > > + * @rst: (optional) reset control signal of wdt
> > > * @rate: (optional) clock rate when provided via properties
> > > * @adev: amba device structure of wdt
> > > * @status: current status of wdt
> > > @@ -69,6 +71,7 @@ struct sp805_wdt {
> > > spinlock_t lock;
> > > void __iomem *base;
> > > struct clk *clk;
> > > + struct reset_control *rst;
> > > u64 rate;
> > > struct amba_device *adev;
> > > unsigned int load_val;
> > > @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const
> > > struct amba_id *id)
> > > return -ENODEV;
> > > }
> > > + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL);
> > > + if (IS_ERR(wdt->rst))
> > > + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not
> > > get reset\n");
> > > +
> > > + reset_control_deassert(wdt->rst);
> > > +
> >
> > Hi,
> >
> > Is a corresponding reset_control_assert() needed in the remove function?
>
> I don't think it makes much sense. Many drivers in kernel does not
> reassert the resets in their driver's remove callback too.
In general, balancing deassert/assert is only required for shared reset
controls.
For exclusive reset controls, it depends on whether the driver has any
expectations that the reset was asserted at some point before deassert
is called, possibly to reset registers or some internal state.
E.g., if this driver is unbound and then bound again, the deassert
during second probe is a no-op.
regards
Philipp
next prev parent reply other threads:[~2024-02-21 12:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 18:14 [PATCH v2 0/2] watchdog: sp805: add reset control support Yang Xiwen via B4 Relay
2024-02-19 18:14 ` [PATCH v2 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
2024-02-19 18:22 ` Christophe JAILLET
2024-02-19 18:26 ` Yang Xiwen
2024-02-19 19:00 ` Yang Xiwen
2024-02-21 12:00 ` Philipp Zabel [this message]
2024-02-21 11:48 ` Philipp Zabel
2024-02-19 18:14 ` [PATCH v2 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal Yang Xiwen via B4 Relay
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=ddecea158d5ea0cd2d682f8f9577ee0c78a755d9.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=forbidden405@outlook.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@kernel.org \
--cc=vireshk@kernel.org \
--cc=wim@linux-watchdog.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
all inboxes | Powered by JetHome®