devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Add watchdog driver for Sunplus SP7021 SoC
@ 2021-12-29  5:43 Xiantao Hu
  2021-12-29  5:43 ` [PATCH v4 1/2] watchdog: Add Sunplus SP7021 WDT devicetree bindings documentation Xiantao Hu
  2021-12-29  5:43 ` [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021 Xiantao Hu
  0 siblings, 2 replies; 10+ messages in thread
From: Xiantao Hu @ 2021-12-29  5:43 UTC (permalink / raw)
  To: wim, p.zabel, linux-kernel, linux-watchdog, linux, robh+dt, devicetree
  Cc: wells.lu, qinjian, Xiantao Hu

This is a patch series for watchdog driver for Sunplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates
many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD card and
etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Xiantao Hu (2):
  watchdog: Add Sunplus SP7021 WDT devicetree bindings documentation
  watchdog: Add watchdog driver for Sunplus SP7021

 .../bindings/watchdog/sunplus,sp7021-wdt.yaml |  47 +++
 MAINTAINERS                                   |   7 +
 drivers/watchdog/Kconfig                      |  11 +
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/sunplus_wdt.c                | 278 ++++++++++++++++++
 5 files changed, 344 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/sunplus,sp7021-wdt.yaml
 create mode 100644 drivers/watchdog/sunplus_wdt.c

-- 
2.33.1


^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: [PATCH v4 2/2] watchdog: Add watchdog driver for Sunplus SP7021
@ 2021-12-31  2:50 xt.hu[胡先韬]
  2022-01-05 15:53 ` Guenter Roeck
  0 siblings, 1 reply; 10+ messages in thread
From: xt.hu[胡先韬] @ 2021-12-31  2:50 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: wim, p.zabel, linux-kernel, linux-watchdog, linux, devicetree,
	Wells Lu 呂芳騰, qinjian[覃健],
	Rob Herring

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-10 19:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 1/2] watchdog: Add Sunplus SP7021 WDT devicetree bindings documentation Xiantao Hu
2022-01-10 19:11   ` Rob Herring
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[胡先韬]
2021-12-31  2:50 xt.hu[胡先韬]
2022-01-05 15:53 ` Guenter Roeck

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).