diff mbox series

[U-Boot,1/2] usb_kbd: Add support for watchdog

Message ID a516b2c1dc35c203a7a356d7a3d84fae53bdb91e.1530105018.git.michal.simek@xilinx.com
State Accepted
Commit f8f3e0e539e08da381e397ba58fcc2df195ae2ec
Delegated to: Marek Vasut
Headers show
Series usb_kbd with DM enabled | expand

Commit Message

Michal Simek June 27, 2018, 1:10 p.m. UTC
There is need to service watchdog in while loop or system will be
restarted when idlying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 common/usb_kbd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 4c394d5613d1..20255dcf951f 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -16,6 +16,7 @@ 
 #include <malloc.h>
 #include <memalign.h>
 #include <stdio_dev.h>
+#include <watchdog.h>
 #include <asm/byteorder.h>
 
 #include <usb.h>
@@ -398,8 +399,10 @@  static int usb_kbd_getc(struct stdio_dev *sdev)
 	usb_kbd_dev = (struct usb_device *)dev->priv;
 	data = usb_kbd_dev->privptr;
 
-	while (data->usb_in_pointer == data->usb_out_pointer)
+	while (data->usb_in_pointer == data->usb_out_pointer) {
+		WATCHDOG_RESET();
 		usb_kbd_poll_for_event(usb_kbd_dev);
+	}
 
 	if (data->usb_out_pointer == USB_KBD_BUFFER_LEN - 1)
 		data->usb_out_pointer = 0;