timer: tegra: Bind watchdog driver when timer node is processed
Subsystems (2)
PATCH 1/2 timer: tegra: Bind watchdog driver when timer node is processed
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the tegra30.dtsi there is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based on WDT_UCLASS).
--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/timer/tegra-timer.c +18 -0
@@ -11,6 +11,8 @@#include <asm/arch/clock.h> #include <asm/arch/tegra.h> +#include <dm/lists.h> +#define TEGRA_OSC_CLK_ENB_L_SET (NV_PA_CLK_RST_BASE + 0x320)#define TEGRA_OSC_SET_CLK_ENB_TMR BIT(5)
@@ -106,6 +108,21 @@ static int tegra_timer_probe(struct udevice *dev)return 0 ; } +static int tegra_timer_bind (struct udevice *dev) +{ +/* +* In Tegra 30 SoC the Watchdog is accomplished +* by the timer IP block (timer5). +*/ +if (CONFIG_IS_ENABLED (WDT_TEGRA )) +return device_bind_driver_to_node (dev,"tegra_wdt" , +"tegra-wdt" , +dev_ofnode (dev), +NULL ); + +return 0 ; +} +static const struct timer_ops tegra_timer_ops = { .get_count = tegra_timer_get_count, };
@@ -124,6 +141,7 @@ U_BOOT_DRIVER(tegra_timer) = { .id = UCLASS_TIMER, .of_match = tegra_timer_ids, .probe = tegra_timer_probe, + .bind = tegra_timer_bind, .ops = &tegra_timer_ops, .flags = DM_FLAG_PRE_RELOC, };
Signature · 1 line
2.39.5
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 6 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
Quoted 9 lines
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
What is the practical application for this diver in therms of Tegra and U-Boot overall? Where is can be used so that existing means of U-Boot cannot handle such case?
Hi Svyatoslav,
Quoted 13 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 11 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).
Quoted 8 lines
Quoted 5 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Quoted 2 lines
Where is can be used so that existing means of
U-Boot cannot handle such case?
Currently u-boot for Tegra 30 doesn't support Watchdog at all...
You have for example collibri T30 modules without WDT functionality support.
After adding those patches you can use WDT class (and wdt command) to control WDT.
Do you have more specific questions?
It is strange, but I've just noticed your reply (caused probably by my "work" mail switch), so I would like to apologize for a late reply.
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 22 lines
Hi Svyatoslav,
Quoted 19 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 16 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all? It is not used and has no practical application.
Quoted 4 lines
Quoted 2 lines
Where is can be used so that existing means of
U-Boot cannot handle such case?Currently u-boot for Tegra 30 doesn't support Watchdog at all...
Yes, and it does not affect or break anything.
Quoted 2 lines
You have for example collibri T30 modules without WDT functionality support.
Correct and? ALL Tegra devices work perfectly fine WITHOUT WDT
Quoted 3 lines
After adding those patches you can use WDT class (and wdt command) to control WDT.
And what is the benefit? To have a driver for the sake of having a driver?
Quoted 18 lines
Do you have more specific questions?
It is strange, but I've just noticed your reply (caused probably by my "work" mail switch), so I would like to apologize for a late reply.
--
Best regards,Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschftsfhrer : Stefano Babic
Hi Svyatoslav,
Quoted 24 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 23 lines
Hi Svyatoslav,
Quoted 20 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 17 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.
Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Where is can be used so that existing means of
U-Boot cannot handle such case?Currently u-boot for Tegra 30 doesn't support Watchdog at all...
Yes, and it does not affect or break anything.
Could you be more specific?
Quoted 5 lines
Quoted 3 lines
You have for example collibri T30 modules without WDT functionality support.
Correct and? ALL Tegra devices work perfectly fine WITHOUT WDT
They will not fulfil requirements of my customer's use case...
Quoted 7 lines
Quoted 4 lines
After adding those patches you can use WDT class (and wdt command) to control WDT.
And what is the benefit? To have a driver for the sake of having a driver?
The benefit is simple - WDT support in u-boot allows my customer to switch to open source BSP.
Many other SoCs (like NXP) do support Watchdog.
Quoted 20 lines
Quoted 20 lines
Do you have more specific questions?
It is strange, but I've just noticed your reply (caused probably by my "work" mail switch), so I would like to apologize for a late reply.
--
Best regards,Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschftsfhrer : Stefano Babic
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <[email protected]> пише:
Quoted 51 lines
Hi Svyatoslav,
Quoted 24 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 23 lines
Hi Svyatoslav,
Quoted 20 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 17 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
Quoted 6 lines
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
So when are you going to submit this board variant? If driver has no users, it is removed.
Quoted 55 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <[email protected]> пише:
Quoted 54 lines
Hi Svyatoslav,
Quoted 24 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 23 lines
Hi Svyatoslav,
Quoted 20 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 17 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
Quoted 6 lines
Quoted 3 lines
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
So when are you going to submit this board variant? If driver has no users, it is removed.
I assume it would be enabled on colibri_t30_defconfig.
Signature · 1 line
Tom
вт, 9 вер. 2025 р. о 18:39 Tom Rini <[email protected]> пише:
Quoted 57 lines · Svyatoslav Ryhel
Quoted 55 lines
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <[email protected]> пише:
Quoted 54 lines
Hi Svyatoslav,
Quoted 24 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 23 lines
Hi Svyatoslav,
Quoted 20 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 17 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
So when are you going to submit this board variant? If driver has no users, it is removed.
I assume it would be enabled on
colibri_t30_defconfig.
T30 colibri does not need it and does not use it with current configuration, hence I am asking about board submission.
Quoted 2 lines
--
Tom
Quoted 62 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 18:39 Tom Rini <[email protected]> пише:
Quoted 61 lines · Svyatoslav Ryhel
Quoted 59 lines
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <[email protected]> пише:
Quoted 57 lines
Hi Svyatoslav,
Quoted 24 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <[email protected]> пише:
Quoted 23 lines
Hi Svyatoslav,
Quoted 20 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 17 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
So when are you going to submit this board variant? If driver has no users, it is removed.
I assume it would be enabled on
colibri_t30_defconfig.T30 colibri does not need it and does not use it with current configuration, hence I am asking about board submission.
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
Signature · 1 line
Tom
вт, 9 вер. 2025 р. о 18:47 Tom Rini <[email protected]> пише:
Quoted 1 line
...
Quoted 6 lines
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
Alright, fair. Patches seem to be fine, but I would like Thierry to review them and then I can pick them via tegra device tree. Not sure if changes into colibri_t30_defconfig are needed, but if Francesco would like them, then ok.
Quoted 2 lines
--
Tom
Hello,
Quoted 8 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 18:47 Tom Rini <[email protected]> пише:
Quoted 1 line
...
Quoted 5 lines
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
...
Quoted 2 lines
Not sure if changes into
colibri_t30_defconfigare needed, but if Francesco would like them, then ok.
I would prefer the defconfig not to be touched.
Francesco
Hi Francesco,
Quoted 11 lines
Hello,
Quoted 8 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 18:47 Tom Rini <[email protected]> пише:
Quoted 1 line
...
Quoted 5 lines
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
Quoted 6 lines
...
Quoted 2 lines
Not sure if changes into
colibri_t30_defconfigare needed, but if Francesco would like them, then ok.I would prefer the defconfig not to be touched.
I'm still puzzled why this cannot be changed?
My customer is using the Colibri T30 module for their production solution (u-boot 2016.11 from latest Toradex Linux BSP doesn't help :-) )
To sum up:
----------
1. I think that the WDT driver is required for the Tegra 30 to be usable in any professional use case based on u-boot.
2. It would be best to modify the colibri_t30_defconfig to add support for WDT.
3. If point 2 is not possible (please share the rationale for it) - then I can ask my customer if I can share defconfig for their product.
Quoted 2 lines
Francesco
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
Quoted 13 lines · Łukasz Majewski
Hi Francesco,
Quoted 11 lines
Hello,
Quoted 8 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 18:47 Tom Rini <[email protected]> пише:
Quoted 1 line
...
Quoted 5 lines
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
Quoted 8 lines
Quoted 6 lines
...
Quoted 2 lines
Not sure if changes into
colibri_t30_defconfigare needed, but if Francesco would like them, then ok.I would prefer the defconfig not to be touched.
I'm still puzzled why this cannot be changed?
In general I like the idea of the watchdog driver to be enabled by default on the defconfig. This is the sane thing to do in a lot of situation.
Enabling it however complicates some use cases, attaching a debugger, or maybe we have a situation in which the OS is currently not keeping the WD alive, therefore you would be potentially in trouble if you would update the bootloader.
I am not familiar with the general colibri t30 user base to be enough confident this change will be fine, so this is the reason I am a little hesitant to change for such an old product.
With that said, I am ok to change it, no strong arguments against.
Francesco
Hi Francesco,
Quoted 34 lines · Łukasz Majewski
Quoted 15 lines
Hi Francesco,
Quoted 13 lines
Hello,
Quoted 9 lines · Svyatoslav Ryhel
вт, 9 вер. 2025 р. о 18:47 Tom Rini <[email protected]> пише:
Quoted 1 line
...
Quoted 5 lines
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
Quoted 8 lines
Quoted 6 lines
...
Quoted 2 lines
Not sure if changes into
colibri_t30_defconfigare needed, but if Francesco would like them, then ok.I would prefer the defconfig not to be touched.
I'm still puzzled why this cannot be changed?
In general I like the idea of the watchdog driver to be enabled by default on the defconfig. This is the sane thing to do in a lot of situation.
Enabling it however complicates some use cases, attaching a debugger, or maybe we have a situation in which the OS is currently not keeping the WD alive, therefore you would be potentially in trouble if you would update the bootloader.
Quoted 6 lines
I am not familiar with the general colibri t30 user base to be enough confident this change will be fine, so this is the reason I am a little hesitant to change for such an old product.
With that said, I am ok to change it, no strong arguments against.
Ok, so I will prepare patch modifying colibri_t30_defconfig after the WDT supporting patches are accepted.
Quoted 3 lines
Francesco
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
Hi Tom,
Quoted 74 lines · Svyatoslav Ryhel
Quoted 73 lines
вт, 9 вер. 2025 р. о 18:39 Tom Rini <[email protected]> пише:
Quoted 71 lines · Svyatoslav Ryhel
Quoted 60 lines
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <[email protected]> пише:
Quoted 57 lines
Hi Svyatoslav,
Quoted 26 lines
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski
<[email protected]> пише:Quoted 24 lines
Hi Svyatoslav,
Quoted 21 lines
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski
<[email protected]> пише:Quoted 18 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What is the practical application for this diver in therms of Tegra and U-Boot overall?
You have the WDT functionality working. It uses the same DTS bindings as ones used in Linux.
Why do we need WDT for Tegra in U-Boot at all?
Can you correct me if I draw wrong conclusion - you ask why Tegra needs to support watchdog in u-boot bootloader ?
Quoted 3 lines
It is not used and has
no practical application.Yes, it has ...
Customer has number of Tegra30 colibri modules in the field. They want to switch to u-boot + linux kernel BSP.
For their application - it would be welcome if the device could reboot and start emergency procedure in the case of not being able to start Linux.
The procedure is that we start Watchdog at very early boot - then we do have for example 30 seconds to "feed" the Watchdog in Linux
Quoted 6 lines
Quoted 3 lines
When we fail, after watchdog reboot, we can switch to another rootfs partition (the A/B scheme of booting) or start emergency system.
So when are you going to submit this board variant? If driver has no users, it is removed.
I assume it would be enabled on
colibri_t30_defconfig.
Quoted 8 lines
Quoted 2 lines
T30 colibri does not need it and does not use it with current configuration, hence I am asking about board submission.
It's a devkit where I'm pretty sure the watchdog exists, so we can enable it there and be done. Just because it doesn't use it today doesn't mean it can't use it in the future if we enable it, the "use watchdog to make sure A/B system configures are stable" is a common use case.
+1
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
PATCH 2/2 watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver
In reply to Lukasz MajewskiThis commit provides support for Tegra's 30 watchdog functionality. The WATCHDOG index 0 in conjunction with TIMER 5 has been used. as the same setup is used in Linux kernel driver.
--- drivers/watchdog/Kconfig | 7 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/tegra_wdt.c | 121 +++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 drivers/watchdog/tegra_wdt.c
drivers/watchdog/Kconfig +7 -0
@@ -454,6 +454,13 @@ config WDT_TANGIER Intel Tangier SoC. If you're using a board with Intel Tangier SoC, say Y here. +config WDT_TEGRA + bool "Tegra watchdog" + depends on WDT && ARCH_TEGRA + help + Select this to enable support for the watchdog timer + embedded in NVIDIA Tegra SoCs. + config WDT_ARM_SMC bool "ARM SMC watchdog timer support" depends on WDT && ARM_SMCCC
drivers/watchdog/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_WDT_STARFIVE) += starfive_wdt.o obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o +obj-$(CONFIG_WDT_TEGRA) += tegra_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o obj-$(CONFIG_WDT_ADI) += adi_wdt.o obj-$(CONFIG_WDT_QCOM) += qcom-wdt.o
drivers/watchdog/tegra_wdt.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <[email protected]> пише:
Quoted 55 lines
This commit provides support for Tegra's 30 watchdog functionality. The WATCHDOG index 0 in conjunction with TIMER 5 has been used. as the same setup is used in Linux kernel driver.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/watchdog/Kconfig | 7 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/tegra_wdt.c | 121 +++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 drivers/watchdog/tegra_wdt.cdrivers/watchdog/Kconfig +7
-0@@ -454,6 +454,13 @@ config WDT_TANGIER Intel Tangier SoC. If you're using a board with Intel Tangier SoC, say Y here. +config WDT_TEGRA + bool "Tegra watchdog" + depends on WDT && ARCH_TEGRA + help + Select this to enable support for the watchdog timer + embedded in NVIDIA Tegra SoCs. + config WDT_ARM_SMC bool "ARM SMC watchdog timer support" depends on WDT && ARM_SMCCCdrivers/watchdog/Makefile +1
-0@@ -53,6 +53,7 @@ obj-$(CONFIG_WDT_STARFIVE) += starfive_wdt.o obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o +obj-$(CONFIG_WDT_TEGRA) += tegra_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o obj-$(CONFIG_WDT_ADI) += adi_wdt.o obj-$(CONFIG_WDT_QCOM) += qcom-wdt.odrivers/watchdog/tegra_wdt.c new file +6
-0@@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* NVIDIA Tegra Watchdog driver +* +* Copyright (C) 2025 NABLA Software Engineering +* Lukasz Majewski, NABLA Software Engineering, [email protected]
drivers/watchdog/tegra_wdt.c line 16
Quoted 10 lines
drivers/watchdog/tegra_wdt.c new file +10
-0+*/ + +#include <dm.h> +#include <wdt.h> +#include <hang.h> +#include <asm/io.h> +#include <watchdog.h> + +/* Timer registers */ +#define TIMER_PTV (0x0)
Here and further, use 0x0 without (), hex numbers in lower case
Quoted 44 lines
drivers/watchdog/tegra_wdt.c new file +44
-0+#define TIMER_EN BIT(31) +#define TIMER_PERIODIC BIT(30) + +/* WDT registers */ +#define WDT_CFG (0x0) +#define WDT_CFG_PERIOD_SHIFT 4 +#define WDT_CFG_PERIOD_MASK GENMASK(7, 0) +#define WDT_CFG_INT_EN BIT(12) +#define WDT_CFG_PMC2CAR_RST_EN BIT(15) +#define WDT_CMD (0x8) +#define WDT_CMD_START_COUNTER BIT(0) +#define WDT_CMD_DISABLE_COUNTER BIT(1) +#define WDT_UNLOCK (0xC) +#define WDT_UNLOCK_PATTERN (0xc45a) + +/* Use watchdog ID 0 */ +#define WDT0_BASE 0x100 + +/* Use Timer 5 as WDT counter */ +#define WDT_TIM5_BASE 0x60 +#define WDT_TIM5_ID 5 + +struct tegra_wdt_priv { +void __iomem *wdt_base; +void __iomem *tim_base; +}; + +static int tegra_wdt_reset (struct udevice *dev) +{ +struct tegra_wdt_priv *priv =dev_get_priv (dev); + +writel (WDT_CMD_START_COUNTER , priv->wdt_base +WDT_CMD ); + +return 0 ; +} + +static int tegra_wdt_start (struct udevice *dev,u64 timeout,ulong flags) +{ +struct tegra_wdt_priv *priv =dev_get_priv (dev); +u32 timeout_sec = timeout /1000 ; + +/* +* Timer for WDT has a fixed 1MHz clock, so for 1 second period one +* shall write 1000000ul.
drivers/watchdog/tegra_wdt.c line 70
Quoted 10 lines
drivers/watchdog/tegra_wdt.c new file +10
-0+* +* On Tegra the watchdog reset actually occurs on the 4th expiration +* of this counter, so we set the period to 1/4. +*/ +writel (TIMER_EN |TIMER_PERIODIC | (1000000ul /4 ), + priv->tim_base +TIMER_PTV ); + +/* Support for timeout from 1 to 255 seconds */ +if (timeout_sec <1 || timeout_sec >255 ) +return -EINVAL ;
Check should be before any register writing is done.
Quoted 17 lines
drivers/watchdog/tegra_wdt.c new file +17
-0+ +writel (WDT_CFG_PMC2CAR_RST_EN | (timeout_sec <<WDT_CFG_PERIOD_SHIFT ) | +WDT_TIM5_ID , priv->wdt_base +WDT_CFG ); + +writel (WDT_CMD_START_COUNTER , priv->wdt_base +WDT_CMD ); + +return 0 ; +} + +static int tegra_wdt_stop (struct udevice *dev) +{ +struct tegra_wdt_priv *priv =dev_get_priv (dev); + +writel (WDT_UNLOCK_PATTERN , priv->wdt_base +WDT_UNLOCK ); +writel (WDT_CMD_DISABLE_COUNTER , priv->wdt_base +WDT_CMD ); +writel (0 , priv->tim_base +TIMER_PTV ); +
drivers/watchdog/tegra_wdt.c line 97
Quoted 10 lines
drivers/watchdog/tegra_wdt.c new file +10
-0+return 0 ; +} + +static int tegra_wdt_probe (struct udevice *dev) +{ +struct tegra_wdt_priv *priv =dev_get_priv (dev); +void __iomem *base; + +if (!device_is_compatible (dev,"nvidia,tegra30-timer" )) +return -ENODEV ;
Remove this restriction, it is not needed.
Quoted 25 lines
drivers/watchdog/tegra_wdt.c new file +24
-1+ + base =dev_read_addr_ptr (dev); +if (!base) +return -ENOENT ; + + priv->wdt_base = base +WDT0_BASE ; + priv->tim_base = base +WDT_TIM5_BASE ; + +return 0 ; +} + +static const struct wdt_ops tegra_wdt_ops = { + .start = tegra_wdt_start, + .stop = tegra_wdt_stop, + .reset = tegra_wdt_reset, +}; + +U_BOOT_DRIVER (tegra_wdt) = { + .name ="tegra_wdt" , + .id =UCLASS_WDT , + .priv_auto =sizeof (struct tegra_wdt_priv ), + .probe = tegra_wdt_probe, + .ops = &tegra_wdt_ops, +}; --
Quoted 2 lines
2.39.5
Everything else seems to be fine. Apply those cosmetic changes and I will pick your patches.
Dear Community,
Quoted 51 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/timer/tegra-timer.c +17
-0@@ -11,6 +11,8 @@#include <asm/arch/clock.h> #include <asm/arch/tegra.h> +#include <dm/lists.h> +#define TEGRA_OSC_CLK_ENB_L_SET (NV_PA_CLK_RST_BASE + 0x320) #define TEGRA_OSC_SET_CLK_ENB_TMR BIT(5)@@ -106,6 +108,21 @@ static int tegra_timer_probe(struct udevice *dev)return 0 ; } +static int tegra_timer_bind (struct udevice *dev) +{ +/* +* In Tegra 30 SoC the Watchdog is accomplished +* by the timer IP block (timer5). +*/ +if (CONFIG_IS_ENABLED (WDT_TEGRA )) +return device_bind_driver_to_node (dev,"tegra_wdt" , +"tegra-wdt" , +dev_ofnode (dev), +NULL ); + +return 0 ; +} +static const struct timer_ops tegra_timer_ops = { .get_count = tegra_timer_get_count, };
drivers/timer/tegra-timer.c U_BOOT_DRIVER(tegra_timer) = { · line 147
Quoted 7 lines
drivers/timer/tegra-timer.c +1
-0@@ -124,6 +141,7 @@ U_BOOT_DRIVER(tegra_timer) = { .id = UCLASS_TIMER, .of_match = tegra_timer_ids, .probe = tegra_timer_probe, + .bind = tegra_timer_bind, .ops = &tegra_timer_ops, .flags = DM_FLAG_PRE_RELOC, };
Are there any new comments regarding this patch set?
Signature · 10 lines
Best regards, Lukasz Majewski -- Nabla Software Engineering GmbH HRB 40522 Augsburg Phone: +49 821 45592596 E-Mail: [email protected] Geschftsfhrer : Stefano Babic
ср, 17 вер. 2025 р. о 15:46 Łukasz Majewski <[email protected]> пише:
Quoted 13 lines
Dear Community,
Quoted 10 lines
The Tegra30 SoC is a bit special, as it doesn't have the separate IP block to provide watchdog functionality.
Instead, timer IP block allows such functionality when properly configured.
As in the
tegra30.dtsithere is a timer node, which "covers" all timers, with 'nvidia,tegra30-timer' compatibility it was necessary to manually bind U-Boot's WDT driver (based onWDT_UCLASS).
You don't need to describe all this, just describe what you have done in the patch.
Quoted 18 lines
Quoted 18 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/timer/tegra-timer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/timer/tegra-timer.c +2
-0@@ -11,6 +11,8 @@#include <asm/arch/clock.h> #include <asm/arch/tegra.h> +#include <dm/lists.h> +#define TEGRA_OSC_CLK_ENB_L_SET (NV_PA_CLK_RST_BASE + 0x320) #define TEGRA_OSC_SET_CLK_ENB_TMR BIT(5)
Quoted 8 lines
drivers/timer/tegra-timer.c static int tegra_timer_probe(struct udevice *dev) · line 114
Quoted 8 lines
drivers/timer/tegra-timer.c +4
-0@@ -106,6 +108,21 @@ static int tegra_timer_probe(struct udevice *dev)return 0 ; } +static int tegra_timer_bind (struct udevice *dev) +{ +/* +* In Tegra 30 SoC the Watchdog is accomplished
remove the Tegra30 SoC, all Tegra SoC generation can use timer 5 as watchdog, not only Tegra30
Quoted 36 lines
Quoted 15 lines
drivers/timer/tegra-timer.c +11
-0+* by the timer IP block (timer5). +*/ +if (CONFIG_IS_ENABLED (WDT_TEGRA )) +return device_bind_driver_to_node (dev,"tegra_wdt" , +"tegra-wdt" , +dev_ofnode (dev), +NULL ); + +return 0 ; +} +static const struct timer_ops tegra_timer_ops = { .get_count = tegra_timer_get_count, };drivers/timer/tegra-timer.c U_BOOT_DRIVER(tegra_timer) = { · line 147
Quoted 7 lines
drivers/timer/tegra-timer.c +1
-0@@ -124,6 +141,7 @@ U_BOOT_DRIVER(tegra_timer) = { .id = UCLASS_TIMER, .of_match = tegra_timer_ids, .probe = tegra_timer_probe, + .bind = tegra_timer_bind, .ops = &tegra_timer_ops, .flags = DM_FLAG_PRE_RELOC, };Are there any new comments regarding this patch set?
--
Best regards,Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschftsfhrer : Stefano Babic