* [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
@ 2025-08-26 9:39 Lukasz Majewski
2025-08-26 9:39 ` [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 19+ messages in thread
From: Lukasz Majewski @ 2025-08-26 9:39 UTC (permalink / raw)
To: Thierry Reding, Svyatoslav Ryhel; +Cc: Tom Rini, u-boot, Lukasz Majewski
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).
Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
---
drivers/timer/tegra-timer.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/timer/tegra-timer.c b/drivers/timer/tegra-timer.c
index 3545424889d..361539efa43 100644
--- a/drivers/timer/tegra-timer.c
+++ b/drivers/timer/tegra-timer.c
@@ -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,
};
--
2.39.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver
2025-08-26 9:39 [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Lukasz Majewski
@ 2025-08-26 9:39 ` Lukasz Majewski
2025-09-17 14:01 ` Svyatoslav Ryhel
2025-08-26 10:10 ` [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Svyatoslav Ryhel
2025-09-17 12:46 ` Łukasz Majewski
2 siblings, 1 reply; 19+ messages in thread
From: Lukasz Majewski @ 2025-08-26 9:39 UTC (permalink / raw)
To: Thierry Reding, Svyatoslav Ryhel; +Cc: Tom Rini, u-boot, Lukasz Majewski
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 <lukma@nabladev.com>
---
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
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 9e149a75e81..a10baed7232 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -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
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index d52d17e1c90..02e2674f8af 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -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
diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
new file mode 100644
index 00000000000..812ec312fee
--- /dev/null
+++ b/drivers/watchdog/tegra_wdt.c
@@ -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, lukma@nabladev.com
+ */
+
+#include <dm.h>
+#include <wdt.h>
+#include <hang.h>
+#include <asm/io.h>
+#include <watchdog.h>
+
+/* Timer registers */
+#define TIMER_PTV (0x0)
+#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.
+ *
+ * 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;
+
+ 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);
+
+ 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;
+
+ 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,
+};
--
2.39.5
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-08-26 9:39 [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Lukasz Majewski
2025-08-26 9:39 ` [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver Lukasz Majewski
@ 2025-08-26 10:10 ` Svyatoslav Ryhel
2025-09-08 12:41 ` Łukasz Majewski
2025-09-17 12:46 ` Łukasz Majewski
2 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-08-26 10:10 UTC (permalink / raw)
To: Lukasz Majewski; +Cc: Thierry Reding, Tom Rini, u-boot
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com> пише:
>
> 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).
>
> Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> ---
> 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?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-08-26 10:10 ` [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Svyatoslav Ryhel
@ 2025-09-08 12:41 ` Łukasz Majewski
2025-09-08 13:55 ` Svyatoslav Ryhel
0 siblings, 1 reply; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-08 12:41 UTC (permalink / raw)
To: Svyatoslav Ryhel; +Cc: Thierry Reding, Tom Rini, u-boot
Hi Svyatoslav,
> вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> пише:
> >
> > 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).
> >
> > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > ---
> > 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.
> 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.
--
Best regards,
Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-08 12:41 ` Łukasz Majewski
@ 2025-09-08 13:55 ` Svyatoslav Ryhel
2025-09-09 10:15 ` Łukasz Majewski
0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-08 13:55 UTC (permalink / raw)
To: Łukasz Majewski; +Cc: Thierry Reding, Tom Rini, u-boot
пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
>
> Hi Svyatoslav,
>
> > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > пише:
> > >
> > > 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).
> > >
> > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > ---
> > > 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.
Why do we need WDT for Tegra in U-Boot at all? It is not used and has
no practical application.
> > 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.
> You have for example collibri T30 modules without WDT functionality
> support.
Correct and? ALL Tegra devices work perfectly fine WITHOUT WDT
> 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?
> 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: office@nabladev.com
> Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-08 13:55 ` Svyatoslav Ryhel
@ 2025-09-09 10:15 ` Łukasz Majewski
2025-09-09 11:26 ` Svyatoslav Ryhel
0 siblings, 1 reply; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-09 10:15 UTC (permalink / raw)
To: Svyatoslav Ryhel, Tom Rini
Cc: Thierry Reding, u-boot, Tom Warren, Stephen Warren
Hi Svyatoslav,
> пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
> >
> > Hi Svyatoslav,
> >
> > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > > пише:
> > > >
> > > > 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).
> > > >
> > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > ---
> > > > 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.
>
> 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 ?
> 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.
> > > 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?
>
> > 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...
>
> > 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.
>
> > 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: office@nabladev.com
> > Geschftsfhrer : Stefano Babic
--
Best regards,
Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 10:15 ` Łukasz Majewski
@ 2025-09-09 11:26 ` Svyatoslav Ryhel
2025-09-09 15:39 ` Tom Rini
0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-09 11:26 UTC (permalink / raw)
To: Łukasz Majewski
Cc: Tom Rini, Thierry Reding, u-boot, Tom Warren, Stephen Warren
вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <lukma@nabladev.com> пише:
>
> Hi Svyatoslav,
>
> > пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
> > >
> > > Hi Svyatoslav,
> > >
> > > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > > > пише:
> > > > >
> > > > > 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).
> > > > >
> > > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > > ---
> > > > > 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.
> >
> > 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 ?
>
> > 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.
>
So when are you going to submit this board variant? If driver has no
users, it is removed.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 11:26 ` Svyatoslav Ryhel
@ 2025-09-09 15:39 ` Tom Rini
2025-09-09 15:44 ` Svyatoslav Ryhel
0 siblings, 1 reply; 19+ messages in thread
From: Tom Rini @ 2025-09-09 15:39 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Łukasz Majewski, Thierry Reding, u-boot, Tom Warren,
Stephen Warren
[-- Attachment #1: Type: text/plain, Size: 2465 bytes --]
On Tue, Sep 09, 2025 at 02:26:19PM +0300, Svyatoslav Ryhel wrote:
> вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <lukma@nabladev.com> пише:
> >
> > Hi Svyatoslav,
> >
> > > пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
> > > >
> > > > Hi Svyatoslav,
> > > >
> > > > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > > > > пише:
> > > > > >
> > > > > > 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).
> > > > > >
> > > > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > > > ---
> > > > > > 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.
> > >
> > > 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 ?
> >
> > > 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.
> >
>
> 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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 15:39 ` Tom Rini
@ 2025-09-09 15:44 ` Svyatoslav Ryhel
2025-09-09 15:47 ` Tom Rini
0 siblings, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-09 15:44 UTC (permalink / raw)
To: Tom Rini; +Cc: Łukasz Majewski, Thierry Reding, u-boot, Stephen Warren
вт, 9 вер. 2025 р. о 18:39 Tom Rini <trini@konsulko.com> пише:
>
> On Tue, Sep 09, 2025 at 02:26:19PM +0300, Svyatoslav Ryhel wrote:
> > вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <lukma@nabladev.com> пише:
> > >
> > > Hi Svyatoslav,
> > >
> > > > пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
> > > > >
> > > > > Hi Svyatoslav,
> > > > >
> > > > > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > > > > > пише:
> > > > > > >
> > > > > > > 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).
> > > > > > >
> > > > > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > > > > ---
> > > > > > > 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.
> > > >
> > > > 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 ?
> > >
> > > > 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.
> > >
> >
> > 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.
> --
> Tom
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 15:44 ` Svyatoslav Ryhel
@ 2025-09-09 15:47 ` Tom Rini
2025-09-09 16:08 ` Svyatoslav Ryhel
2025-09-10 6:52 ` Łukasz Majewski
0 siblings, 2 replies; 19+ messages in thread
From: Tom Rini @ 2025-09-09 15:47 UTC (permalink / raw)
To: Svyatoslav Ryhel, Francesco Dolcini
Cc: Łukasz Majewski, Thierry Reding, u-boot, Stephen Warren
[-- Attachment #1: Type: text/plain, Size: 3291 bytes --]
On Tue, Sep 09, 2025 at 06:44:45PM +0300, Svyatoslav Ryhel wrote:
> вт, 9 вер. 2025 р. о 18:39 Tom Rini <trini@konsulko.com> пише:
> >
> > On Tue, Sep 09, 2025 at 02:26:19PM +0300, Svyatoslav Ryhel wrote:
> > > вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <lukma@nabladev.com> пише:
> > > >
> > > > Hi Svyatoslav,
> > > >
> > > > > пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski <lukma@nabladev.com> пише:
> > > > > >
> > > > > > Hi Svyatoslav,
> > > > > >
> > > > > > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com>
> > > > > > > пише:
> > > > > > > >
> > > > > > > > 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).
> > > > > > > >
> > > > > > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > > > > > ---
> > > > > > > > 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.
> > > > >
> > > > > 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 ?
> > > >
> > > > > 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.
> > > >
> > >
> > > 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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 15:47 ` Tom Rini
@ 2025-09-09 16:08 ` Svyatoslav Ryhel
2025-09-10 8:51 ` Francesco Dolcini
2025-09-10 6:52 ` Łukasz Majewski
1 sibling, 1 reply; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-09 16:08 UTC (permalink / raw)
To: Tom Rini
Cc: Francesco Dolcini, Łukasz Majewski, Thierry Reding, u-boot,
Stephen Warren
вт, 9 вер. 2025 р. о 18:47 Tom Rini <trini@konsulko.com> пише:
>
...
> 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.
> --
> Tom
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 15:47 ` Tom Rini
2025-09-09 16:08 ` Svyatoslav Ryhel
@ 2025-09-10 6:52 ` Łukasz Majewski
1 sibling, 0 replies; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-10 6:52 UTC (permalink / raw)
To: Tom Rini
Cc: Svyatoslav Ryhel, Francesco Dolcini, Thierry Reding, u-boot,
Stephen Warren
Hi Tom,
> On Tue, Sep 09, 2025 at 06:44:45PM +0300, Svyatoslav Ryhel wrote:
> > вт, 9 вер. 2025 р. о 18:39 Tom Rini <trini@konsulko.com> пише:
> > >
> > > On Tue, Sep 09, 2025 at 02:26:19PM +0300, Svyatoslav Ryhel wrote:
> > >
> > > > вт, 9 вер. 2025 р. о 13:15 Łukasz Majewski <lukma@nabladev.com>
> > > > пише:
> > > > >
> > > > > Hi Svyatoslav,
> > > > >
> > > > > > пн, 8 вер. 2025 р. о 15:41 Łukasz Majewski
> > > > > > <lukma@nabladev.com> пише:
> > > > > > >
> > > > > > > Hi Svyatoslav,
> > > > > > >
> > > > > > > > вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski
> > > > > > > > <lukma@nabladev.com> пише:
> > > > > > > > >
> > > > > > > > > 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).
> > > > > > > > >
> > > > > > > > > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > > > > > > > > ---
> > > > > > > > > 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.
> > > > > >
> > > > > > 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 ?
> > > > >
> > > > > > 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.
> > > >
> > > > 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.
+1
--
Best regards,
Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-09 16:08 ` Svyatoslav Ryhel
@ 2025-09-10 8:51 ` Francesco Dolcini
2025-09-10 12:28 ` Łukasz Majewski
0 siblings, 1 reply; 19+ messages in thread
From: Francesco Dolcini @ 2025-09-10 8:51 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Tom Rini, Francesco Dolcini, Łukasz Majewski, Thierry Reding,
u-boot, Stephen Warren
Hello,
On Tue, Sep 09, 2025 at 07:08:34PM +0300, Svyatoslav Ryhel wrote:
> вт, 9 вер. 2025 р. о 18:47 Tom Rini <trini@konsulko.com> пише:
> >
> ...
> > 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.
...
> Not sure if changes into colibri_t30_defconfig are needed, but if
> Francesco would like them, then ok.
I would prefer the defconfig not to be touched.
Francesco
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-10 8:51 ` Francesco Dolcini
@ 2025-09-10 12:28 ` Łukasz Majewski
2025-09-10 14:07 ` Francesco Dolcini
0 siblings, 1 reply; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-10 12:28 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Svyatoslav Ryhel, Tom Rini, Francesco Dolcini, u-boot,
Stephen Warren
Hi Francesco,
> Hello,
>
> On Tue, Sep 09, 2025 at 07:08:34PM +0300, Svyatoslav Ryhel wrote:
> > вт, 9 вер. 2025 р. о 18:47 Tom Rini <trini@konsulko.com> пише:
> > >
> > ...
> > > 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.
> ...
> > Not sure if changes into colibri_t30_defconfig are 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.
> Francesco
>
--
Best regards,
Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-10 12:28 ` Łukasz Majewski
@ 2025-09-10 14:07 ` Francesco Dolcini
2025-09-11 6:46 ` Łukasz Majewski
0 siblings, 1 reply; 19+ messages in thread
From: Francesco Dolcini @ 2025-09-10 14:07 UTC (permalink / raw)
To: Łukasz Majewski
Cc: Francesco Dolcini, Svyatoslav Ryhel, Tom Rini, Francesco Dolcini,
u-boot, Stephen Warren
On Wed, Sep 10, 2025 at 02:28:21PM +0200, Łukasz Majewski wrote:
> Hi Francesco,
>
> > Hello,
> >
> > On Tue, Sep 09, 2025 at 07:08:34PM +0300, Svyatoslav Ryhel wrote:
> > > вт, 9 вер. 2025 р. о 18:47 Tom Rini <trini@konsulko.com> пише:
> > > >
> > > ...
> > > > 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.
> > ...
> > > Not sure if changes into colibri_t30_defconfig are 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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-10 14:07 ` Francesco Dolcini
@ 2025-09-11 6:46 ` Łukasz Majewski
0 siblings, 0 replies; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-11 6:46 UTC (permalink / raw)
To: Francesco Dolcini, Tom Rini
Cc: Svyatoslav Ryhel, Francesco Dolcini, u-boot, Stephen Warren
Hi Francesco,
> On Wed, Sep 10, 2025 at 02:28:21PM +0200, Łukasz Majewski wrote:
> > Hi Francesco,
> >
> > > Hello,
> > >
> > > On Tue, Sep 09, 2025 at 07:08:34PM +0300, Svyatoslav Ryhel wrote:
> > >
> > > > вт, 9 вер. 2025 р. о 18:47 Tom Rini <trini@konsulko.com> пише:
> > > >
> > > > >
> > > > ...
> > > > > 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.
> > > ...
> > > > Not sure if changes into colibri_t30_defconfig are 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.
>
Ok, so I will prepare patch modifying colibri_t30_defconfig after the
WDT supporting patches are accepted.
> Francesco
>
>
--
Best regards,
Lukasz Majewski
--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-08-26 9:39 [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Lukasz Majewski
2025-08-26 9:39 ` [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver Lukasz Majewski
2025-08-26 10:10 ` [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Svyatoslav Ryhel
@ 2025-09-17 12:46 ` Łukasz Majewski
2025-09-17 13:40 ` Svyatoslav Ryhel
2 siblings, 1 reply; 19+ messages in thread
From: Łukasz Majewski @ 2025-09-17 12:46 UTC (permalink / raw)
To: Thierry Reding, Svyatoslav Ryhel; +Cc: Tom Rini, u-boot
Dear Community,
> 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).
>
> Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> ---
> drivers/timer/tegra-timer.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/timer/tegra-timer.c b/drivers/timer/tegra-timer.c
> index 3545424889d..361539efa43 100644
> --- a/drivers/timer/tegra-timer.c
> +++ b/drivers/timer/tegra-timer.c
> @@ -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,
> };
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: office@nabladev.com
Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed
2025-09-17 12:46 ` Łukasz Majewski
@ 2025-09-17 13:40 ` Svyatoslav Ryhel
0 siblings, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-17 13:40 UTC (permalink / raw)
To: Łukasz Majewski; +Cc: Thierry Reding, Tom Rini, u-boot
ср, 17 вер. 2025 р. о 15:46 Łukasz Majewski <lukma@nabladev.com> пише:
>
> Dear Community,
>
> > 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).
> >
You don't need to describe all this, just describe what you have done
in the patch.
> > Signed-off-by: Lukasz Majewski <lukma@nabladev.com>
> > ---
> > drivers/timer/tegra-timer.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/timer/tegra-timer.c b/drivers/timer/tegra-timer.c
> > index 3545424889d..361539efa43 100644
> > --- a/drivers/timer/tegra-timer.c
> > +++ b/drivers/timer/tegra-timer.c
> > @@ -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
remove the Tegra30 SoC, all Tegra SoC generation can use timer 5 as
watchdog, not only Tegra30
> > + * 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,
> > };
>
> 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: office@nabladev.com
> Geschftsfhrer : Stefano Babic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver
2025-08-26 9:39 ` [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver Lukasz Majewski
@ 2025-09-17 14:01 ` Svyatoslav Ryhel
0 siblings, 0 replies; 19+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-17 14:01 UTC (permalink / raw)
To: Lukasz Majewski; +Cc: Thierry Reding, Tom Rini, u-boot
вт, 26 серп. 2025 р. о 12:39 Lukasz Majewski <lukma@nabladev.com> пише:
>
> 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 <lukma@nabladev.com>
> ---
> 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
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 9e149a75e81..a10baed7232 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -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
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index d52d17e1c90..02e2674f8af 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -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
> diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
> new file mode 100644
> index 00000000000..812ec312fee
> --- /dev/null
> +++ b/drivers/watchdog/tegra_wdt.c
> @@ -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, lukma@nabladev.com
> + */
> +
> +#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
> +#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.
> + *
> + * 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.
> +
> + 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);
> +
> + 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.
> +
> + 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,
> +};
> --
> 2.39.5
>
Everything else seems to be fine. Apply those cosmetic changes and I
will pick your patches.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-09-17 14:01 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 9:39 [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Lukasz Majewski
2025-08-26 9:39 ` [PATCH 2/2] watchdog: Add implementation of NVIDIA's Tegra 30 watchdog driver Lukasz Majewski
2025-09-17 14:01 ` Svyatoslav Ryhel
2025-08-26 10:10 ` [PATCH 1/2] timer: tegra: Bind watchdog driver when timer node is processed Svyatoslav Ryhel
2025-09-08 12:41 ` Łukasz Majewski
2025-09-08 13:55 ` Svyatoslav Ryhel
2025-09-09 10:15 ` Łukasz Majewski
2025-09-09 11:26 ` Svyatoslav Ryhel
2025-09-09 15:39 ` Tom Rini
2025-09-09 15:44 ` Svyatoslav Ryhel
2025-09-09 15:47 ` Tom Rini
2025-09-09 16:08 ` Svyatoslav Ryhel
2025-09-10 8:51 ` Francesco Dolcini
2025-09-10 12:28 ` Łukasz Majewski
2025-09-10 14:07 ` Francesco Dolcini
2025-09-11 6:46 ` Łukasz Majewski
2025-09-10 6:52 ` Łukasz Majewski
2025-09-17 12:46 ` Łukasz Majewski
2025-09-17 13:40 ` Svyatoslav Ryhel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.