The i.MX6 watchdog can't be stopped once started. Additionally, watchdog
hardware configuration needs to be able to handle low-power modes of the
SoC. For low-power modes, there are two configuration bits in the TRM:
- WDZST bit disables the watchdog timer in "deeper" low power modes and
- WDW bit disables the watchdog timer in "WAIT" mode
WDZST bit support is already in place since 1a9c5efa576e ("watchdog: imx2_wdt: disable watchdog timer during low power mode").
On the other hand, handling of WDZST bit was omitted so far but now
these patch series bring support for it.
SoC's "WAIT" low-power mode corresponds to Linux's freeze or
Suspend-to-Idle (S0) mode which can be activated with:
$ echo freeze > /sys/power/state
Without these patches, board would be reset by the watchdog after
timeout of 128 seconds since watchdog would not be stopped when SoC
entered Suspend-to-Idle mode. With patches in place, boards using
imx2-wdt are able to stay in Suspend-to-Idle mode indefinitely.
Last but not least, WDW bit is not found on all imx2-wdt supported i.MX
devices, therefore a new device-tree property "fsl,suspend-in-wait" has
been introduced for this.
Here is a v1: https://lore.kernel.org/lkml/[email protected]/
Change log for v2 in the corresponding patches.
Andrej Picej (3):
watchdog: imx2_wdg: suspend watchdog in WAIT mode
dt-bindings: watchdog: fsl-imx: document suspend in wait mode
ARM: dts: imx6ul/ull: suspend i.MX6UL watchdog in wait mode
.../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++
.../boot/dts/imx6ul-phytec-phycore-som.dtsi | 4 ++
drivers/watchdog/imx2_wdt.c | 37 +++++++++++++++++++
3 files changed, 63 insertions(+)
--
2.25.1
It was discovered that the watchdog triggers when the device is put into
"Suspend-To-Idle"/"freeze" low-power mode. Setting WDW bit disables
watchdog when the device is put into WAIT mode.
Signed-off-by: Andrej Picej <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
---
Changes in v2:
- no changes
---
arch/arm/boot/dts/imx6ul-phytec-phycore-som.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/imx6ul-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6ul-phytec-phycore-som.dtsi
index 3cddc68917a0..5168ed0ffec3 100644
--- a/arch/arm/boot/dts/imx6ul-phytec-phycore-som.dtsi
+++ b/arch/arm/boot/dts/imx6ul-phytec-phycore-som.dtsi
@@ -102,6 +102,10 @@ &usdhc2 {
status = "disabled";
};
+&wdog1 {
+ fsl,suspend-in-wait;
+};
+
&iomuxc {
pinctrl_enet1: enet1grp {
fsl,pins = <
--
2.25.1
Property "fsl,suspend-in-wait" suspends watchdog in "WAIT" mode which
corresponds to Linux's Suspend-to-Idle S0 mode. If this property is not
set and the device is put into Suspend-to-Idle mode, the watchdog
triggers a reset after 128 seconds.
Signed-off-by: Andrej Picej <[email protected]>
Reviewed-by: Fabio Estevam <[email protected]>
---
Changes in v2:
- add a commit message,
- add a list of devices which support this functionality
---
.../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
index fb7695515be1..9289de97859b 100644
--- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
@@ -55,6 +55,28 @@ properties:
If present, the watchdog device is configured to assert its
external reset (WDOG_B) instead of issuing a software reset.
+ fsl,suspend-in-wait:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: |
+ If present, the watchdog device is suspended in WAIT mode
+ (Suspend-to-Idle). Only supported on following devices:
+ - "fsl,imx25-wdt",
+ - "fsl,imx35-wdt",
+ - "fsl,imx50-wdt",
+ - "fsl,imx51-wdt",
+ - "fsl,imx53-wdt",
+ - "fsl,imx6q-wdt",
+ - "fsl,imx6sl-wdt",
+ - "fsl,imx6sll-wdt",
+ - "fsl,imx6sx-wdt",
+ - "fsl,imx6ul-wdt",
+ - "fsl,imx7d-wdt",
+ - "fsl,imx8mm-wdt",
+ - "fsl,imx8mn-wdt",
+ - "fsl,imx8mp-wdt",
+ - "fsl,imx8mq-wdt",
+ - "fsl,vf610-wdt".
+
required:
- compatible
- interrupts
--
2.25.1
On 25/10/2022 03:25, Andrej Picej wrote:
> Property "fsl,suspend-in-wait" suspends watchdog in "WAIT" mode which
> corresponds to Linux's Suspend-to-Idle S0 mode. If this property is not
> set and the device is put into Suspend-to-Idle mode, the watchdog
> triggers a reset after 128 seconds.
>
> Signed-off-by: Andrej Picej <[email protected]>
> Reviewed-by: Fabio Estevam <[email protected]>
> ---
> Changes in v2:
> - add a commit message,
> - add a list of devices which support this functionality
> ---
> .../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> index fb7695515be1..9289de97859b 100644
> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
> @@ -55,6 +55,28 @@ properties:
> If present, the watchdog device is configured to assert its
> external reset (WDOG_B) instead of issuing a software reset.
>
> + fsl,suspend-in-wait:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description: |
> + If present, the watchdog device is suspended in WAIT mode
> + (Suspend-to-Idle). Only supported on following devices:
> + - "fsl,imx25-wdt",
You need to define such allow/disallow in allOf:if:then, instead. Like
example-schema is doing for foo-supply, just disallow it for some types
or use "if: not: ..."
Best regards,
Krzysztof
On 25. 10. 22 15:48, Krzysztof Kozlowski wrote:
> On 25/10/2022 03:25, Andrej Picej wrote:
>> Property "fsl,suspend-in-wait" suspends watchdog in "WAIT" mode which
>> corresponds to Linux's Suspend-to-Idle S0 mode. If this property is not
>> set and the device is put into Suspend-to-Idle mode, the watchdog
>> triggers a reset after 128 seconds.
>>
>> Signed-off-by: Andrej Picej <[email protected]>
>> Reviewed-by: Fabio Estevam <[email protected]>
>> ---
>> Changes in v2:
>> - add a commit message,
>> - add a list of devices which support this functionality
>> ---
>> .../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>> index fb7695515be1..9289de97859b 100644
>> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>> @@ -55,6 +55,28 @@ properties:
>> If present, the watchdog device is configured to assert its
>> external reset (WDOG_B) instead of issuing a software reset.
>>
>> + fsl,suspend-in-wait:
>> + $ref: /schemas/types.yaml#/definitions/flag
>> + description: |
>> + If present, the watchdog device is suspended in WAIT mode
>> + (Suspend-to-Idle). Only supported on following devices:
>> + - "fsl,imx25-wdt",
>
> You need to define such allow/disallow in allOf:if:then, instead. Like
> example-schema is doing for foo-supply, just disallow it for some types
> or use "if: not: ..."
Sorry missed that. So something like that should be added?:
> allOf:
> - if:
> not:
> properties:
> compatible:
> contains:
> enum:
> - fsl,imx25-wdt
> - fsl,imx35-wdt
> - fsl,imx50-wdt
> - fsl,imx51-wdt
> - fsl,imx53-wdt
> - fsl,imx6q-wdt
> - fsl,imx6sl-wdt
> - fsl,imx6sll-wdt
> - fsl,imx6sx-wdt
> - fsl,imx6ul-wdt
> - fsl,imx7d-wdt
> - fsl,imx8mm-wdt
> - fsl,imx8mn-wdt
> - fsl,imx8mp-wdt
> - fsl,imx8mq-wdt
> - fsl,vf610-wdt
> then:
> properties:
> fsl,suspend-in-wait: false
And I'm assuming I can then remove the supported devices list from
property description.
Are you fine with this, so we don't have to split the compatible list
like Alexander suggested? Basically we have the same list of WDW
supported devices in the driver.
Thank you for your review,
Andrej
On 26/10/2022 02:38, Andrej Picej wrote:
> On 25. 10. 22 15:48, Krzysztof Kozlowski wrote:
>> On 25/10/2022 03:25, Andrej Picej wrote:
>>> Property "fsl,suspend-in-wait" suspends watchdog in "WAIT" mode which
>>> corresponds to Linux's Suspend-to-Idle S0 mode. If this property is not
>>> set and the device is put into Suspend-to-Idle mode, the watchdog
>>> triggers a reset after 128 seconds.
>>>
>>> Signed-off-by: Andrej Picej <[email protected]>
>>> Reviewed-by: Fabio Estevam <[email protected]>
>>> ---
>>> Changes in v2:
>>> - add a commit message,
>>> - add a list of devices which support this functionality
>>> ---
>>> .../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++++++++++
>>> 1 file changed, 22 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>> index fb7695515be1..9289de97859b 100644
>>> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>> @@ -55,6 +55,28 @@ properties:
>>> If present, the watchdog device is configured to assert its
>>> external reset (WDOG_B) instead of issuing a software reset.
>>>
>>> + fsl,suspend-in-wait:
>>> + $ref: /schemas/types.yaml#/definitions/flag
>>> + description: |
>>> + If present, the watchdog device is suspended in WAIT mode
>>> + (Suspend-to-Idle). Only supported on following devices:
>>> + - "fsl,imx25-wdt",
>>
>> You need to define such allow/disallow in allOf:if:then, instead. Like
>> example-schema is doing for foo-supply, just disallow it for some types
>> or use "if: not: ..."
>
> Sorry missed that. So something like that should be added?:
>
>> allOf:
>> - if:
>> not:
>> properties:
>> compatible:
>> contains:
>> enum:
>> - fsl,imx25-wdt
>> - fsl,imx35-wdt
>> - fsl,imx50-wdt
>> - fsl,imx51-wdt
>> - fsl,imx53-wdt
>> - fsl,imx6q-wdt
>> - fsl,imx6sl-wdt
>> - fsl,imx6sll-wdt
>> - fsl,imx6sx-wdt
>> - fsl,imx6ul-wdt
>> - fsl,imx7d-wdt
>> - fsl,imx8mm-wdt
>> - fsl,imx8mn-wdt
>> - fsl,imx8mp-wdt
>> - fsl,imx8mq-wdt
>> - fsl,vf610-wdt
Yes.
>> then:
>> properties:
>> fsl,suspend-in-wait: false
>
> And I'm assuming I can then remove the supported devices list from
> property description.
Yes.
>
> Are you fine with this, so we don't have to split the compatible list
> like Alexander suggested? Basically we have the same list of WDW
> supported devices in the driver.
I don't know to what you refer.
Best regards,
Krzysztof
On 26. 10. 22 16:12, Krzysztof Kozlowski wrote:
> On 26/10/2022 02:38, Andrej Picej wrote:
>> On 25. 10. 22 15:48, Krzysztof Kozlowski wrote:
>>> On 25/10/2022 03:25, Andrej Picej wrote:
>>>> Property "fsl,suspend-in-wait" suspends watchdog in "WAIT" mode which
>>>> corresponds to Linux's Suspend-to-Idle S0 mode. If this property is not
>>>> set and the device is put into Suspend-to-Idle mode, the watchdog
>>>> triggers a reset after 128 seconds.
>>>>
>>>> Signed-off-by: Andrej Picej <[email protected]>
>>>> Reviewed-by: Fabio Estevam <[email protected]>
>>>> ---
>>>> Changes in v2:
>>>> - add a commit message,
>>>> - add a list of devices which support this functionality
>>>> ---
>>>> .../bindings/watchdog/fsl-imx-wdt.yaml | 22 +++++++++++++++++++
>>>> 1 file changed, 22 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>>> index fb7695515be1..9289de97859b 100644
>>>> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>>> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.yaml
>>>> @@ -55,6 +55,28 @@ properties:
>>>> If present, the watchdog device is configured to assert its
>>>> external reset (WDOG_B) instead of issuing a software reset.
>>>>
>>>> + fsl,suspend-in-wait:
>>>> + $ref: /schemas/types.yaml#/definitions/flag
>>>> + description: |
>>>> + If present, the watchdog device is suspended in WAIT mode
>>>> + (Suspend-to-Idle). Only supported on following devices:
>>>> + - "fsl,imx25-wdt",
>>>
>>> You need to define such allow/disallow in allOf:if:then, instead. Like
>>> example-schema is doing for foo-supply, just disallow it for some types
>>> or use "if: not: ..."
>>
>> Sorry missed that. So something like that should be added?:
>>
>>> allOf:
>>> - if:
>>> not:
>>> properties:
>>> compatible:
>>> contains:
>>> enum:
>>> - fsl,imx25-wdt
>>> - fsl,imx35-wdt
>>> - fsl,imx50-wdt
>>> - fsl,imx51-wdt
>>> - fsl,imx53-wdt
>>> - fsl,imx6q-wdt
>>> - fsl,imx6sl-wdt
>>> - fsl,imx6sll-wdt
>>> - fsl,imx6sx-wdt
>>> - fsl,imx6ul-wdt
>>> - fsl,imx7d-wdt
>>> - fsl,imx8mm-wdt
>>> - fsl,imx8mn-wdt
>>> - fsl,imx8mp-wdt
>>> - fsl,imx8mq-wdt
>>> - fsl,vf610-wdt
>
> Yes.
>
>>> then:
>>> properties:
>>> fsl,suspend-in-wait: false
>>
>> And I'm assuming I can then remove the supported devices list from
>> property description.
>
> Yes.
>
>>
>> Are you fine with this, so we don't have to split the compatible list
>> like Alexander suggested? Basically we have the same list of WDW
>> supported devices in the driver.
>
> I don't know to what you refer.
>
I'm referring to this comment by Alexander Stein:
(https://lore.kernel.org/all/13126397.uLZWGnKmhe@steina-w/)
> So the models listed in Documentation/devicetree/bindings/watchdog/fsl-imx-
> wdt.yaml not supporting this feature are
> * fsl,imx21-wdt
> * fsl,imx27-wdt
> * fsl,imx31-wdt
> * fsl,ls1012a-wdt
> * fsl,ls1043a-wdt
> ?
>
> But all models are listed as compatible to fsl,imx21-wdt. So there is
> something wrong here. IMHO this sounds like the compatible list has to be
> split and updated. Depending on that this feature can be detected. Maintaining
> another list seems error prone to me.
Best regards,
Andrej.