[RFC v2 4/4] USB: Eliminate delays involved in root hub initialization during HNP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 TRUE for B-host while
registering the bus.

Change-Id: I821775e8c90bd71a7abbe17176f189664a1841e1
Signed-off-by: Pavankumar Kondeti <pkondeti@xxxxxxxxxxxxxx>
---
 drivers/usb/core/hcd.c |    2 ++
 drivers/usb/core/hub.c |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5dd59e9..07e6903 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -900,6 +900,8 @@ static int usb_register_bus(struct usb_bus *bus)
 	list_add (&bus->bus_list, &usb_bus_list);
 	mutex_unlock(&usb_bus_list_lock);
 
+	if (bus->is_b_host)
+		bus->hnp_support = 1;
 	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 ac79fd5..2df61ba 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -680,6 +680,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 	int status;
 	bool need_debounce_delay = false;
 	unsigned delay;
+	bool hnp_in_progress = hdev->bus->is_b_host && (type == HUB_INIT);
 
 	/* Continue a partial initialization */
 	if (type == HUB_INIT2)
@@ -706,6 +707,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 		 */
 		if (type == HUB_INIT) {
 			delay = hub_power_on(hub, false);
+			if (hnp_in_progress)
+				goto init2;
 			PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
 			schedule_delayed_work(&hub->init_work,
 					msecs_to_jiffies(delay));
@@ -811,6 +814,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 		}
 	}
 
+		if (hnp_in_progress)
+			goto init3;
+
 	/* 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 +850,9 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 	/* Scan all ports that need attention */
 	kick_khubd(hub);
 
+	if (hnp_in_progress)
+		return;
+
 	/* 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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux