Some USB controllers have common resources (IRQ, register address space) for Host, Peripheral and OTG. So HCD is added only before entering into Host mode. Root hub initialization is done in different steps to decrease boot up time. But this makes B-device difficult to meet HNP timings. Hence eliminate delays involved in root hub initialization for B-host. This patch also marks hnp_supported flag TURE for B-host while registering the bus. Signed-off-by: Pavankumar Kondeti <pkondeti@xxxxxxxxxxxxxx> --- drivers/usb/core/hcd.c | 4 ++++ drivers/usb/core/hub.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6bffd50..a180a0f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -902,6 +902,10 @@ static int usb_register_bus(struct usb_bus *bus) list_add (&bus->bus_list, &usb_bus_list); mutex_unlock(&usb_bus_list_lock); +#ifdef CONFIG_USB_OTG + if (bus->is_b_host) + bus->hnp_support = 1; +#endif usb_notify_add_bus(bus); dev_info (bus->controller, "new USB bus registered, assigned bus " diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 60705a1..48fb83d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -706,6 +706,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) */ if (type == HUB_INIT) { delay = hub_power_on(hub, false); +#ifdef CONFIG_USB_OTG + if (hdev->bus->is_b_host) + goto init2; +#endif PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); schedule_delayed_work(&hub->init_work, msecs_to_jiffies(delay)); @@ -811,6 +815,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) } } +#ifdef CONFIG_USB_OTG + if (hdev->bus->is_b_host && type == HUB_INIT) + goto init3; +#endif + /* If no port-status-change flags were set, we don't need any * debouncing. If flags were set we can try to debounce the * ports all at once right now, instead of letting khubd do them @@ -844,6 +853,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) /* Scan all ports that need attention */ kick_khubd(hub); +#ifdef CONFIG_USB_OTG + if (hdev->bus->is_b_host && type == HUB_INIT) + return; +#endif /* Allow autosuspend if it was suppressed */ if (type <= HUB_INIT3) usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); -- 1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html