From: "xt.hu[胡先韬]" <xt.hu@cqplus1.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: "wim@linux-watchdog.org" <wim@linux-watchdog.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
"linux@roeck-us.net" <linux@roeck-us.net>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"Wells Lu 呂芳騰" <wells.lu@sunplus.com>,
"qinjian[覃健]" <qinjian@cqplus1.com>,
"Rob Herring" <robh@kernel.org>
Subject: RE: [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021
Date: Fri, 31 Dec 2021 02:50:41 +0000 [thread overview]
Message-ID: <17803809bef1499fb051cf79fc3c7245@cqplus1.com> (raw)
Hi Chrustophe,
Thanks for your respond.
Best Regards,
Xiantao
> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> To: Xiantao Hu <xt.hu@cqplus1.com>,
> wim@linux-watchdog.org, p.zabel@pengutronix.de,
> linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
> linux@roeck-us.net, robh+dt@kernel.org,
> devicetree@vger.kernel.org
> Cc: wells.lu@sunplus.com, qinjian@cqplus1.com
> Subject: Re: [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021
> Date: Wed, 29 Dec 2021 10:39:08 +0100 [thread overview]
> Message-ID: <0b102fa0-cbfc-a97e-8e7f-cce8146450bc@wanadoo.fr> (raw)
> In-Reply-To: <20211229054308.63168-3-xt.hu@cqplus1.com>
>
>...
>
> > +static int sp_wdt_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct sp_wdt_priv *priv;
> > + int err;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + priv->clk = devm_clk_get(dev, NULL);
> > + if (IS_ERR(priv->clk)) {
> > + dev_err(dev, "Can't find clock source\n");
> > + return PTR_ERR(priv->clk);
> > + }
> > +
> > + err = clk_prepare_enable(priv->clk);
> > + if (err) {
> > + dev_err(dev, "Clock can't be enabled correctly\n");
> > + return err;
> > + }
> > +
> > + /* The timer and watchdog shared the STC reset */
> > + priv->rstc = devm_reset_control_get_shared(dev, NULL);
> > + if (!IS_ERR(priv->rstc))
> > + reset_control_deassert(priv->rstc);
> > +
> > + err = devm_add_action_or_reset(dev, sp_reset_control_assert,
> > + priv->rstc);
> > + if (err)
> > + return err;
> This looks odd.
> We could undo something that was not done. (if IS_ERR(priv->rstc))
> This is also not really consistent with what is done in suspedn/resume.
> In these functions, we don't check for IS_ERR(priv->rstc).
>
Here I refer to mt7621_wdt.c. I'm sure I need deassert reset to reset
watchdog register value when driver probe. accordingly I assert reset
in devm_add_action_or_reset() to ensure that the registers of watchdog
can't be operated after module remove.
> > +
> > + err = devm_add_action_or_reset(dev, sp_clk_disable_unprepare,
> > + priv->clk);
> > + if (err)
> > + return err;
> Shouldn't this be just after clk_prepare_enable()?
I tested the order of execution of the added functions which is similar to
push and pop. First in, last out. I think I should disable clock last.
next reply other threads:[~2021-12-31 3:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-31 2:50 xt.hu[胡先韬] [this message]
2022-01-05 15:53 ` [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021 Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2021-12-29 5:43 [PATCH v4 0/2] Add watchdog driver for Sunplus SP7021 SoC Xiantao Hu
2021-12-29 5:43 ` [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021 Xiantao Hu
2021-12-29 9:39 ` Christophe JAILLET
2022-01-02 15:00 ` Guenter Roeck
2022-01-02 16:14 ` Christophe JAILLET
2022-01-04 2:48 ` xt.hu[胡先韬]
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=17803809bef1499fb051cf79fc3c7245@cqplus1.com \
--to=xt.hu@cqplus1.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=p.zabel@pengutronix.de \
--cc=qinjian@cqplus1.com \
--cc=robh@kernel.org \
--cc=wells.lu@sunplus.com \
--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