diff mbox series

[v2,1/2] watchdog: mtk: add disable_wdt_extrst support

Message ID 20210903061623.10715-2-Fengquan.Chen@mediatek.com
State New
Headers show
Series [v2,1/2] watchdog: mtk: add disable_wdt_extrst support | expand

Commit Message

Fengquan Chen Sept. 3, 2021, 6:16 a.m. UTC
In some cases, we may need watchdog just to trigger an
internal soc reset without sending any output signal.

Provide a disable_wdt_extrst parameter for configuration.
We can disable or enable it just by configuring dts.

Signed-off-by: fengquan.chen <fengquan.chen@mediatek.com>
---
 drivers/watchdog/mtk_wdt.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Guenter Roeck Sept. 3, 2021, 2:05 p.m. UTC | #1
On 9/2/21 11:16 PM, Fengquan Chen wrote:
> In some cases, we may need watchdog just to trigger an
> internal soc reset without sending any output signal.
> 
> Provide a disable_wdt_extrst parameter for configuration.
> We can disable or enable it just by configuring dts.
> 
> Signed-off-by: fengquan.chen <fengquan.chen@mediatek.com>

Nit: You should set up git such that it uses "Fengquan Chen", not
"fengquan.chen".

Other than that, for my reference,

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

We'll have to wait for dt property approval before we can apply the patch.

Thanks,
Guenter

> ---
>   drivers/watchdog/mtk_wdt.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index 97ca993bd009..276b6cb7d225 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -63,6 +63,7 @@ struct mtk_wdt_dev {
>   	void __iomem *wdt_base;
>   	spinlock_t lock; /* protects WDT_SWSYSRST reg */
>   	struct reset_controller_dev rcdev;
> +	bool disable_wdt_extrst;
>   };
>   
>   struct mtk_wdt_data {
> @@ -240,6 +241,8 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev)
>   
>   	reg = ioread32(wdt_base + WDT_MODE);
>   	reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
> +	if (mtk_wdt->disable_wdt_extrst)
> +		reg &= ~WDT_MODE_EXRST_EN;
>   	reg |= (WDT_MODE_EN | WDT_MODE_KEY);
>   	iowrite32(reg, wdt_base + WDT_MODE);
>   
> @@ -309,6 +312,10 @@ static int mtk_wdt_probe(struct platform_device *pdev)
>   		if (err)
>   			return err;
>   	}
> +
> +	mtk_wdt->disable_wdt_extrst =
> +		of_property_read_bool(dev->of_node, "mediatek,disable-extrst");
> +
>   	return 0;
>   }
>   
>
Fengquan Chen Sept. 14, 2021, 12:51 p.m. UTC | #2
On Fri, 2021-09-03 at 07:05 -0700, Guenter Roeck wrote:
> On 9/2/21 11:16 PM, Fengquan Chen wrote:

> > In some cases, we may need watchdog just to trigger an

> > internal soc reset without sending any output signal.

> > 

> > Provide a disable_wdt_extrst parameter for configuration.

> > We can disable or enable it just by configuring dts.

> > 

> > Signed-off-by: fengquan.chen <fengquan.chen@mediatek.com>

> 

> Nit: You should set up git such that it uses "Fengquan Chen", not

> "fengquan.chen".

> 

> Other than that, for my reference,

> 

> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> 

> We'll have to wait for dt property approval before we can apply the

> patch.

> 

> Thanks,

> Guenter


Thanks, i have uploaded a new v3 to fix the signed-off name,
and move the dt-binding patch to the first patch.

Best Regards
Fengquan

> 

> > ---

> >   drivers/watchdog/mtk_wdt.c | 7 +++++++

> >   1 file changed, 7 insertions(+)

> > 

> > diff --git a/drivers/watchdog/mtk_wdt.c

> > b/drivers/watchdog/mtk_wdt.c

> > index 97ca993bd009..276b6cb7d225 100644

> > --- a/drivers/watchdog/mtk_wdt.c

> > +++ b/drivers/watchdog/mtk_wdt.c

> > @@ -63,6 +63,7 @@ struct mtk_wdt_dev {

> >   	void __iomem *wdt_base;

> >   	spinlock_t lock; /* protects WDT_SWSYSRST reg */

> >   	struct reset_controller_dev rcdev;

> > +	bool disable_wdt_extrst;

> >   };

> >   

> >   struct mtk_wdt_data {

> > @@ -240,6 +241,8 @@ static int mtk_wdt_start(struct watchdog_device

> > *wdt_dev)

> >   

> >   	reg = ioread32(wdt_base + WDT_MODE);

> >   	reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);

> > +	if (mtk_wdt->disable_wdt_extrst)

> > +		reg &= ~WDT_MODE_EXRST_EN;

> >   	reg |= (WDT_MODE_EN | WDT_MODE_KEY);

> >   	iowrite32(reg, wdt_base + WDT_MODE);

> >   

> > @@ -309,6 +312,10 @@ static int mtk_wdt_probe(struct

> > platform_device *pdev)

> >   		if (err)

> >   			return err;

> >   	}

> > +

> > +	mtk_wdt->disable_wdt_extrst =

> > +		of_property_read_bool(dev->of_node, "mediatek,disable-

> > extrst");

> > +

> >   	return 0;

> >   }

> >   

> > 

> 

>
diff mbox series

Patch

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 97ca993bd009..276b6cb7d225 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -63,6 +63,7 @@  struct mtk_wdt_dev {
 	void __iomem *wdt_base;
 	spinlock_t lock; /* protects WDT_SWSYSRST reg */
 	struct reset_controller_dev rcdev;
+	bool disable_wdt_extrst;
 };
 
 struct mtk_wdt_data {
@@ -240,6 +241,8 @@  static int mtk_wdt_start(struct watchdog_device *wdt_dev)
 
 	reg = ioread32(wdt_base + WDT_MODE);
 	reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+	if (mtk_wdt->disable_wdt_extrst)
+		reg &= ~WDT_MODE_EXRST_EN;
 	reg |= (WDT_MODE_EN | WDT_MODE_KEY);
 	iowrite32(reg, wdt_base + WDT_MODE);
 
@@ -309,6 +312,10 @@  static int mtk_wdt_probe(struct platform_device *pdev)
 		if (err)
 			return err;
 	}
+
+	mtk_wdt->disable_wdt_extrst =
+		of_property_read_bool(dev->of_node, "mediatek,disable-extrst");
+
 	return 0;
 }