Skip to contentSkip to conversation

Xilinx Axi Watchdog driver conversion to driver model

PATCH New Shreenidhi Shedi 3 participants 7 messages Jul 14, 2018 – Jul 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Xilinx Axi Watchdog driver conversion to driver model

[PATCH 1/3] Removed a bunch of WATCHDOG related macros [PATCH 2/3] Support for watchdog_reset function for Microblaze init [PATCH 3/3] Xilinx Axi watchdog driver to driver model

Changes in v2:
- Appropriate commit messages for each patch
- Cosmetic changes patch is taken out
- Changes in xilinx_tb_wdt.c based on review comments

Shreenidhi Shedi (3):
microblaze: Delete Xilinx watchdog related macros
microblaze: Support for watchdog_reset in Microblaze init
watchdog: Convert Xilinx Axi watchdog driver to driver model

 .../microblaze-generic/microblaze-generic.c   |  42 ++++++-
 board/xilinx/microblaze-generic/xparameters.h |   4 -
 drivers/watchdog/Kconfig                      |   8 ++
 drivers/watchdog/xilinx_tb_wdt.c              | 105 ++++++++++++++----
 include/configs/microblaze-generic.h          |  10 --
 5 files changed, 127 insertions(+), 42 deletions(-)

--
2.17.1

#1 lore raw

PATCH v2 1/3 microblaze: Delete Xilinx watchdog related macros

Tested-by monstr at monstr.eu
Reviewed-by monstr at monstr.eu

These macros are not required anymore. These will be taken from configuration file.

Changes in V1:
- Removed reduntant macros.

Changes in V2:
- Added appropriate commit message.

---

Changes in v2:
- Appropriate commit messages for each patch
- Cosmetic changes patch is taken out
- Changes in xilinx_tb_wdt.c based on review comments

 board/xilinx/microblaze-generic/xparameters.h |  4 ----
 include/configs/microblaze-generic.h          | 10 ----------
 2 files changed, 14 deletions(-)
board/xilinx/microblaze-generic/xparameters.h +0 -4
index 51bca40e34..43aad1f8b0 100644
@@ -21,7 +21,3 @@
 /* Flash Memory is FLASH_2Mx32 */
 #define XILINX_FLASH_START	0x2c000000
 #define XILINX_FLASH_SIZE	0x00800000
-
-/* Watchdog IP is wxi_timebase_wdt_0 */
-#define XILINX_WATCHDOG_BASEADDR	0x50000000
-#define XILINX_WATCHDOG_IRQ		1
include/configs/microblaze-generic.h +0 -10
index 966feeeafd..212debc102 100644
@@ -43,16 +43,6 @@
 # define CONFIG_SYS_GPIO_0_ADDR		XILINX_GPIO_BASEADDR
 #endif
 
-/* watchdog */
-#if defined(XILINX_WATCHDOG_BASEADDR) && defined(XILINX_WATCHDOG_IRQ)
-# define CONFIG_WATCHDOG_BASEADDR	XILINX_WATCHDOG_BASEADDR
-# define CONFIG_WATCHDOG_IRQ		XILINX_WATCHDOG_IRQ
-# ifndef CONFIG_SPL_BUILD
-#  define CONFIG_HW_WATCHDOG
-#  define CONFIG_XILINX_TB_WATCHDOG
-# endif
-#endif
-
 #define CONFIG_SYS_MALLOC_LEN	0xC0000
 
 /* Stack location before relocation */
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/3 microblaze: Support for watchdog_reset in Microblaze init

In reply to Shreenidhi Shedi

We should support watchdog reset so that WATCHDOG_RESET will function properly.

Changes in V1:
- Watchdog reset support, inorder to get WATCHDOG_RESET macro working

Changes in V2:
- Moving wdt.h out of ifdef clause
- Using CONFIG_WDT & CONFIG_WATCHDOG based on review comments

---

Changes in v2: None

 .../microblaze-generic/microblaze-generic.c   | 42 +++++++++++++++++--
 1 file changed, 38 insertions(+), 4 deletions(-)
board/xilinx/microblaze-generic/microblaze-generic.c +38 -4
index 889695f80e..f05a63d692 100644
@@ -15,6 +15,8 @@
 #include <asm/microblaze_intc.h>
 #include <asm/asm.h>
 #include <asm/gpio.h>
+#include <dm/uclass.h>
+#include <wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -22,6 +24,10 @@ DECLARE_GLOBAL_DATA_PTR;
 static int reset_pin = -1;
 #endif
 
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
+static struct udevice *watchdog_dev;
+#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
+
 ulong ram_base;
 
 int dram_init_banksize(void)
@@ -66,10 +72,6 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (reset_pin != -1)
 		gpio_direction_output(reset_pin, 1);
 #endif
-
-#ifdef CONFIG_XILINX_TB_WATCHDOG
-	hw_watchdog_disable();
-#endif
 #endif
 	puts ("Reseting board\n");
 	__asm__ __volatile__ ("	mts rmsr, r0;" \
@@ -89,9 +91,41 @@ static int gpio_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_WDT
+/* Called by macro WATCHDOG_RESET */
+void watchdog_reset(void)
+{
+#if !defined(CONFIG_SPL_BUILD)
+	ulong now;
+	static ulong next_reset;
+
+	if (!watchdog_dev)
+		return;
+
+	now = timer_get_us();
+
+	/* Do not reset the watchdog too often */
+	if (now > next_reset) {
+		wdt_reset(watchdog_dev);
+		next_reset = now + 1000;
+	}
+#endif /* !CONFIG_SPL_BUILD */
+}
+#endif /* CONFIG_WDT */
+
 int board_late_init(void)
 {
 	gpio_init();
 
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
+	watchdog_dev = NULL;
+	if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
+		puts("Watchdog: Not found!\n");
+	} else {
+		wdt_start(watchdog_dev, 0, 0);
+		puts("Watchdog: Started\n");
+	}
+#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
+
 	return 0;
 }
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/3 watchdog: Convert Xilinx Axi watchdog driver to driver model

In reply to Shreenidhi Shedi

Xilinx Axi wdt driver conversion to driver model & Kconfig update for the same.

Changes in V1:
- Xilinx Axi wdt driver conversion to DM initial version

Changes in V2:
- Rectified print message
- Removed stop instruction from probe

---

Changes in v2: None

 drivers/watchdog/Kconfig         |   8 +++
 drivers/watchdog/xilinx_tb_wdt.c | 105 ++++++++++++++++++++++++-------
 2 files changed, 89 insertions(+), 24 deletions(-)
drivers/watchdog/Kconfig +8 -0
index 148c6a0d68..351d2af8d9 100644
@@ -103,4 +103,12 @@ config WDT_CDNS
 	   Select this to enable Cadence watchdog timer, which can be found on some
 	   Xilinx Microzed Platform.
 
+config XILINX_TB_WATCHDOG
+	bool "Xilinx Axi watchdog timer support"
+	depends on WDT
+	imply WATCHDOG
+	help
+	   Select this to enable Xilinx Axi watchdog timer, which can be found on some
+	   Xilinx Microblaze Platform.
+
 endmenu
drivers/watchdog/xilinx_tb_wdt.c +81 -24

143 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 3/3 watchdog: Convert Xilinx Axi watchdog driver to driver model

Hi Shreenidhi,

Quoted 24 lines · Shreenidhi Shedi

Xilinx Axi wdt driver conversion to driver model & Kconfig update for the same.

Changes in V1:
- Xilinx Axi wdt driver conversion to DM initial version

Changes in V2:
- Rectified print message
- Removed stop instruction from probe

---

Changes in v2: None

 drivers/watchdog/Kconfig         |   8 +++
 drivers/watchdog/xilinx_tb_wdt.c | 105 ++++++++++++++++++++++++-------
 2 files changed, 89 insertions(+), 24 deletions(-)
drivers/watchdog/Kconfig +0 -0
index 148c6a0d68..351d2af8d9 100644

drivers/watchdog/Kconfig config WDT_CDNS · line 112

Quoted 10 lines
drivers/watchdog/Kconfig +7 -0
@@ -103,4 +103,12 @@ config WDT_CDNS
           Select this to enable Cadence watchdog timer, which can be found on some
           Xilinx Microzed Platform.
 
+config XILINX_TB_WATCHDOG
+       bool "Xilinx Axi watchdog timer support"
+       depends on WDT
+       imply WATCHDOG
+       help
+          Select this to enable Xilinx Axi watchdog timer, which can be found on some
+          Xilinx Microblaze Platform.

platforms?

Quoted 31 lines
drivers/watchdog/Kconfig +1 -0
+
 endmenu
drivers/watchdog/xilinx_tb_wdt.c +8 -4
index 2274123e49..23ddbdfbee 100644
@@ -1,13 +1,17 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Xilinx Axi platforms watchdog timer driver.
+ *
+ * Author(s):  Michal Å imek <[email protected]>
+ *             Shreenidhi Shedi <[email protected]>
+ *
  * Copyright (c) 2011-2013 Xilinx Inc.
  */
 
 #include <common.h>
-#include <asm/io.h>
-#include <asm/microblaze_intc.h>
-#include <asm/processor.h>
-#include <watchdog.h>
+#include <dm.h>
+#include <wdt.h>
+#include <linux/io.h>
 
 #define XWT_CSR0_WRS_MASK      0x00000008 /* Reset status Mask */
 #define XWT_CSR0_WDS_MASK      0x00000004 /* Timer state Mask */
@@ -20,49 +24,102 @@ struct watchdog_regs {
        u32 tbr; /* 0x8 */
 };

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 32

Quoted 10 lines
drivers/watchdog/xilinx_tb_wdt.c +5 -3
 
-static struct watchdog_regs *watchdog_base =
-                       (struct watchdog_regs *)CONFIG_WATCHDOG_BASEADDR;
+struct xlnx_wdt_priv {
+       bool enable_once;
+       struct watchdog_regs *regs;
+};
 
-void hw_watchdog_reset(void)
+static int xlnx_wdt_reset(struct udevice *dev)

You could pass just regs to this function? Same below.

Quoted 16 lines
drivers/watchdog/xilinx_tb_wdt.c +7 -2
 {
        u32 reg;
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       debug("%s\n", __func__);
 
        /* Read the current contents of TCSR0 */
-       reg = readl(&watchdog_base->twcsr0);
+       reg = readl(&priv->regs->twcsr0);
 
        /* Clear the watchdog WDS bit */
        if (reg & (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK))
-               writel(reg | XWT_CSR0_WDS_MASK, &watchdog_base->twcsr0);
+               writel(reg | XWT_CSR0_WDS_MASK, &priv->regs->twcsr0);
+
+       return 0;

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 55

Quoted 10 lines
drivers/watchdog/xilinx_tb_wdt.c +5 -1
 }
 
-void hw_watchdog_disable(void)
+static int xlnx_wdt_stop(struct udevice *dev)
 {
        u32 reg;
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       if (priv->enable_once) {
+               puts("Can't stop Xilinx watchdog.\n");

debug()

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 56

Quoted 1 line
drivers/watchdog/xilinx_tb_wdt.c +1 -0
+               return -1;

return -EBUSY

-1 is -EPERM which might not be correct.

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 65

Quoted 12 lines
drivers/watchdog/xilinx_tb_wdt.c +4 -3
+       }
 
        /* Read the current contents of TCSR0 */
-       reg = readl(&watchdog_base->twcsr0);
+       reg = readl(&priv->regs->twcsr0);
 
-       writel(reg & ~XWT_CSR0_EWDT1_MASK, &watchdog_base->twcsr0);
-       writel(~XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1);
+       writel(reg & ~XWT_CSR0_EWDT1_MASK, &priv->regs->twcsr0);
+       writel(~XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1);
 
        puts("Watchdog disabled!\n");

Drivers should not output to the console.

Quoted 34 lines
drivers/watchdog/xilinx_tb_wdt.c +15 -11
+
+       return 0;
 }
 
-static void hw_watchdog_isr(void *arg)
+static int xlnx_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
 {
-       hw_watchdog_reset();
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK),
+              &priv->regs->twcsr0);
+
+       writel(XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1);
+
+       return 0;
 }
 
-void hw_watchdog_init(void)
+static int xlnx_wdt_probe(struct udevice *dev)
 {
-       int ret;
+       debug("%s: Probing wdt%u\n", __func__, dev->seq);
 
-       writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK),
-              &watchdog_base->twcsr0);
-       writel(XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1);
+       return 0;
+}
 
-       ret = install_interrupt_handler(CONFIG_WATCHDOG_IRQ,
-                                               hw_watchdog_isr, NULL);
-       if (ret)
-               puts("Watchdog IRQ registration failed.");

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 98

Quoted 10 lines
drivers/watchdog/xilinx_tb_wdt.c +10 -0
+static int xlnx_wdt_ofdata_to_platdata(struct udevice *dev)
+{
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       priv->regs = (struct watchdog_regs *)dev_read_addr(dev);
+       if (IS_ERR(priv->regs))
+               return PTR_ERR(priv->regs);
+
+       priv->enable_once = dev_read_u32_default(dev, "xlnx,wdt-enable-once",
+                                                0);

Should that not be dev_read_bool()? Does it actually using an integer to indicate a boolean? Is there a binding file for this?

Quoted 28 lines
drivers/watchdog/xilinx_tb_wdt.c +26 -1
+
+       debug("%s: wdt-enable-once %d\n", __func__, priv->enable_once);
+
+       return 0;
 }
+
+static const struct wdt_ops xlnx_wdt_ops = {
+       .start = xlnx_wdt_start,
+       .reset = xlnx_wdt_reset,
+       .stop = xlnx_wdt_stop,
+};
+
+static const struct udevice_id xlnx_wdt_ids[] = {
+       { .compatible = "xlnx,xps-timebase-wdt-1.00.a", },
+       { .compatible = "xlnx,xps-timebase-wdt-1.01.a", },
+       {},
+};
+
+U_BOOT_DRIVER(xlnx_wdt) = {
+       .name = "xlnx_wdt",
+       .id = UCLASS_WDT,
+       .of_match = xlnx_wdt_ids,
+       .probe = xlnx_wdt_probe,
+       .priv_auto_alloc_size = sizeof(struct xlnx_wdt_priv),
+       .ofdata_to_platdata = xlnx_wdt_ofdata_to_platdata,
+       .ops = &xlnx_wdt_ops,
+};
--
Quoted 2 lines

2.17.1

Regards,
Simon

#5 lore raw

PATCH v2 3/3 watchdog: Convert Xilinx Axi watchdog driver to driver model

Hi Simon,

Quoted 30 lines · Simon Glass

Hi Shreenidhi,

Quoted 27 lines · Shreenidhi Shedi

Xilinx Axi wdt driver conversion to driver model & Kconfig update for the same.

Changes in V1:
- Xilinx Axi wdt driver conversion to DM initial version

Changes in V2:
- Rectified print message
- Removed stop instruction from probe

---

Changes in v2: None

 drivers/watchdog/Kconfig         |   8 +++
 drivers/watchdog/xilinx_tb_wdt.c | 105 ++++++++++++++++++++++++-------
 2 files changed, 89 insertions(+), 24 deletions(-)
drivers/watchdog/Kconfig +0 -0
index 148c6a0d68..351d2af8d9 100644
@@ -103,4 +103,12 @@ config WDT_CDNS
           Select this to enable Cadence watchdog timer, which can be found on some
           Xilinx Microzed Platform.
 
Quoted 9 lines

drivers/watchdog/Kconfig config WDT_CDNS · line 112

Quoted 7 lines
drivers/watchdog/Kconfig +7 -0
+config XILINX_TB_WATCHDOG
+       bool "Xilinx Axi watchdog timer support"
+       depends on WDT
+       imply WATCHDOG
+       help
+          Select this to enable Xilinx Axi watchdog timer, which can be found on some
+          Xilinx Microblaze Platform.

platforms?

will fix.

Quoted 40 lines
Quoted 40 lines
drivers/watchdog/Kconfig +1 -0
+
 endmenu
drivers/watchdog/xilinx_tb_wdt.c +12 -6
index 2274123e49..23ddbdfbee 100644
@@ -1,13 +1,17 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Xilinx Axi platforms watchdog timer driver.
+ *
+ * Author(s):  Michal Å imek <[email protected]>
+ *             Shreenidhi Shedi <[email protected]>
+ *
  * Copyright (c) 2011-2013 Xilinx Inc.
  */
 
 #include <common.h>
-#include <asm/io.h>
-#include <asm/microblaze_intc.h>
-#include <asm/processor.h>
-#include <watchdog.h>
+#include <dm.h>
+#include <wdt.h>
+#include <linux/io.h>
 
 #define XWT_CSR0_WRS_MASK      0x00000008 /* Reset status Mask */
 #define XWT_CSR0_WDS_MASK      0x00000004 /* Timer state Mask */
@@ -20,49 +24,102 @@ struct watchdog_regs {
        u32 tbr; /* 0x8 */
 };
 
-static struct watchdog_regs *watchdog_base =
-                       (struct watchdog_regs *)CONFIG_WATCHDOG_BASEADDR;
+struct xlnx_wdt_priv {
+       bool enable_once;
+       struct watchdog_regs *regs;
+};
 
Quoted 4 lines

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 32

Quoted 2 lines
drivers/watchdog/xilinx_tb_wdt.c +1 -1
-void hw_watchdog_reset(void)
+static int xlnx_wdt_reset(struct udevice *dev)

You could pass just regs to this function? Same below.

I don't think so. This function is the part of struct wdt_ops{} which is

82 /*

 83          * Reset the timer, typically restoring the counter to
 84          * the value configured by start()
 85          *
 86          * @dev: WDT Device
 87          * @return: 0 if OK, -ve on error
 88          */

89 int (*reset)(struct udevice *dev);

Quoted 19 lines
Quoted 19 lines
drivers/watchdog/xilinx_tb_wdt.c +7 -2
 {
        u32 reg;
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       debug("%s\n", __func__);
 
        /* Read the current contents of TCSR0 */
-       reg = readl(&watchdog_base->twcsr0);
+       reg = readl(&priv->regs->twcsr0);
 
        /* Clear the watchdog WDS bit */
        if (reg & (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK))
-               writel(reg | XWT_CSR0_WDS_MASK, &watchdog_base->twcsr0);
+               writel(reg | XWT_CSR0_WDS_MASK, &priv->regs->twcsr0);
+
+       return 0;
 }
 
Quoted 10 lines

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 55

Quoted 8 lines
drivers/watchdog/xilinx_tb_wdt.c +5 -1
-void hw_watchdog_disable(void)
+static int xlnx_wdt_stop(struct udevice *dev)
 {
        u32 reg;
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       if (priv->enable_once) {
+               puts("Can't stop Xilinx watchdog.\n");

debug()

will fix

Quoted 6 lines

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 56

Quoted 2 lines
drivers/watchdog/xilinx_tb_wdt.c +1 -0
+               return -1;

return -EBUSY

-1 is -EPERM which might not be correct.

will fix

Quoted 7 lines
Quoted 7 lines
drivers/watchdog/xilinx_tb_wdt.c +2 -1
+       }
 
        /* Read the current contents of TCSR0 */
-       reg = readl(&watchdog_base->twcsr0);
+       reg = readl(&priv->regs->twcsr0);
 
Quoted 8 lines

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 65

Quoted 6 lines
drivers/watchdog/xilinx_tb_wdt.c +2 -2
-       writel(reg & ~XWT_CSR0_EWDT1_MASK, &watchdog_base->twcsr0);
-       writel(~XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1);
+       writel(reg & ~XWT_CSR0_EWDT1_MASK, &priv->regs->twcsr0);
+       writel(~XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1);
 
        puts("Watchdog disabled!\n");

Drivers should not output to the console.

debug is fine here.

Quoted 40 lines
Quoted 40 lines
drivers/watchdog/xilinx_tb_wdt.c +20 -11
+
+       return 0;
 }
 
-static void hw_watchdog_isr(void *arg)
+static int xlnx_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
 {
-       hw_watchdog_reset();
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK),
+              &priv->regs->twcsr0);
+
+       writel(XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1);
+
+       return 0;
 }
 
-void hw_watchdog_init(void)
+static int xlnx_wdt_probe(struct udevice *dev)
 {
-       int ret;
+       debug("%s: Probing wdt%u\n", __func__, dev->seq);
 
-       writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK),
-              &watchdog_base->twcsr0);
-       writel(XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1);
+       return 0;
+}
 
-       ret = install_interrupt_handler(CONFIG_WATCHDOG_IRQ,
-                                               hw_watchdog_isr, NULL);
-       if (ret)
-               puts("Watchdog IRQ registration failed.");
+static int xlnx_wdt_ofdata_to_platdata(struct udevice *dev)
+{
+       struct xlnx_wdt_priv *priv = dev_get_priv(dev);
+
+       priv->regs = (struct watchdog_regs *)dev_read_addr(dev);
Quoted 8 lines

drivers/watchdog/xilinx_tb_wdt.c struct watchdog_regs { · line 98

Quoted 5 lines
drivers/watchdog/xilinx_tb_wdt.c +5 -0
+       if (IS_ERR(priv->regs))
+               return PTR_ERR(priv->regs);
+
+       priv->enable_once = dev_read_u32_default(dev, "xlnx,wdt-enable-once",
+                                                0);

Should that not be dev_read_bool()? Does it actually using an integer to indicate a boolean? Is there a binding file for this?

Unfortunately no. It is pretty old binding and it wasn't defined as bool. Here is binding doc.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/watchdog/of-xilinx-wdt.txt

Quoted 23 lines
Quoted 23 lines
drivers/watchdog/xilinx_tb_wdt.c +21 -0
+
+       debug("%s: wdt-enable-once %d\n", __func__, priv->enable_once);
+
+       return 0;
 }
+
+static const struct wdt_ops xlnx_wdt_ops = {
+       .start = xlnx_wdt_start,
+       .reset = xlnx_wdt_reset,
+       .stop = xlnx_wdt_stop,
+};
+
+static const struct udevice_id xlnx_wdt_ids[] = {
+       { .compatible = "xlnx,xps-timebase-wdt-1.00.a", },
+       { .compatible = "xlnx,xps-timebase-wdt-1.01.a", },
+       {},
+};
+
+U_BOOT_DRIVER(xlnx_wdt) = {
+       .name = "xlnx_wdt",
+       .id = UCLASS_WDT,
+       .of_match = xlnx_wdt_ids,
Quoted 8 lines
Quoted 8 lines
drivers/watchdog/xilinx_tb_wdt.c +5 -1
+       .probe = xlnx_wdt_probe,
+       .priv_auto_alloc_size = sizeof(struct xlnx_wdt_priv),
+       .ofdata_to_platdata = xlnx_wdt_ofdata_to_platdata,
+       .ops = &xlnx_wdt_ops,
+};
--

2.17.1

Thanks,
Michal

#6 lore raw

v2 cover Xilinx Axi Watchdog driver conversion to driver model

In reply to Shreenidhi Shedi
Quoted 23 lines · Shreenidhi Shedi

[PATCH 1/3] Removed a bunch of WATCHDOG related macros [PATCH 2/3] Support for watchdog_reset function for Microblaze init [PATCH 3/3] Xilinx Axi watchdog driver to driver model

Changes in v2:
- Appropriate commit messages for each patch
- Cosmetic changes patch is taken out
- Changes in xilinx_tb_wdt.c based on review comments

Shreenidhi Shedi (3):
microblaze: Delete Xilinx watchdog related macros
microblaze: Support for watchdog_reset in Microblaze init
watchdog: Convert Xilinx Axi watchdog driver to driver model

 .../microblaze-generic/microblaze-generic.c   |  42 ++++++-
 board/xilinx/microblaze-generic/xparameters.h |   4 -
 drivers/watchdog/Kconfig                      |   8 ++
 drivers/watchdog/xilinx_tb_wdt.c              | 105 ++++++++++++++----
 include/configs/microblaze-generic.h          |  10 --
 5 files changed, 127 insertions(+), 42 deletions(-)
Quoted 3 lines

--
2.17.1

There are several issues. I have taken your series and clean it up a little bit and send v3. Please take a look at that changes I made.

Thanks,
Michal