From 98ac7857f9674a98e6ea886b3dccc782efeacadb Mon Sep 17 00:00:00 2001 From: Kory Maincent Date: Wed, 22 Jun 2022 10:59:31 +0200 Subject: usb: kbd: allow probing even if usbkbd not in stdin For now the driver does not probe if usbkbd was not present in stdin. This presents two issues, we can not probe the driver before setting stdin and we can not use this driver in other manner than stdin console. This patch fixes this by adding an else statement. It simply probes the driver without console management in the case "usbkbd" is not in stdin. Signed-off-by: Kory Maincent --- common/usb_kbd.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'common') diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 352d86fb2ec..d385bea532e 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -581,21 +581,22 @@ static int probe_usb_keyboard(struct usb_device *dev) stdinname = env_get("stdin"); #if CONFIG_IS_ENABLED(CONSOLE_MUX) - error = iomux_doenv(stdin, stdinname); - if (error) - return error; + if (strstr(stdinname, DEVNAME) != NULL) { + error = iomux_doenv(stdin, stdinname); + if (error) + return error; + } #else /* Check if this is the standard input device. */ - if (strcmp(stdinname, DEVNAME)) - return 1; - - /* Reassign the console */ - if (overwrite_console()) - return 1; + if (!strcmp(stdinname, DEVNAME)) { + /* Reassign the console */ + if (overwrite_console()) + return 1; - error = console_assign(stdin, DEVNAME); - if (error) - return error; + error = console_assign(stdin, DEVNAME); + if (error) + return error; + } #endif return 0; -- cgit v1.2.3 From 48b1cff94744b88821bc9cf8a0e1c54b5e87926c Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 4 Jul 2022 12:45:42 +0200 Subject: usb: hub: introduce HUB_DEBOUNCE_TIMEOUT Introduce define for connection timeout, named HUB_DEBOUNCE_TIMEOUT as in linux kernel drivers/usb/core/hub.c Signed-off-by: Patrick Delaunay --- common/usb_hub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/usb_hub.c b/common/usb_hub.c index ba11a188ca6..d73638950b9 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -47,6 +47,8 @@ #define HUB_SHORT_RESET_TIME 20 #define HUB_LONG_RESET_TIME 200 +#define HUB_DEBOUNCE_TIMEOUT 1000 + #define PORT_OVERCURRENT_MAX_SCAN_COUNT 3 struct usb_device_scan { @@ -208,10 +210,10 @@ static void usb_hub_power_on(struct usb_hub_device *hub) * will be done based on this value in the USB port loop in * usb_hub_configure() later. */ - hub->connect_timeout = hub->query_delay + 1000; + hub->connect_timeout = hub->query_delay + HUB_DEBOUNCE_TIMEOUT; debug("devnum=%d poweron: query_delay=%d connect_timeout=%d\n", dev->devnum, max(100, (int)pgood_delay), - max(100, (int)pgood_delay) + 1000); + max(100, (int)pgood_delay) + HUB_DEBOUNCE_TIMEOUT); } #if !CONFIG_IS_ENABLED(DM_USB) -- cgit v1.2.3 From 16aabfe2f29d4682b2176095029fa307caccaced Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 13 Jul 2022 17:39:46 -0300 Subject: spl: sdp: Pass the USB index to board_usb_init() board_usb_init() should receive the controller_index as its first parameter instead of having it hardcoded as 0. All in-tree users have CONFIG_SPL_SDP_USB_DEV as 0, so this error should not affect any board. Fix it by passing controller_index as the parameter of board_usb_init(). Signed-off-by: Fabio Estevam Acked-by: Peng Fan --- common/spl/spl_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index 36c31aff099..cc4fb4f7cca 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -19,7 +19,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, usb_gadget_initialize(controller_index); - board_usb_init(0, USB_INIT_DEVICE); + board_usb_init(controller_index, USB_INIT_DEVICE); g_dnl_clear_detach(); ret = g_dnl_register("usb_dnl_sdp"); -- cgit v1.2.3