2021-12-06 06:47:46

by Andrej Picej

[permalink] [raw]
Subject: [PATCH v5 1/5] mfd: da9062: make register CONFIG_I writable

From: Stefan Christ <[email protected]>

Make the config register CONFIG_I writable to change the watchdog mode.

Signed-off-by: Stefan Christ <[email protected]>
Signed-off-by: Andrej Picej <[email protected]>
---
Changes in v5:
- no changes

Changes in v4:
- no changes

Changes in v3:
- no changes

Changes in v2:
- no changes
---
drivers/mfd/da9062-core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index 01f8e10dfa55..7041ba53efb4 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -556,6 +556,7 @@ static const struct regmap_range da9062_aa_writeable_ranges[] = {
regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B),
regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
+ regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
};

--
2.25.1



2021-12-06 06:47:48

by Andrej Picej

[permalink] [raw]
Subject: [PATCH v5 3/5] watchdog: da9062: reset board on watchdog timeout

Implement a method to change watchdog timeout configuration based on DT
binding ("dlg,wdt-sd"). There is a possibility to change the behaviour
of watchdog reset. Setting WATCHDOG_SD bit enables SHUTDOWN mode, and
clearing it enables POWERDOWN mode on watchdog timeout.

If no DT binding is specified the WATCHDOG_SD bit stays in default
configuration, not breaking behaviour of devices which might depend on
default fuse configuration.

Note: This patch requires that the config register CONFIG_I is
configured as writable in the da9061/2 multi function device.

Signed-off-by: Andrej Picej <[email protected]>
---
Changes in v5:
- fix spelling mistake in commit message

Changes in v4:
- move the code to probe function

Changes in v3:
- no changes

Changes in v2:
- don't force the "reset" for all da9062-watchdog users, instead add DT
binding where the behavior can be selected
---
drivers/watchdog/da9062_wdt.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index f02cbd530538..bd85f84b0fd4 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -195,8 +195,11 @@ static int da9062_wdt_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
unsigned int timeout;
+ unsigned int mask;
struct da9062 *chip;
struct da9062_watchdog *wdt;
+ int ret;
+ u32 val;

chip = dev_get_drvdata(dev->parent);
if (!chip)
@@ -236,6 +239,30 @@ static int da9062_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
}

+ /*
+ * Configure what happens on watchdog timeout. Can be specified with
+ * "dlg,wdt-sd" dt-binding (0 -> POWERDOWN, 1 -> SHUTDOWN).
+ * If "dlg,wdt-sd" dt-binding is NOT set use the default.
+ */
+ ret = device_property_read_u32(dev, "dlg,wdt-sd", &val);
+ if (!ret) {
+ if (val)
+ /* Use da9062's SHUTDOWN mode */
+ mask = DA9062AA_WATCHDOG_SD_MASK;
+ else
+ /* Use da9062's POWERDOWN mode. */
+ mask = 0x0;
+
+ ret = regmap_update_bits(wdt->hw->regmap,
+ DA9062AA_CONFIG_I,
+ DA9062AA_WATCHDOG_SD_MASK,
+ mask);
+
+ if (ret)
+ dev_err(dev, "failed to set wdt reset mode: %d\n",
+ ret);
+ }
+
return devm_watchdog_register_device(dev, &wdt->wdtdev);
}

--
2.25.1


2021-12-06 06:47:49

by Andrej Picej

[permalink] [raw]
Subject: [PATCH v5 2/5] mfd: da9061: make register CONFIG_I writable

Make the config register CONFIG_I writable to change the watchdog mode.

Signed-off-by: Andrej Picej <[email protected]>
---
Chnages in v5:
- new patch, make CONFIG_I writable also for da9061 version
---
drivers/mfd/da9062-core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index 7041ba53efb4..20e5ce2a2354 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -453,6 +453,7 @@ static const struct regmap_range da9061_aa_writeable_ranges[] = {
regmap_reg_range(DA9062AA_VBUCK1_B, DA9062AA_VBUCK4_B),
regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B),
regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
+ regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
};

--
2.25.1


2021-12-06 06:47:51

by Andrej Picej

[permalink] [raw]
Subject: [PATCH v5 5/5] ARM: dts: imx6: phycore-som: set watchdog timeout mode to shutdown

Enable system restart when the watchdog timeout occurs.

Signed-off-by: Andrej Picej <[email protected]>
---
Changes in v5:
- no changes

Changes in v4:
- no changes

Changes in v3:
- no changes

Changes in v2:
- new patch, enable shutdown mode for phytec-phycore (da9062 user)
---
arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
index a80aa08a37cb..743343e525cf 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
@@ -111,6 +111,7 @@ da9062_onkey: onkey {
watchdog {
compatible = "dlg,da9062-watchdog";
dlg,use-sw-pm;
+ dlg,wdt-sd = <1>;
};

regulators {
--
2.25.1


2021-12-06 06:47:54

by Andrej Picej

[permalink] [raw]
Subject: [PATCH v5 4/5] dt-bindings: watchdog: da9062: add watchdog timeout mode

Document the watchdog timeout mode property. If this property is used
the user can select what happens on watchdog timeout. Set this property
to 1 to enable SHUTDOWN (the device resets), set it to 0 and the device
will go to POWERDOWN on watchdog timeout.

If this property is not set, don't touch the WATCHDOG_SD bit and leave
the configuration to OTP. This way backward compatibility is not broken.

Signed-off-by: Andrej Picej <[email protected]>
---
Changes in v5:
- no changes

Changes in v4:
- no changes

Changes in v3:
- add note about using the default OTP setting if this DT binding is
not specified

Changes in v2:
- new patch, document new DT binding
---
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
index 950e4fba8dbc..354314d854ef 100644
--- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
@@ -10,6 +10,12 @@ Optional properties:
- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
Only use this option if you can't use the watchdog automatic suspend
function during a suspend (see register CONTROL_B).
+- dlg,wdt-sd: Set what happens on watchdog timeout. If this bit is set the
+ watchdog timeout triggers SHUTDOWN, if cleared the watchdog triggers
+ POWERDOWN. Can be 0 or 1. Only use this option if you want to change the
+ default chip's OTP setting for WATCHDOG_SD bit. If this property is NOT
+ set the WATCHDOG_SD bit and on timeout watchdog behavior will match the
+ chip's OTP settings.

Example: DA9062

--
2.25.1


2021-12-06 08:48:20

by Christoph Niedermaier

[permalink] [raw]
Subject: RE: [PATCH v5 2/5] mfd: da9061: make register CONFIG_I writable

From: Andrej Picej
Sent: Monday, December 6, 2021 7:47 AM
>
> Make the config register CONFIG_I writable to change the watchdog mode.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---
> Chnages in v5:
> - new patch, make CONFIG_I writable also for da9061 version
> ---
> drivers/mfd/da9062-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index 7041ba53efb4..20e5ce2a2354 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -453,6 +453,7 @@ static const struct regmap_range
> da9061_aa_writeable_ranges[] = {
> regmap_reg_range(DA9062AA_VBUCK1_B, DA9062AA_VBUCK4_B),
> regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B),
> regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
> + regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
> regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
> };

Tested it on my DA9061:
- If I don't add anything to my device tree, the system freezes.
- With "dlg,wdt-sd = <1>;" in my devicetree the system restarts.
Thus it works on my system!

Tested-by: Christoph Niedermaier <[email protected]>


Thanks and regards
Christoph

2021-12-06 16:46:54

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 1/5] mfd: da9062: make register CONFIG_I writable

On 06 December 2021 06:47, Andrej Picej wrote:

> From: Stefan Christ <[email protected]>
>
> Make the config register CONFIG_I writable to change the watchdog mode.
>
> Signed-off-by: Stefan Christ <[email protected]>
> Signed-off-by: Andrej Picej <[email protected]>

I've already provided 'Reviewed-by' tags for the other patches in this set. In
the future you can add any received tags on to patch re-submissions where
nothing has changed since last review.

Anyway, thanks for the work on this, and for the patch set:

Reviewed-by: Adam Thomson <[email protected]>

2021-12-06 17:13:35

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v5 1/5] mfd: da9062: make register CONFIG_I writable

On 12/6/21 8:46 AM, Adam Thomson wrote:
> On 06 December 2021 06:47, Andrej Picej wrote:
>
>> From: Stefan Christ <[email protected]>
>>
>> Make the config register CONFIG_I writable to change the watchdog mode.
>>
>> Signed-off-by: Stefan Christ <[email protected]>
>> Signed-off-by: Andrej Picej <[email protected]>
>
> I've already provided 'Reviewed-by' tags for the other patches in this set. In
> the future you can add any received tags on to patch re-submissions where
> nothing has changed since last review.
>
> Anyway, thanks for the work on this, and for the patch set:
>
> Reviewed-by: Adam Thomson <[email protected]>
>

In this context:

I expect that tags are present in patchwork. If a submitter drops tags
in a new revision of a patch series, those will get lost. The underlying
assumption is that the submitter had a reason to drop tags, such as
substantial changes in an affected patch. I can not assume that the
submitter dropped a tag accidentally and re-apply it, unless the reason
was explicitly provided (obviously that is typically not the case since
people don't usually add "accidentally dropped Reviewed-by: tags" to
change logs).

Also, I do not look into one patch of a series and apply tags to other
patches of that series. Similar reason, only here it is worse because Wim
may pull a patch from patchwork, from an e-mail, or from my watchdog-next
branch. We can't have all of them have different tags, so I take what is
in patchwork and nothing else (and your updated Reviewed-by: tag will
not apply to other patches of the series because it isn't in patchwork
for those).

I also see that my own Reviewed-by: tag (or tags, I didn't check all
of them) was/were dropped in v5 of this series. That means I'll have to
re-review the series to see what changed, which will take time and means
that the series will end up at the bottom of my review queue.
Please keep that in mind when dropping tags.

Guenter

2021-12-06 20:13:52

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 1/5] mfd: da9062: make register CONFIG_I writable

On 06 December 2021 17:12, Guenter Roeck wrote:

> Also, I do not look into one patch of a series and apply tags to other
> patches of that series. Similar reason, only here it is worse because Wim
> may pull a patch from patchwork, from an e-mail, or from my watchdog-next
> branch. We can't have all of them have different tags, so I take what is
> in patchwork and nothing else (and your updated Reviewed-by: tag will
> not apply to other patches of the series because it isn't in patchwork
> for those).

That's fair enough. I'll send tags again for the other in the series. Thanks

2021-12-06 20:15:20

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 2/5] mfd: da9061: make register CONFIG_I writable

On 06 December 2021 06:47, Andrej Picej wrote:

> Make the config register CONFIG_I writable to change the watchdog mode.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---

Reviewed-by: Adam Thomson <[email protected]>

2021-12-06 20:16:11

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 3/5] watchdog: da9062: reset board on watchdog timeout

On 06 December 2021 06:48, Andrej Picej wrote:

> Implement a method to change watchdog timeout configuration based on DT
> binding ("dlg,wdt-sd"). There is a possibility to change the behaviour
> of watchdog reset. Setting WATCHDOG_SD bit enables SHUTDOWN mode, and
> clearing it enables POWERDOWN mode on watchdog timeout.
>
> If no DT binding is specified the WATCHDOG_SD bit stays in default
> configuration, not breaking behaviour of devices which might depend on
> default fuse configuration.
>
> Note: This patch requires that the config register CONFIG_I is
> configured as writable in the da9061/2 multi function device.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---

Reviewed-by: Adam Thomson <[email protected]>

2021-12-06 20:16:58

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 4/5] dt-bindings: watchdog: da9062: add watchdog timeout mode

On 06 December 2021 06:48, Andrej Picej wrote:

> Document the watchdog timeout mode property. If this property is used
> the user can select what happens on watchdog timeout. Set this property
> to 1 to enable SHUTDOWN (the device resets), set it to 0 and the device
> will go to POWERDOWN on watchdog timeout.
>
> If this property is not set, don't touch the WATCHDOG_SD bit and leave
> the configuration to OTP. This way backward compatibility is not broken.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---

Reviewed-by: Adam Thomson <[email protected]>

2021-12-06 20:18:02

by Adam Thomson

[permalink] [raw]
Subject: RE: [PATCH v5 5/5] ARM: dts: imx6: phycore-som: set watchdog timeout mode to shutdown

On 06 December 2021 06:48, Andrej Picej wrote:

> Enable system restart when the watchdog timeout occurs.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---

Reviewed-by: Adam Thomson <[email protected]>

2021-12-10 21:12:18

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v5 4/5] dt-bindings: watchdog: da9062: add watchdog timeout mode

On Mon, 06 Dec 2021 07:47:31 +0100, Andrej Picej wrote:
> Document the watchdog timeout mode property. If this property is used
> the user can select what happens on watchdog timeout. Set this property
> to 1 to enable SHUTDOWN (the device resets), set it to 0 and the device
> will go to POWERDOWN on watchdog timeout.
>
> If this property is not set, don't touch the WATCHDOG_SD bit and leave
> the configuration to OTP. This way backward compatibility is not broken.
>
> Signed-off-by: Andrej Picej <[email protected]>
> ---
> Changes in v5:
> - no changes
>
> Changes in v4:
> - no changes
>
> Changes in v3:
> - add note about using the default OTP setting if this DT binding is
> not specified
>
> Changes in v2:
> - new patch, document new DT binding
> ---
> Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 6 ++++++
> 1 file changed, 6 insertions(+)
>

Acked-by: Rob Herring <[email protected]>

2021-12-20 16:06:17

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v5 4/5] dt-bindings: watchdog: da9062: add watchdog timeout mode

On Mon, Dec 06, 2021 at 07:47:31AM +0100, Andrej Picej wrote:
> Document the watchdog timeout mode property. If this property is used
> the user can select what happens on watchdog timeout. Set this property
> to 1 to enable SHUTDOWN (the device resets), set it to 0 and the device
> will go to POWERDOWN on watchdog timeout.
>
> If this property is not set, don't touch the WATCHDOG_SD bit and leave
> the configuration to OTP. This way backward compatibility is not broken.
>
> Signed-off-by: Andrej Picej <[email protected]>
> Reviewed-by: Adam Thomson <[email protected]>
> Acked-by: Rob Herring <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> Changes in v5:
> - no changes
>
> Changes in v4:
> - no changes
>
> Changes in v3:
> - add note about using the default OTP setting if this DT binding is
> not specified
>
> Changes in v2:
> - new patch, document new DT binding
> ---
> Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> index 950e4fba8dbc..354314d854ef 100644
> --- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> @@ -10,6 +10,12 @@ Optional properties:
> - dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
> Only use this option if you can't use the watchdog automatic suspend
> function during a suspend (see register CONTROL_B).
> +- dlg,wdt-sd: Set what happens on watchdog timeout. If this bit is set the
> + watchdog timeout triggers SHUTDOWN, if cleared the watchdog triggers
> + POWERDOWN. Can be 0 or 1. Only use this option if you want to change the
> + default chip's OTP setting for WATCHDOG_SD bit. If this property is NOT
> + set the WATCHDOG_SD bit and on timeout watchdog behavior will match the
> + chip's OTP settings.
>
> Example: DA9062
>

2022-04-12 10:57:35

by Christoph Niedermaier

[permalink] [raw]
Subject: RE: [PATCH v5 1/5] mfd: da9062: make register CONFIG_I writable

From: Guenter Roeck [mailto:[email protected]] On Behalf Of Guenter Roeck
Sent: Monday, December 6, 2021 6:12 PM
> On 12/6/21 8:46 AM, Adam Thomson wrote:
>> On 06 December 2021 06:47, Andrej Picej wrote:
>>
>>> From: Stefan Christ <[email protected]>
>>>
>>> Make the config register CONFIG_I writable to change the watchdog mode.
>>>
>>> Signed-off-by: Stefan Christ <[email protected]>
>>> Signed-off-by: Andrej Picej <[email protected]>
>>
>> I've already provided 'Reviewed-by' tags for the other patches in this set. In
>> the future you can add any received tags on to patch re-submissions where
>> nothing has changed since last review.
>>
>> Anyway, thanks for the work on this, and for the patch set:
>>
>> Reviewed-by: Adam Thomson <[email protected]>
>>
>
> In this context:
>
> I expect that tags are present in patchwork. If a submitter drops tags
> in a new revision of a patch series, those will get lost. The underlying
> assumption is that the submitter had a reason to drop tags, such as
> substantial changes in an affected patch. I can not assume that the
> submitter dropped a tag accidentally and re-apply it, unless the reason
> was explicitly provided (obviously that is typically not the case since
> people don't usually add "accidentally dropped Reviewed-by: tags" to
> change logs).
>
> Also, I do not look into one patch of a series and apply tags to other
> patches of that series. Similar reason, only here it is worse because Wim
> may pull a patch from patchwork, from an e-mail, or from my watchdog-next
> branch. We can't have all of them have different tags, so I take what is
> in patchwork and nothing else (and your updated Reviewed-by: tag will
> not apply to other patches of the series because it isn't in patchwork
> for those).
>
> I also see that my own Reviewed-by: tag (or tags, I didn't check all
> of them) was/were dropped in v5 of this series. That means I'll have to
> re-review the series to see what changed, which will take time and means
> that the series will end up at the bottom of my review queue.
> Please keep that in mind when dropping tags.


Hi Guenter,

Is there anything against applying the first 4 patches of this series?

Thanks and regards
Christoph

2022-09-25 17:30:54

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v5 3/5] watchdog: da9062: reset board on watchdog timeout

On Mon, Dec 06, 2021 at 07:47:30AM +0100, Andrej Picej wrote:
> Implement a method to change watchdog timeout configuration based on DT
> binding ("dlg,wdt-sd"). There is a possibility to change the behaviour
> of watchdog reset. Setting WATCHDOG_SD bit enables SHUTDOWN mode, and
> clearing it enables POWERDOWN mode on watchdog timeout.
>
> If no DT binding is specified the WATCHDOG_SD bit stays in default
> configuration, not breaking behaviour of devices which might depend on
> default fuse configuration.
>
> Note: This patch requires that the config register CONFIG_I is
> configured as writable in the da9061/2 multi function device.
>
> Signed-off-by: Andrej Picej <[email protected]>
> Reviewed-by: Adam Thomson <[email protected]>

Acked-by: Guenter Roeck <[email protected]>

Depends on changes to be made in mfd driver.

Guenter

> ---
> Changes in v5:
> - fix spelling mistake in commit message
>
> Changes in v4:
> - move the code to probe function
>
> Changes in v3:
> - no changes
>
> Changes in v2:
> - don't force the "reset" for all da9062-watchdog users, instead add DT
> binding where the behavior can be selected
> ---
> drivers/watchdog/da9062_wdt.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index f02cbd530538..bd85f84b0fd4 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -195,8 +195,11 @@ static int da9062_wdt_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> unsigned int timeout;
> + unsigned int mask;
> struct da9062 *chip;
> struct da9062_watchdog *wdt;
> + int ret;
> + u32 val;
>
> chip = dev_get_drvdata(dev->parent);
> if (!chip)
> @@ -236,6 +239,30 @@ static int da9062_wdt_probe(struct platform_device *pdev)
> set_bit(WDOG_HW_RUNNING, &wdt->wdtdev.status);
> }
>
> + /*
> + * Configure what happens on watchdog timeout. Can be specified with
> + * "dlg,wdt-sd" dt-binding (0 -> POWERDOWN, 1 -> SHUTDOWN).
> + * If "dlg,wdt-sd" dt-binding is NOT set use the default.
> + */
> + ret = device_property_read_u32(dev, "dlg,wdt-sd", &val);
> + if (!ret) {
> + if (val)
> + /* Use da9062's SHUTDOWN mode */
> + mask = DA9062AA_WATCHDOG_SD_MASK;
> + else
> + /* Use da9062's POWERDOWN mode. */
> + mask = 0x0;
> +
> + ret = regmap_update_bits(wdt->hw->regmap,
> + DA9062AA_CONFIG_I,
> + DA9062AA_WATCHDOG_SD_MASK,
> + mask);
> +
> + if (ret)
> + dev_err(dev, "failed to set wdt reset mode: %d\n",
> + ret);
> + }
> +
> return devm_watchdog_register_device(dev, &wdt->wdtdev);
> }
>