aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rng/Kconfig17
-rw-r--r--drivers/rng/Makefile1
-rw-r--r--drivers/rng/meson-rng.c120
-rw-r--r--drivers/serial/Makefile2
-rw-r--r--drivers/serial/serial_mcf.c (renamed from drivers/serial/mcfuart.c)4
-rw-r--r--drivers/usb/cdns3/core.c15
-rw-r--r--drivers/usb/cdns3/gadget.c2
-rw-r--r--drivers/usb/common/common.c12
-rw-r--r--drivers/usb/dwc3/dwc3-generic.c16
-rw-r--r--drivers/usb/dwc3/dwc3-meson-g12a.c2
-rw-r--r--drivers/usb/gadget/dwc2_udc_otg.c5
-rw-r--r--drivers/usb/host/dwc3-of-simple.c1
-rw-r--r--drivers/usb/host/dwc3-sti-glue.c20
-rw-r--r--drivers/usb/host/ehci-msm.c4
-rw-r--r--drivers/usb/host/ehci-mx6.c2
-rw-r--r--drivers/usb/host/xhci-dwc3.c3
-rw-r--r--drivers/usb/musb-new/ti-musb.c12
-rw-r--r--drivers/watchdog/Kconfig56
-rw-r--r--drivers/watchdog/wdt-uclass.c3
19 files changed, 206 insertions, 91 deletions
diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig
index 893b89d49b1..edb6152bb9d 100644
--- a/drivers/rng/Kconfig
+++ b/drivers/rng/Kconfig
@@ -6,16 +6,29 @@ config DM_RNG
This interface is used to initialise the rng device and to
read the random seed from the device.
+if DM_RNG
+
+config RNG_MESON
+ bool "Amlogic Meson Random Number Generator support"
+ depends on ARCH_MESON
+ default y
+ help
+ Enable support for hardware random number generator
+ of Amlogic Meson SoCs.
+
config RNG_SANDBOX
bool "Sandbox random number generator"
- depends on SANDBOX && DM_RNG
+ depends on SANDBOX
+ default y
help
Enable random number generator for sandbox. This is an
emulation of a rng device.
config RNG_STM32MP1
bool "Enable random number generator for STM32MP1"
- depends on ARCH_STM32MP && DM_RNG
+ depends on ARCH_STM32MP
default n
help
Enable STM32MP1 rng driver.
+
+endif
diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile
index 35170055415..6a8a66779b5 100644
--- a/drivers/rng/Makefile
+++ b/drivers/rng/Makefile
@@ -4,5 +4,6 @@
#
obj-$(CONFIG_DM_RNG) += rng-uclass.o
+obj-$(CONFIG_RNG_MESON) += meson-rng.o
obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o
obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o
diff --git a/drivers/rng/meson-rng.c b/drivers/rng/meson-rng.c
new file mode 100644
index 00000000000..4b81a623535
--- /dev/null
+++ b/drivers/rng/meson-rng.c
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
+ *
+ * Driver for Amlogic hardware random number generator
+ */
+
+#include <common.h>
+#include <clk.h>
+#include <dm.h>
+#include <rng.h>
+#include <asm/io.h>
+
+struct meson_rng_platdata {
+ fdt_addr_t base;
+ struct clk clk;
+};
+
+/**
+ * meson_rng_read() - fill buffer with random bytes
+ *
+ * @buffer: buffer to receive data
+ * @size: size of buffer
+ *
+ * Return: 0
+ */
+static int meson_rng_read(struct udevice *dev, void *data, size_t len)
+{
+ struct meson_rng_platdata *pdata = dev_get_platdata(dev);
+ char *buffer = (char *)data;
+
+ while (len) {
+ u32 rand = readl(pdata->base);
+ size_t step;
+
+ if (len >= 4)
+ step = 4;
+ else
+ step = len;
+ memcpy(buffer, &rand, step);
+ buffer += step;
+ len -= step;
+ }
+ return 0;
+}
+
+/**
+ * meson_rng_probe() - probe rng device
+ *
+ * @dev: device
+ * Return: 0 if ok
+ */
+static int meson_rng_probe(struct udevice *dev)
+{
+ struct meson_rng_platdata *pdata = dev_get_platdata(dev);
+ int err;
+
+ err = clk_enable(&pdata->clk);
+ if (err)
+ return err;
+
+ return 0;
+}
+
+/**
+ * meson_rng_remove() - deinitialize rng device
+ *
+ * @dev: device
+ * Return: 0 if ok
+ */
+static int meson_rng_remove(struct udevice *dev)
+{
+ struct meson_rng_platdata *pdata = dev_get_platdata(dev);
+
+ return clk_disable(&pdata->clk);
+}
+
+/**
+ * meson_rng_ofdata_to_platdata() - transfer device tree data to plaform data
+ *
+ * @dev: device
+ * Return: 0 if ok
+ */
+static int meson_rng_ofdata_to_platdata(struct udevice *dev)
+{
+ struct meson_rng_platdata *pdata = dev_get_platdata(dev);
+ int err;
+
+ pdata->base = dev_read_addr(dev);
+ if (!pdata->base)
+ return -ENODEV;
+
+ err = clk_get_by_name(dev, "core", &pdata->clk);
+ if (err)
+ return err;
+
+ return 0;
+}
+
+static const struct dm_rng_ops meson_rng_ops = {
+ .read = meson_rng_read,
+};
+
+static const struct udevice_id meson_rng_match[] = {
+ {
+ .compatible = "amlogic,meson-rng",
+ },
+ {},
+};
+
+U_BOOT_DRIVER(meson_rng) = {
+ .name = "meson-rng",
+ .id = UCLASS_RNG,
+ .of_match = meson_rng_match,
+ .ops = &meson_rng_ops,
+ .probe = meson_rng_probe,
+ .remove = meson_rng_remove,
+ .platdata_auto_alloc_size = sizeof(struct meson_rng_platdata),
+ .ofdata_to_platdata = meson_rng_ofdata_to_platdata,
+};
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index e26b64494e5..e4a92bbbb71 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -39,7 +39,7 @@ obj-$(CONFIG_COREBOOT_SERIAL) += serial_coreboot.o
obj-$(CONFIG_CORTINA_UART) += serial_cortina.o
obj-$(CONFIG_EFI_APP) += serial_efi.o
obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
-obj-$(CONFIG_MCFUART) += mcfuart.o
+obj-$(CONFIG_MCFUART) += serial_mcf.o
obj-$(CONFIG_SYS_NS16550) += ns16550.o
obj-$(CONFIG_S5P) += serial_s5p.o
obj-$(CONFIG_MXC_UART) += serial_mxc.o
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/serial_mcf.c
index 066e5a18d88..b599064b488 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/serial_mcf.c
@@ -85,6 +85,8 @@ static int coldfire_serial_probe(struct udevice *dev)
{
struct coldfire_serial_platdata *plat = dev->platdata;
+ plat->port = dev->seq;
+
return mcf_serial_init_common((uart_t *)plat->base,
plat->port, plat->baudrate);
}
@@ -148,8 +150,6 @@ static int coldfire_ofdata_to_platdata(struct udevice *dev)
return -ENODEV;
plat->base = (uint32_t)addr_base;
-
- plat->port = dev->seq;
plat->baudrate = gd->baudrate;
return 0;
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index f947e6983c0..ce846488a89 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -108,7 +108,7 @@ static int cdns3_core_init_role(struct cdns3 *cdns)
enum usb_dr_mode dr_mode;
int ret = 0;
- dr_mode = usb_get_dr_mode(dev_of_offset(dev));
+ dr_mode = usb_get_dr_mode(dev->node);
cdns->role = USB_ROLE_NONE;
/*
@@ -384,22 +384,20 @@ static const struct udevice_id cdns3_ids[] = {
int cdns3_bind(struct udevice *parent)
{
- int from = dev_of_offset(parent);
- const void *fdt = gd->fdt_blob;
enum usb_dr_mode dr_mode;
struct udevice *dev;
const char *driver;
const char *name;
- int node;
+ ofnode node;
int ret;
- node = fdt_node_offset_by_compatible(fdt, from, "cdns,usb3");
- if (node < 0) {
+ node = ofnode_by_compatible(parent->node, "cdns,usb3");
+ if (!ofnode_valid(node)) {
ret = -ENODEV;
goto fail;
}
- name = fdt_get_name(fdt, node, NULL);
+ name = ofnode_get_name(node);
dr_mode = usb_get_dr_mode(node);
switch (dr_mode) {
@@ -422,8 +420,7 @@ int cdns3_bind(struct udevice *parent)
goto fail;
};
- ret = device_bind_driver_to_node(parent, driver, name,
- offset_to_ofnode(node), &dev);
+ ret = device_bind_driver_to_node(parent, driver, name, node, &dev);
if (ret) {
printf("%s: not able to bind usb device mode\n",
__func__);
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 8377eb458b6..caed27c32f9 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -2579,7 +2579,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
if (!priv_dev->onchip_buffers)
priv_dev->onchip_buffers = 256;
- max_speed = usb_get_maximum_speed(dev_of_offset(cdns->dev));
+ max_speed = usb_get_maximum_speed(dev_ofnode(cdns->dev));
/* Check the maximum_speed parameter */
switch (max_speed) {
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index a55def5aba6..0db281b970e 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <linux/libfdt.h>
+#include <dm.h>
#include <linux/usb/otg.h>
#include <linux/usb/ch9.h>
@@ -20,13 +20,12 @@ static const char *const usb_dr_modes[] = {
[USB_DR_MODE_OTG] = "otg",
};
-enum usb_dr_mode usb_get_dr_mode(int node)
+enum usb_dr_mode usb_get_dr_mode(ofnode node)
{
- const void *fdt = gd->fdt_blob;
const char *dr_mode;
int i;
- dr_mode = fdt_getprop(fdt, node, "dr_mode", NULL);
+ dr_mode = ofnode_read_string(node, "dr_mode");
if (!dr_mode) {
pr_err("usb dr_mode not found\n");
return USB_DR_MODE_UNKNOWN;
@@ -48,13 +47,12 @@ static const char *const speed_names[] = {
[USB_SPEED_SUPER] = "super-speed",
};
-enum usb_device_speed usb_get_maximum_speed(int node)
+enum usb_device_speed usb_get_maximum_speed(ofnode node)
{
- const void *fdt = gd->fdt_blob;
const char *max_speed;
int i;
- max_speed = fdt_getprop(fdt, node, "maximum-speed", NULL);
+ max_speed = ofnode_read_string(node, "maximum-speed");
if (!max_speed) {
pr_err("usb maximum-speed not found\n");
return USB_SPEED_UNKNOWN;
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 3e116b2c5cc..febcfc0f54c 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -88,9 +88,9 @@ static int dwc3_generic_remove(struct udevice *dev,
static int dwc3_generic_ofdata_to_platdata(struct udevice *dev)
{
struct dwc3_generic_plat *plat = dev_get_platdata(dev);
- int node = dev_of_offset(dev);
+ ofnode node = dev->node;
- plat->base = devfdt_get_addr(dev);
+ plat->base = dev_read_addr(dev);
plat->maximum_speed = usb_get_maximum_speed(node);
if (plat->maximum_speed == USB_SPEED_UNKNOWN) {
@@ -284,13 +284,11 @@ struct dwc3_glue_ops ti_ops = {
static int dwc3_glue_bind(struct udevice *parent)
{
- const void *fdt = gd->fdt_blob;
- int node;
+ ofnode node;
int ret;
- for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
- node = fdt_next_subnode(fdt, node)) {
- const char *name = fdt_get_name(fdt, node, NULL);
+ ofnode_for_each_subnode(node, parent->node) {
+ const char *name = ofnode_get_name(node);
enum usb_dr_mode dr_mode;
struct udevice *dev;
const char *driver = NULL;
@@ -322,7 +320,7 @@ static int dwc3_glue_bind(struct udevice *parent)
continue;
ret = device_bind_driver_to_node(parent, driver, name,
- offset_to_ofnode(node), &dev);
+ node, &dev);
if (ret) {
debug("%s: not able to bind usb device mode\n",
__func__);
@@ -400,7 +398,7 @@ static int dwc3_glue_probe(struct udevice *dev)
while (child) {
enum usb_dr_mode dr_mode;
- dr_mode = usb_get_dr_mode(dev_of_offset(child));
+ dr_mode = usb_get_dr_mode(child->node);
device_find_next_child(&child);
if (ops && ops->select_dr_mode)
ops->select_dr_mode(dev, index, dr_mode);
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 832bcd70ff0..d4453f8784c 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -393,7 +393,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
}
#endif
- priv->otg_mode = usb_get_dr_mode(dev_of_offset(dev));
+ priv->otg_mode = usb_get_dr_mode(dev->node);
ret = dwc3_meson_g12a_usb_init(priv);
if (ret)
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 496abf38e72..b9c814cf73e 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -1039,13 +1039,12 @@ void dwc2_phy_shutdown(struct udevice *dev, struct phy *usb_phys, int num_phys)
static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
{
struct dwc2_plat_otg_data *platdata = dev_get_platdata(dev);
- int node = dev_of_offset(dev);
ulong drvdata;
void (*set_params)(struct dwc2_plat_otg_data *data);
int ret;
- if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL &&
- usb_get_dr_mode(node) != USB_DR_MODE_OTG) {
+ if (usb_get_dr_mode(dev->node) != USB_DR_MODE_PERIPHERAL &&
+ usb_get_dr_mode(dev->node) != USB_DR_MODE_OTG) {
dev_dbg(dev, "Invalid mode\n");
return -ENODEV;
}
diff --git a/drivers/usb/host/dwc3-of-simple.c b/drivers/usb/host/dwc3-of-simple.c
index 45df614b094..e4abc6f3b9b 100644
--- a/drivers/usb/host/dwc3-of-simple.c
+++ b/drivers/usb/host/dwc3-of-simple.c
@@ -12,7 +12,6 @@
#include <common.h>
#include <dm.h>
-#include <fdtdec.h>
#include <reset.h>
#include <clk.h>
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
index ad7cf6e6b53..c99a1985cca 100644
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ b/drivers/usb/host/dwc3-sti-glue.c
@@ -10,8 +10,6 @@
#include <asm/io.h>
#include <dm.h>
#include <errno.h>
-#include <fdtdec.h>
-#include <linux/libfdt.h>
#include <dm/lists.h>
#include <regmap.h>
#include <reset-uclass.h>
@@ -109,8 +107,7 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
int ret;
u32 reg[4];
- ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
- "reg", reg, ARRAY_SIZE(reg));
+ ret = ofnode_read_u32_array(dev->node, "reg", reg, ARRAY_SIZE(reg));
if (ret) {
pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
return ret;
@@ -153,18 +150,15 @@ static int sti_dwc3_glue_ofdata_to_platdata(struct udevice *dev)
static int sti_dwc3_glue_bind(struct udevice *dev)
{
struct sti_dwc3_glue_platdata *plat = dev_get_platdata(dev);
- int dwc3_node;
+ ofnode node, dwc3_node;
- /* check if one subnode is present */
- dwc3_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
- if (dwc3_node <= 0) {
- pr_err("Can't find subnode for %s\n", dev->name);
- return -ENODEV;
+ /* Find snps,dwc3 node from subnode */
+ ofnode_for_each_subnode(node, dev->node) {
+ if (ofnode_device_is_compatible(node, "snps,dwc3"))
+ dwc3_node = node;
}
- /* check if the subnode compatible string is the dwc3 one*/
- if (fdt_node_check_compatible(gd->fdt_blob, dwc3_node,
- "snps,dwc3") != 0) {
+ if (!ofnode_valid(node)) {
pr_err("Can't find dwc3 subnode for %s\n", dev->name);
return -ENODEV;
}
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 5c257ccf4d2..dd92808ff7b 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -10,8 +10,6 @@
#include <common.h>
#include <dm.h>
#include <errno.h>
-#include <fdtdec.h>
-#include <linux/libfdt.h>
#include <usb.h>
#include <usb/ehci-ci.h>
#include <usb/ulpi.h>
@@ -108,7 +106,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
struct msm_ehci_priv *priv = dev_get_priv(dev);
priv->ulpi_vp.port_num = 0;
- priv->ehci = (void *)devfdt_get_addr(dev);
+ priv->ehci = dev_read_addr_ptr(dev);
if (priv->ehci == (void *)FDT_ADDR_T_NONE)
return -EINVAL;
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 1993ad620a8..f2ceb513101 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -513,7 +513,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
struct usb_platdata *plat = dev_get_platdata(dev);
enum usb_dr_mode dr_mode;
- dr_mode = usb_get_dr_mode(dev_of_offset(dev));
+ dr_mode = usb_get_dr_mode(dev->node);
switch (dr_mode) {
case USB_DR_MODE_HOST:
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index c1c681ca6cf..9fcfa39d4b5 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -9,7 +9,6 @@
#include <common.h>
#include <dm.h>
-#include <fdtdec.h>
#include <generic-phy.h>
#include <usb.h>
#include <dwc3-uboot.h>
@@ -155,7 +154,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
writel(reg, &dwc3_reg->g_usb2phycfg[0]);
- dr_mode = usb_get_dr_mode(dev_of_offset(dev));
+ dr_mode = usb_get_dr_mode(dev->node);
if (dr_mode == USB_DR_MODE_UNKNOWN)
/* by default set dual role mode to HOST */
dr_mode = USB_DR_MODE_HOST;
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 00759f3e832..608facefa3d 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -285,14 +285,12 @@ U_BOOT_DRIVER(ti_musb_peripheral) = {
#if CONFIG_IS_ENABLED(OF_CONTROL)
static int ti_musb_wrapper_bind(struct udevice *parent)
{
- const void *fdt = gd->fdt_blob;
- int node;
+ ofnode node;
int ret;
- for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
- node = fdt_next_subnode(fdt, node)) {
+ ofnode_for_each_subnode(node, parent->node) {
struct udevice *dev;
- const char *name = fdt_get_name(fdt, node, NULL);
+ const char *name = ofnode_get_name(node);
enum usb_dr_mode dr_mode;
struct driver *drv;
@@ -306,7 +304,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
ret = device_bind_driver_to_node(parent,
"ti-musb-peripheral",
name,
- offset_to_ofnode(node),
+ node,
&dev);
if (ret)
pr_err("musb - not able to bind usb peripheral node\n");
@@ -316,7 +314,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
ret = device_bind_driver_to_node(parent,
"ti-musb-host",
name,
- offset_to_ofnode(node),
+ node,
&dev);
if (ret)
pr_err("musb - not able to bind usb host node\n");
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index d24c1e48353..cb4da2e3cf8 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -24,15 +24,15 @@ config HW_WATCHDOG
config WATCHDOG_RESET_DISABLE
bool "Disable reset watchdog"
help
- Disable reset watchdog, which can let WATCHDOG_RESET invalid, so
- that the watchdog will not be fed in u-boot.
+ Disable reset watchdog, which can let WATCHDOG_RESET invalid, so
+ that the watchdog will not be fed in u-boot.
config IMX_WATCHDOG
bool "Enable Watchdog Timer support for IMX and LSCH2 of NXP"
select HW_WATCHDOG if !WDT
help
- Select this to enable the IMX and LSCH2 of Layerscape watchdog
- driver.
+ Select this to enable the IMX and LSCH2 of Layerscape watchdog
+ driver.
config OMAP_WATCHDOG
bool "TI OMAP watchdog driver"
@@ -50,8 +50,8 @@ config DESIGNWARE_WATCHDOG
bool "Designware watchdog timer support"
select HW_WATCHDOG if !WDT
help
- Enable this to support Designware Watchdog Timer IP, present e.g.
- on Altera SoCFPGA SoCs.
+ Enable this to support Designware Watchdog Timer IP, present e.g.
+ on Altera SoCFPGA SoCs.
config WDT
bool "Enable driver model for watchdog timer drivers"
@@ -68,10 +68,10 @@ config WDT_ARMADA_37XX
bool "Marvell Armada 37xx watchdog timer support"
depends on WDT && ARMADA_3700
help
- Enable this to support Watchdog Timer on Marvell Armada 37xx SoC.
- There are 4 possible clocks which can be used on these SoCs. This
- driver uses the second clock (ID 1), assuming that so will also
- Linux's driver.
+ Enable this to support Watchdog Timer on Marvell Armada 37xx SoC.
+ There are 4 possible clocks which can be used on these SoCs. This
+ driver uses the second clock (ID 1), assuming that so will also
+ Linux's driver.
config WDT_ASPEED
bool "Aspeed ast2400/ast2500 watchdog timer support"
@@ -88,8 +88,8 @@ config WDT_AT91
bool "AT91 watchdog timer support"
depends on WDT
help
- Select this to enable Microchip watchdog timer, which can be found on
- some AT91 devices.
+ Select this to enable Microchip watchdog timer, which can be found on
+ some AT91 devices.
config WDT_BCM6345
bool "BCM6345 watchdog timer support"
@@ -105,8 +105,8 @@ config WDT_CDNS
depends on WDT
imply WATCHDOG
help
- Select this to enable Cadence watchdog timer, which can be found on some
- Xilinx Microzed Platform.
+ Select this to enable Cadence watchdog timer, which can be found on some
+ Xilinx Microzed Platform.
config WDT_CORTINA
bool "Cortina Access CAxxxx watchdog timer support"
@@ -114,21 +114,21 @@ config WDT_CORTINA
help
Cortina Access CAxxxx watchdog timer support.
This driver support all CPU ISAs supported by Cortina
- Access CAxxxx SoCs.
+ Access CAxxxx SoCs.
config WDT_MPC8xx
bool "MPC8xx watchdog timer support"
depends on WDT && MPC8xx
select HW_WATCHDOG
help
- Select this to enable mpc8xx watchdog timer
+ Select this to enable mpc8xx watchdog timer
config WDT_MT7621
bool "MediaTek MT7621 watchdog timer support"
depends on WDT && SOC_MT7628
help
- Select this to enable Ralink / Mediatek watchdog timer,
- which can be found on some MediaTek chips.
+ Select this to enable Ralink / Mediatek watchdog timer,
+ which can be found on some MediaTek chips.
config WDT_MTK
bool "MediaTek watchdog timer support"
@@ -139,10 +139,10 @@ config WDT_MTK
It performs full SoC reset.
config WDT_OMAP3
- bool "TI OMAP watchdog timer support"
- depends on WDT && ARCH_OMAP2PLUS
- default y if AM33XX
- help
+ bool "TI OMAP watchdog timer support"
+ depends on WDT && ARCH_OMAP2PLUS
+ default y if AM33XX
+ help
This enables OMAP3+ watchdog timer driver, which can be
found on some TI chipsets and inline with driver model.
@@ -151,8 +151,8 @@ config WDT_ORION
depends on WDT
select CLK
help
- Select this to enable Orion watchdog timer, which can be found on some
- Marvell Armada chips.
+ Select this to enable Orion watchdog timer, which can be found on some
+ Marvell Armada chips.
config WDT_SANDBOX
bool "Enable Watchdog Timer support for Sandbox"
@@ -166,8 +166,8 @@ config WDT_SP805
bool "SP805 watchdog timer support"
depends on WDT
help
- Select this to enable SP805 watchdog timer, which can be found on some
- nxp layerscape chips.
+ Select this to enable SP805 watchdog timer, which can be found on some
+ nxp layerscape chips.
config WDT_STM32MP
bool "IWDG watchdog driver for STM32 MP's family"
@@ -182,8 +182,8 @@ config XILINX_TB_WATCHDOG
depends on WDT
imply WATCHDOG
help
- Select this to enable Xilinx Axi watchdog timer, which can be found on some
- Xilinx Microblaze Platforms.
+ Select this to enable Xilinx Axi watchdog timer, which can be found on some
+ Xilinx Microblaze Platforms.
config WDT_TANGIER
bool "Intel Tangier watchdog timer support"
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index cf1c5274739..d9e4dc7cb8a 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -7,6 +7,7 @@
#include <dm.h>
#include <errno.h>
#include <hang.h>
+#include <time.h>
#include <wdt.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
@@ -83,7 +84,7 @@ void watchdog_reset(void)
/* Do not reset the watchdog too often */
now = get_timer(0);
- if (now > next_reset) {
+ if (time_after(now, next_reset)) {
next_reset = now + 1000; /* reset every 1000ms */
wdt_reset(gd->watchdog_dev);
}