* [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command
@ 2017-03-03 0:01 Lukasz Majewski
2017-03-03 3:18 ` Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2017-03-03 0:01 UTC (permalink / raw)
To: u-boot
Add support for "wdt disable" command necessary for disabling the watchdog
timer.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
cmd/Kconfig | 6 ++++++
cmd/Makefile | 2 ++
cmd/wdt.c | 32 ++++++++++++++++++++++++++++++++
include/watchdog.h | 2 ++
4 files changed, 42 insertions(+)
create mode 100644 cmd/wdt.c
diff --git a/cmd/Kconfig b/cmd/Kconfig
index e339d86..293e0bb 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -426,6 +426,12 @@ config CMD_REMOTEPROC
help
Support for Remote Processor control
+config CMD_WDT
+ bool "wdt"
+ default n
+ help
+ Enables the "wdt" command, which is used to control a watchdog timer.
+
config CMD_GPIO
bool "gpio"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 9c9a9d1..4934427 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -157,6 +157,8 @@ obj-$(CONFIG_CMD_ETHSW) += ethsw.o
# Power
obj-$(CONFIG_CMD_PMIC) += pmic.o
obj-$(CONFIG_CMD_REGULATOR) += regulator.o
+
+obj-$(CONFIG_CMD_WDT) += wdt.o
endif # !CONFIG_SPL_BUILD
obj-$(CONFIG_CMD_BLOB) += blob.o
diff --git a/cmd/wdt.c b/cmd/wdt.c
new file mode 100644
index 0000000..aeaa9c2
--- /dev/null
+++ b/cmd/wdt.c
@@ -0,0 +1,32 @@
+/*
+ * wdt.c -- Watchdog support command
+ *
+ * Copyright (C) 2017
+ * Lukasz Majewski, DENX Software Engineering, lukma at denx.de.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <watchdog.h>
+
+static int do_wdt(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ int ret = CMD_RET_SUCCESS;
+
+ if (argc < 2 || argc > 2)
+ return CMD_RET_USAGE;
+
+ if (!strcmp(argv[1], "disable")) {
+ WATCHDOG_DISABLE();
+ printf("WDT disabled\n");
+ }
+
+ return ret;
+}
+
+U_BOOT_CMD(wdt, CONFIG_SYS_MAXARGS, 1, do_wdt,
+ "Watchdog (wdt)",
+ "disable - disable watchdog\n"
+);
diff --git a/include/watchdog.h b/include/watchdog.h
index 174c894..b0716c5 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -41,8 +41,10 @@ int init_func_watchdog_reset(void);
#define WATCHDOG_RESET bl hw_watchdog_reset
#else
extern void hw_watchdog_reset(void);
+ void hw_watchdog_disable(void);
#define WATCHDOG_RESET hw_watchdog_reset
+ #define WATCHDOG_DISABLE hw_watchdog_disable
#endif /* __ASSEMBLY__ */
#else
/*
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command
2017-03-03 0:01 [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command Lukasz Majewski
@ 2017-03-03 3:18 ` Tom Rini
2017-03-03 8:46 ` Lukasz Majewski
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2017-03-03 3:18 UTC (permalink / raw)
To: u-boot
On Fri, Mar 03, 2017 at 01:01:11AM +0100, Lukasz Majewski wrote:
> Add support for "wdt disable" command necessary for disabling the watchdog
> timer.
>
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> ---
> cmd/Kconfig | 6 ++++++
> cmd/Makefile | 2 ++
> cmd/wdt.c | 32 ++++++++++++++++++++++++++++++++
> include/watchdog.h | 2 ++
> 4 files changed, 42 insertions(+)
> create mode 100644 cmd/wdt.c
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index e339d86..293e0bb 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -426,6 +426,12 @@ config CMD_REMOTEPROC
> help
> Support for Remote Processor control
>
> +config CMD_WDT
> + bool "wdt"
> + default n
No need for default n, that is the default.
> + help
> + Enables the "wdt" command, which is used to control a watchdog timer.
> +
> config CMD_GPIO
> bool "gpio"
> help
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 9c9a9d1..4934427 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -157,6 +157,8 @@ obj-$(CONFIG_CMD_ETHSW) += ethsw.o
> # Power
> obj-$(CONFIG_CMD_PMIC) += pmic.o
> obj-$(CONFIG_CMD_REGULATOR) += regulator.o
> +
> +obj-$(CONFIG_CMD_WDT) += wdt.o
> endif # !CONFIG_SPL_BUILD
>
> obj-$(CONFIG_CMD_BLOB) += blob.o
> diff --git a/cmd/wdt.c b/cmd/wdt.c
> new file mode 100644
> index 0000000..aeaa9c2
> --- /dev/null
> +++ b/cmd/wdt.c
> @@ -0,0 +1,32 @@
> +/*
> + * wdt.c -- Watchdog support command
> + *
> + * Copyright (C) 2017
> + * Lukasz Majewski, DENX Software Engineering, lukma at denx.de.
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <watchdog.h>
> +
> +static int do_wdt(cmd_tbl_t *cmdtp, int flag, int argc,
> + char * const argv[])
> +{
> + int ret = CMD_RET_SUCCESS;
> +
> + if (argc < 2 || argc > 2)
> + return CMD_RET_USAGE;
> +
> + if (!strcmp(argv[1], "disable")) {
> + WATCHDOG_DISABLE();
> + printf("WDT disabled\n");
> + }
> +
> + return ret;
> +}
> +
> +U_BOOT_CMD(wdt, CONFIG_SYS_MAXARGS, 1, do_wdt,
> + "Watchdog (wdt)",
> + "disable - disable watchdog\n"
> +);
> diff --git a/include/watchdog.h b/include/watchdog.h
> index 174c894..b0716c5 100644
> --- a/include/watchdog.h
> +++ b/include/watchdog.h
> @@ -41,8 +41,10 @@ int init_func_watchdog_reset(void);
> #define WATCHDOG_RESET bl hw_watchdog_reset
> #else
> extern void hw_watchdog_reset(void);
> + void hw_watchdog_disable(void);
>
> #define WATCHDOG_RESET hw_watchdog_reset
> + #define WATCHDOG_DISABLE hw_watchdog_disable
> #endif /* __ASSEMBLY__ */
> #else
> /*
Can we add other commands, enable (calling _init() or _reset(),
I'm not sure which off the top of my head) as well? And we may want to
think how to handle that only "omap" and "xilinx_tb" support the
_disable function today.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170302/1777b312/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command
2017-03-03 3:18 ` Tom Rini
@ 2017-03-03 8:46 ` Lukasz Majewski
2017-03-03 12:19 ` Tom Rini
0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2017-03-03 8:46 UTC (permalink / raw)
To: u-boot
Hi Tom,
> On Fri, Mar 03, 2017 at 01:01:11AM +0100, Lukasz Majewski wrote:
>
> > Add support for "wdt disable" command necessary for disabling the
> > watchdog timer.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> > cmd/Kconfig | 6 ++++++
> > cmd/Makefile | 2 ++
> > cmd/wdt.c | 32 ++++++++++++++++++++++++++++++++
> > include/watchdog.h | 2 ++
> > 4 files changed, 42 insertions(+)
> > create mode 100644 cmd/wdt.c
> >
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index e339d86..293e0bb 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -426,6 +426,12 @@ config CMD_REMOTEPROC
> > help
> > Support for Remote Processor control
> >
> > +config CMD_WDT
> > + bool "wdt"
> > + default n
>
> No need for default n, that is the default.
Ach... ok.
>
> > + help
> > + Enables the "wdt" command, which is used to control a
> > watchdog timer. +
> > config CMD_GPIO
> > bool "gpio"
> > help
> > diff --git a/cmd/Makefile b/cmd/Makefile
> > index 9c9a9d1..4934427 100644
> > --- a/cmd/Makefile
> > +++ b/cmd/Makefile
> > @@ -157,6 +157,8 @@ obj-$(CONFIG_CMD_ETHSW) += ethsw.o
> > # Power
> > obj-$(CONFIG_CMD_PMIC) += pmic.o
> > obj-$(CONFIG_CMD_REGULATOR) += regulator.o
> > +
> > +obj-$(CONFIG_CMD_WDT) += wdt.o
> > endif # !CONFIG_SPL_BUILD
> >
> > obj-$(CONFIG_CMD_BLOB) += blob.o
> > diff --git a/cmd/wdt.c b/cmd/wdt.c
> > new file mode 100644
> > index 0000000..aeaa9c2
> > --- /dev/null
> > +++ b/cmd/wdt.c
> > @@ -0,0 +1,32 @@
> > +/*
> > + * wdt.c -- Watchdog support command
> > + *
> > + * Copyright (C) 2017
> > + * Lukasz Majewski, DENX Software Engineering, lukma at denx.de.
> > + *
> > + * SPDX-License-Identifier: GPL-2.0+
> > + */
> > +
> > +#include <common.h>
> > +#include <watchdog.h>
> > +
> > +static int do_wdt(cmd_tbl_t *cmdtp, int flag, int argc,
> > + char * const argv[])
> > +{
> > + int ret = CMD_RET_SUCCESS;
> > +
> > + if (argc < 2 || argc > 2)
> > + return CMD_RET_USAGE;
> > +
> > + if (!strcmp(argv[1], "disable")) {
> > + WATCHDOG_DISABLE();
> > + printf("WDT disabled\n");
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +U_BOOT_CMD(wdt, CONFIG_SYS_MAXARGS, 1, do_wdt,
> > + "Watchdog (wdt)",
> > + "disable - disable watchdog\n"
> > +);
> > diff --git a/include/watchdog.h b/include/watchdog.h
> > index 174c894..b0716c5 100644
> > --- a/include/watchdog.h
> > +++ b/include/watchdog.h
> > @@ -41,8 +41,10 @@ int init_func_watchdog_reset(void);
> > #define WATCHDOG_RESET bl hw_watchdog_reset
> > #else
> > extern void hw_watchdog_reset(void);
> > + void hw_watchdog_disable(void);
> >
> > #define WATCHDOG_RESET hw_watchdog_reset
> > + #define WATCHDOG_DISABLE hw_watchdog_disable
> > #endif /* __ASSEMBLY__ */
> > #else
> > /*
>
> Can we add other commands, enable (calling _init() or _reset(),
> I'm not sure which off the top of my head) as well?
OK, I will think about adding such code.
> And we may want
> to think how to handle that only "omap" and "xilinx_tb" support the
> _disable function today.
>
The problem with WDT is that it is a "legacy" code, used by many boards
and in many places. We do need to be careful here ....
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170303/88fe80a3/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command
2017-03-03 8:46 ` Lukasz Majewski
@ 2017-03-03 12:19 ` Tom Rini
0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-03-03 12:19 UTC (permalink / raw)
To: u-boot
On Fri, Mar 03, 2017 at 09:46:37AM +0100, Lukasz Majewski wrote:
> Hi Tom,
>
> > On Fri, Mar 03, 2017 at 01:01:11AM +0100, Lukasz Majewski wrote:
> >
> > > Add support for "wdt disable" command necessary for disabling the
> > > watchdog timer.
> > >
> > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > ---
> > > cmd/Kconfig | 6 ++++++
> > > cmd/Makefile | 2 ++
> > > cmd/wdt.c | 32 ++++++++++++++++++++++++++++++++
> > > include/watchdog.h | 2 ++
> > > 4 files changed, 42 insertions(+)
> > > create mode 100644 cmd/wdt.c
> > >
> > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > index e339d86..293e0bb 100644
> > > --- a/cmd/Kconfig
> > > +++ b/cmd/Kconfig
> > > @@ -426,6 +426,12 @@ config CMD_REMOTEPROC
> > > help
> > > Support for Remote Processor control
> > >
> > > +config CMD_WDT
> > > + bool "wdt"
> > > + default n
> >
> > No need for default n, that is the default.
>
> Ach... ok.
>
> >
> > > + help
> > > + Enables the "wdt" command, which is used to control a
> > > watchdog timer. +
> > > config CMD_GPIO
> > > bool "gpio"
> > > help
> > > diff --git a/cmd/Makefile b/cmd/Makefile
> > > index 9c9a9d1..4934427 100644
> > > --- a/cmd/Makefile
> > > +++ b/cmd/Makefile
> > > @@ -157,6 +157,8 @@ obj-$(CONFIG_CMD_ETHSW) += ethsw.o
> > > # Power
> > > obj-$(CONFIG_CMD_PMIC) += pmic.o
> > > obj-$(CONFIG_CMD_REGULATOR) += regulator.o
> > > +
> > > +obj-$(CONFIG_CMD_WDT) += wdt.o
> > > endif # !CONFIG_SPL_BUILD
> > >
> > > obj-$(CONFIG_CMD_BLOB) += blob.o
> > > diff --git a/cmd/wdt.c b/cmd/wdt.c
> > > new file mode 100644
> > > index 0000000..aeaa9c2
> > > --- /dev/null
> > > +++ b/cmd/wdt.c
> > > @@ -0,0 +1,32 @@
> > > +/*
> > > + * wdt.c -- Watchdog support command
> > > + *
> > > + * Copyright (C) 2017
> > > + * Lukasz Majewski, DENX Software Engineering, lukma at denx.de.
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0+
> > > + */
> > > +
> > > +#include <common.h>
> > > +#include <watchdog.h>
> > > +
> > > +static int do_wdt(cmd_tbl_t *cmdtp, int flag, int argc,
> > > + char * const argv[])
> > > +{
> > > + int ret = CMD_RET_SUCCESS;
> > > +
> > > + if (argc < 2 || argc > 2)
> > > + return CMD_RET_USAGE;
> > > +
> > > + if (!strcmp(argv[1], "disable")) {
> > > + WATCHDOG_DISABLE();
> > > + printf("WDT disabled\n");
> > > + }
> > > +
> > > + return ret;
> > > +}
> > > +
> > > +U_BOOT_CMD(wdt, CONFIG_SYS_MAXARGS, 1, do_wdt,
> > > + "Watchdog (wdt)",
> > > + "disable - disable watchdog\n"
> > > +);
> > > diff --git a/include/watchdog.h b/include/watchdog.h
> > > index 174c894..b0716c5 100644
> > > --- a/include/watchdog.h
> > > +++ b/include/watchdog.h
> > > @@ -41,8 +41,10 @@ int init_func_watchdog_reset(void);
> > > #define WATCHDOG_RESET bl hw_watchdog_reset
> > > #else
> > > extern void hw_watchdog_reset(void);
> > > + void hw_watchdog_disable(void);
> > >
> > > #define WATCHDOG_RESET hw_watchdog_reset
> > > + #define WATCHDOG_DISABLE hw_watchdog_disable
> > > #endif /* __ASSEMBLY__ */
> > > #else
> > > /*
> >
> > Can we add other commands, enable (calling _init() or _reset(),
> > I'm not sure which off the top of my head) as well?
>
> OK, I will think about adding such code.
>
> > And we may want
> > to think how to handle that only "omap" and "xilinx_tb" support the
> > _disable function today.
> >
>
> The problem with WDT is that it is a "legacy" code, used by many boards
> and in many places. We do need to be careful here ....
Exactly. Perhaps a weak function that just returns error?
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170303/e6c35300/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-03 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 0:01 [U-Boot] [PATCH] cmd: wdt: Add "wdt disable" command Lukasz Majewski
2017-03-03 3:18 ` Tom Rini
2017-03-03 8:46 ` Lukasz Majewski
2017-03-03 12:19 ` Tom Rini
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.