USB core changes for supporting OTG on MSM SoC
Subsystems (3)
v2 cover USB core changes for supporting OTG on MSM SoC
This patch series adds OTG 2.0 enhancements and misc changes required for supporting SRP & HNP in MSM OTG driver. As these patches modify the USB core code, I would like to receive feedback before posting driver patches. The driver patches are available at
https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git;a=commitdiff;h=05535a995e9eb34c3c41d874d09955a443008cd5
Change log from V1
1. Removed unnecessary #ifdef CONFIG_USB_OTG references
2. OTG Kconfig change is removed from this patch series
3. Implemented Alan Stern's suggestions in hnp_polling_work a. reschedule work when kmalloc fails
b. clear do_remote_wakeup flag before suspending
Pavankumar Kondeti (4):
USB: core: OTG Supplement Revision 2.0 updates
USB: gadget: OTG supplement revision 2.0 updates
USB: EHCI: Notify HCD about HNP enabled port suspend
USB: Eliminate delays involved in root hub initialization during HNP
.../testing/sysfs-devices-platform-_UDC_-gadget | 14 ++++ drivers/usb/core/driver.c | 53 ++++++++++++++ drivers/usb/core/hcd.c | 3 + drivers/usb/core/hub.c | 75 +++++++++++++++++--- drivers/usb/core/usb.h | 8 ++ drivers/usb/gadget/composite.c | 23 ++++++ drivers/usb/gadget/zero.c | 3 + drivers/usb/host/ehci-hub.c | 11 +++ drivers/usb/host/ehci.h | 2 + include/linux/usb.h | 2 + include/linux/usb/ch9.h | 11 +++- include/linux/usb/gadget.h | 21 ++++++ 12 files changed, 214 insertions(+), 12 deletions(-)
--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC v2 1/4 USB: core: OTG Supplement Revision 2.0 updates
OTG supplement revision 2.0 spec introduces Attach Detection Protocol (ADP) for detecting peripheral connection without applying power on VBUS. ADP is optional and is included in the OTG descriptor along with SRP and HNP.
HNP polling is introduced for peripheral to notify its wish to become host. Host polls (GET_STATUS on DEVICE) peripheral for host_request and suspend the bus when peripheral returns host_request TRUE. The spec insists the polling frequency to be in 1-2 sec range and bus should be suspended within 2 sec from host_request is set.
a_alt_hnp_support feature is obsolete and a_hnp_support feature is limited to only legacy OTG B-device. The newly introduced bcdOTG field in the OTG descriptor is used for identifying the 2.0 compliant B-device.
--- drivers/usb/core/driver.c | 53 ++++++++++++++++++++++++++++++++++++ drivers/usb/core/hcd.c | 1 + drivers/usb/core/hub.c | 66 ++++++++++++++++++++++++++++++++++++++------- drivers/usb/core/usb.h | 8 +++++ include/linux/usb.h | 2 + include/linux/usb/ch9.h | 11 ++++++- 6 files changed, 129 insertions(+), 12 deletions(-)
drivers/usb/core/driver.c +53 -0
@@ -1207,6 +1207,18 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)* and flush any outstanding URBs. */ }else { +/* According to OTG supplement Rev 2.0 section 6.3 +* Unless an A-device enables b_hnp_enable before entering +* suspend it shall also continue polling while the bus is +* suspended. +* +* We don't have to perform HNP polling, as we are going to +* enable b_hnp_enable before suspending. +*/ +if (udev->bus->hnp_support && + udev->portnum == udev->bus->otg_port) +cancel_delayed_work (&udev->bus->hnp_polling); + udev->can_submit =0 ;for (i =0 ; i <16 ; ++i) {usb_hcd_flush_endpoint (udev, udev->ep_out[i]);
@@ -1270,6 +1282,47 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)return status; } +#ifdef CONFIG_USB_OTG +void usb_hnp_polling_work (struct work_struct *work) +{ +int ret; +struct usb_bus *bus = + container_of(work, struct usb_bus, hnp_polling.work); +struct usb_device *udev = bus->root_hub->children[bus->otg_port -1 ]; +u8 *status =kmalloc (sizeof (*status),GFP_KERNEL ); + +if (!status) { +schedule_delayed_work (&bus->hnp_polling, +msecs_to_jiffies (THOST_REQ_POLL )); +return ; + } + + ret =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ), +USB_REQ_GET_STATUS ,USB_DIR_IN |USB_RECIP_DEVICE , +0 ,OTG_STATUS_SELECTOR , status,sizeof (*status), +USB_CTRL_GET_TIMEOUT ); +if (ret <0 ) { +/* Peripheral may not be supporting HNP polling */ +dev_vdbg (&udev->dev,"HNP polling failed. status %d\n" , ret); + goto out; + } + +/* Spec says host must suspend the bus with in 2 sec. */ +if (*status & (1 <<HOST_REQUEST_FLAG )) { +do_unbind_rebind (udev,DO_UNBIND ); + udev->do_remote_wakeup =0 ; + ret =usb_suspend_both (udev,PMSG_USER_SUSPEND ); +if (ret) +dev_info (&udev->dev,"suspend failed\n" ); + }else { +schedule_delayed_work (&bus->hnp_polling, +msecs_to_jiffies (THOST_REQ_POLL )); + } +out: +kfree (status); +} +#endif +static void choose_wakeup (struct usb_device *udev,pm_message_t msg) {int w;
drivers/usb/core/hcd.c +1 -0
@@ -869,6 +869,7 @@ static void usb_bus_init (struct usb_bus *bus) bus->bandwidth_isoc_reqs =0 ;INIT_LIST_HEAD (&bus->bus_list); +INIT_DELAYED_WORK (&bus->hnp_polling, usb_hnp_polling_work); }/*-------------------------------------------------------------------------*/
drivers/usb/core/hub.c +56 -10
113 lines not on this page · raw message
drivers/usb/core/usb.h +8 -0
@@ -72,6 +72,14 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)#endif +#ifdef CONFIG_USB_OTG +extern void usb_hnp_polling_work (struct work_struct *work); +#else +static inline void usb_hnp_polling_work (struct work_struct *work) +{ +} +#endif +#ifdef CONFIG_USB_SUSPEND extern void usb_autosuspend_device (struct usb_device *udev);
include/linux/usb.h +2 -0
@@ -317,6 +317,8 @@ struct usb_bus {u8 otg_port;/* 0, or number of OTG/HNP port */ unsigned is_b_host:1; /* true during some HNP roleswitches */ unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ + unsigned hnp_support:1; /* OTG: HNP is supported on OTG port */ +struct delayed_work hnp_polling;/* OTG: HNP polling work */ unsigned sg_tablesize;/* 0 or largest number of sg list entries */ int devnum_next;/* Next open device number in
include/linux/usb/ch9.h +9 -2
@@ -151,6 +151,11 @@#define USB_DEV_STAT_U2_ENABLED 3/* transition into U2 state */ #define USB_DEV_STAT_LTM_ENABLED 4/* Latency tolerance messages */ +/* OTG 2.0 spec 6.2 and 6.3 sections */ +#define OTG_STATUS_SELECTOR 0xF000 +#define THOST_REQ_POLL 1500/* 1000 - 2000 msec */ +#define HOST_REQUEST_FLAG 0 +/** * struct usb_ctrlrequest - SETUP data for a USB device control request * @bRequestType: matches the USB bmRequestType field
@@ -605,17 +610,19 @@ struct usb_qualifier_descriptor {/*-------------------------------------------------------------------------*/ -/* USB_DT_OTG (from OTG 1.0a supplement) */ +/* USB_DT_OTG (from OTG 2.0 supplement) */ struct usb_otg_descriptor {__u8 bLength;__u8 bDescriptorType; -__u8 bmAttributes;/* support for HNP, SRP, etc */ +__u8 bmAttributes;/* support for HNP, SRP, ADP etc */ +__le16 bcdOTG; } __attribute__ ((packed));/* from usb_otg_descriptor.bmAttributes */ #define USB_OTG_SRP (1 << 0)#define USB_OTG_HNP (1 << 1)/* swap host/device roles */ +#define USB_OTG_ADP (1 << 2)/* Attach detection protocol */ /*-------------------------------------------------------------------------*/
Signature · 5 lines
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.
Alan Stern
maintainerRe: [RFC v2 1/4] USB: core: OTG Supplement Revision 2.0 updates
Quoted 11 lines · Pavankumar Kondeti
OTG supplement revision 2.0 spec introduces Attach Detection Protocol (ADP) for detecting peripheral connection without applying power on VBUS. ADP is optional and is included in the OTG descriptor along with SRP and HNP.
HNP polling is introduced for peripheral to notify its wish to become host. Host polls (
GET_STATUSon DEVICE) peripheral forhost_requestand suspend the bus when peripheral returnshost_requestTRUE. The spec insists the polling frequency to be in 1-2 sec range and bus should be suspended within 2 sec fromhost_requestis set.
Quoted 3 lines
a_alt_hnp_supportfeature is obsolete anda_hnp_supportfeature is limited to only legacy OTG B-device. The newly introduced bcdOTG field in the OTG descriptor is used for identifying the 2.0 compliant B-device.
This combination of things doesn't make sense:
Quoted 10 lines
index b9278a1..baada06 100644
drivers/usb/core/driver.c +3
-0@@ -1270,6 +1282,47 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)return status; } +#ifdef CONFIG_USB_OTG +void usb_hnp_polling_work (struct work_struct *work) +{
...
drivers/usb/core/driver.c
Quoted 2 lines
drivers/usb/core/driver.c +2
-0+} +#endif
usb_hnp_polling_work() is defined only when CONFIG_USB_OTG is set.
drivers/usb/core/hcd.c static void usb_bus_init (struct usb_bus *bus) · line 873
Quoted 10 lines
drivers/usb/core/hcd.c +1
-0@@ -869,6 +869,7 @@ static void usb_bus_init (struct usb_bus *bus) bus->bandwidth_isoc_reqs =0 ;INIT_LIST_HEAD (&bus->bus_list); +INIT_DELAYED_WORK (&bus->hnp_polling, usb_hnp_polling_work); }
But its address is taken regardless of CONFIG_USB_OTG.
Quoted 5 lines
drivers/usb/core/usb.h +0
-0
drivers/usb/core/usb.h static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) · line 81
Quoted 10 lines
drivers/usb/core/usb.h +7
-0@@ -72,6 +72,14 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)#endif +#ifdef CONFIG_USB_OTG +extern void usb_hnp_polling_work (struct work_struct *work); +#else +static inline void usb_hnp_polling_work (struct work_struct *work) +{ +} +#endif
Otherwise it is an empty inline routine.
But taking the address of an inline routine forces the compiler to produce an out-of-line version. Therefore you might as well explicitly define usb_hnp_polling_work() as an empty function when CONFIG_USB_OTG isn't set.
Alan Stern
Re: [RFC v2 1/4] USB: core: OTG Supplement Revision 2.0 updates
Quoted 68 lines · Alan Stern
Quoted 11 lines · Pavankumar Kondeti
OTG supplement revision 2.0 spec introduces Attach Detection Protocol (ADP) for detecting peripheral connection without applying power on VBUS. ADP is optional and is included in the OTG descriptor along with SRP and HNP.
HNP polling is introduced for peripheral to notify its wish to become host. Host polls (
GET_STATUSon DEVICE) peripheral forhost_requestand suspend the bus when peripheral returnshost_requestTRUE. The spec insists the polling frequency to be in 1-2 sec range and bus should be suspended within 2 sec fromhost_requestis set.Quoted 3 lines
a_alt_hnp_supportfeature is obsolete anda_hnp_supportfeature is limited to only legacy OTG B-device. The newly introduced bcdOTG field in the OTG descriptor is used for identifying the 2.0 compliant B-device.This combination of things doesn't make sense:
Quoted 10 lines
index b9278a1..baada06 100644
drivers/usb/core/driver.c +3
-0@@ -1270,6 +1282,47 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)return status; } +#ifdef CONFIG_USB_OTG +void usb_hnp_polling_work (struct work_struct *work) +{...
drivers/usb/core/driver.c
Quoted 2 lines
drivers/usb/core/driver.c +2
-0+} +#endif
usb_hnp_polling_work()is defined only whenCONFIG_USB_OTGis set.drivers/usb/core/hcd.c static void usb_bus_init (struct usb_bus *bus) · line 873
Quoted 10 lines
drivers/usb/core/hcd.c +1
-0@@ -869,6 +869,7 @@ static void usb_bus_init (struct usb_bus *bus) bus->bandwidth_isoc_reqs =0 ;INIT_LIST_HEAD (&bus->bus_list); +INIT_DELAYED_WORK (&bus->hnp_polling, usb_hnp_polling_work); }But its address is taken regardless of
CONFIG_USB_OTG.Quoted 5 lines
drivers/usb/core/usb.h +0
-0drivers/usb/core/usb.h static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) · line 81
Quoted 10 lines
drivers/usb/core/usb.h +7
-0@@ -72,6 +72,14 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)#endif +#ifdef CONFIG_USB_OTG +extern void usb_hnp_polling_work (struct work_struct *work); +#else +static inline void usb_hnp_polling_work (struct work_struct *work) +{ +} +#endif Otherwise it is an empty inline routine.
Quoted 5 lines
But taking the address of an inline routine forces the compiler to produce an out-of-line version. Therefore you might as well explicitly define
usb_hnp_polling_work()as an empty function whenCONFIG_USB_OTGisn't set.
Thanks. I got it. Will fix it next version.
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC v2 2/4 USB: gadget: OTG supplement revision 2.0 updates
In reply to Pavankumar KondetiIntroduce otg_version field in usb_gadget struct. UDC can advertise OTG spec version compatibility by setting otg_version field appropriately. Gadget drivers fill the bcdOTG field in OTG descriptor based on UDC's OTG version.
Add sysfs file for host_request and UDC returns the same when HNP polling request arrives from the host.
---
This patch only modifies gadget zero. But the final patch will modify all the gadget drivers.
.../testing/sysfs-devices-platform-_UDC_-gadget | 14 ++++++++++++ drivers/usb/gadget/composite.c | 23 ++++++++++++++++++++ drivers/usb/gadget/zero.c | 3 ++ include/linux/usb/gadget.h | 21 ++++++++++++++++++ 4 files changed, 61 insertions(+), 0 deletions(-)
Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget +14 -0
@@ -19,3 +19,17 @@ Description: Possible values are: 1 -> ignore the FUA flag 0 -> obey the FUA flag + +What: /sys/devices/platform/_UDC_/gadget/host_request +Date: December 2010 +Contact: Pavan Kondeti <[email protected]> +Description: + OTG 2.0 compliant host keeps polling OTG2.0 peripheral + for host role. Set host_request flag, which tells host + to give up the host role to peripheral. + + 1 -> host role is requested + 0 -> no effect (automatically cleared upon reset/disconnect) + + (_UDC_ is the name of the USB Device Controller driver) +
drivers/usb/gadget/composite.c +23 -0
@@ -978,6 +978,7 @@ static void composite_disconnect(struct usb_gadget *gadget)struct usb_composite_dev *cdev =get_gadget_data (gadget);unsigned long flags; + gadget->host_request =0 ;/* REVISIT: should we have config and device level * disconnect callbacks? */
@@ -1003,6 +1004,23 @@ static ssize_t composite_show_suspended(struct device *dev, static DEVICE_ATTR(suspended, 0444, composite_show_suspended, NULL); +static ssize_t composite_set_host_request (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct usb_gadget *gadget =dev_to_usb_gadget (dev); +int value; + +if (sscanf (buf,"%d" , &value) !=1 ) +return -EINVAL ; + + gadget->host_request = !!value; +return count; + +} + +static DEVICE_ATTR(host_request, S_IWUSR, NULL, composite_set_host_request); +static void composite_unbind (struct usb_gadget *gadget) {
@@ -1047,6 +1065,7 @@ composite_unbind(struct usb_gadget *gadget)kfree (cdev->req->buf);usb_ep_free_request (gadget->ep0, cdev->req); } +device_remove_file (&gadget->dev, &dev_attr_host_request);device_remove_file (&gadget->dev, &dev_attr_suspended);kfree (cdev);set_gadget_data (gadget,NULL );
@@ -1158,6 +1177,10 @@ static int composite_bind(struct usb_gadget *gadget)if (status) goto fail; + status =device_create_file (&gadget->dev, &dev_attr_host_request); +if (status) +DBG (cdev,"unable to create host_request sysfs file\n" ); +INFO (cdev,"%s ready\n" , composite->name);return 0 ;
drivers/usb/gadget/zero.c +3 -0
@@ -293,6 +293,9 @@ static int __init zero_bind(struct usb_composite_dev *cdev)setup_timer (&autoresume_timer, zero_autoresume, (unsigned long ) cdev); +if (gadget_is_otg2 (cdev->gadget)) + otg_descriptor.bcdOTG =__constant_cpu_to_le16 (0x0200 ); +/* Register primary, then secondary configuration. Note that * SH3 only allows one config... */
include/linux/usb/gadget.h +21 -0
@@ -443,6 +443,8 @@ struct usb_gadget_ops {* operation. If it does, the gadget driver must also support both. * @is_otg: True if the USB device port uses a Mini-AB jack, so that the * gadget driver must provide a USB OTG descriptor. +* @otg_version: UDC OTG version based on which gadget driver fills the +* bcdOTG field in a USB OTG descriptor. * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable * is in the Mini-AB jack, and HNP has been used to switch roles * so that the "A" device currently acts as A-Peripheral, not A-Host.
@@ -452,6 +454,7 @@ struct usb_gadget_ops {* only supports HNP on a different root port. * @b_hnp_enable: OTG device feature flag, indicating that the A-Host * enabled HNP support. +* @host_request: A Flag, indicating that user wishes to take the host role. * @name: Identifies the controller hardware type. Used in diagnostics * and sometimes configuration. * @dev: Driver model state for this abstract device.
@@ -482,10 +485,14 @@ struct usb_gadget {enum usb_device_speed speed; unsigned is_dualspeed:1; unsigned is_otg:1; +u16 otg_version; +#define UDC_OTG1 0x0000 +#define UDC_OTG2 0x0001 unsigned is_a_peripheral:1; unsigned b_hnp_enable:1; unsigned a_hnp_support:1; unsigned a_alt_hnp_support:1; + unsigned host_request:1;const char *name;struct device dev; };
@@ -537,6 +544,20 @@ static inline int gadget_is_otg(struct usb_gadget *g) }/** +* gadget_is_otg2 - return true if UDC is compliant to OTG 2.0 +* @g: controller that might have a Mini-AB/Micro-AB connector +* +*/ +static inline int gadget_is_otg2 (struct usb_gadget *g) +{ +#ifdef CONFIG_USB_OTG +return g->otg_version &&UDC_OTG2 ; +#else +return 0 ; +#endif +} + +/** * usb_gadget_frame_number - returns the current frame number * @gadget: controller that reports the frame number *
Signature · 5 lines
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.
RFC v2 3/4 USB: EHCI: Notify HCD about HNP enabled port suspend
In reply to Pavankumar KondetiIntroduce start_hnp callback function for HCD to receive notification from EHCI core that HNP enabled port is suspended. HCD may initiate HNP or notify the same to OTG via otg_start_hnp().
This patch is inspired by "USB: Hook start_hnp into ohci struct" (e8b24450).
--- drivers/usb/host/ehci-hub.c | 11 +++++++++++ drivers/usb/host/ehci.h | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-)
drivers/usb/host/ehci-hub.c +11 -0
@@ -1018,6 +1018,17 @@ static int ehci_hub_control ( || (temp & PORT_RESET) != 0) goto error; +#ifdef CONFIG_USB_OTG +if (hcd->self.otg_port == (wIndex +1 ) && + hcd->self.b_hnp_enable && + ehci->start_hnp) { +ehci_writel (ehci, temp |PORT_SUSPEND , + status_reg); +set_bit (wIndex, &ehci->suspended_ports); + ehci->start_hnp (ehci); +break ; + } +#endif /* After above check the port must be connected. * Set appropriate bit thus could put phy into low power * mode if we have hostpc feature
drivers/usb/host/ehci.h +2 -0
@@ -122,6 +122,8 @@ struct ehci_hcd { /* one per controller */ktime_t last_periodic_enable;u32 command; +void (*start_hnp)(struct ehci_hcd *ehci); +/* SILICON QUIRKS */ unsigned no_selective_suspend:1; unsigned has_fsl_port_bug:1; /* FreeScale */
Signature · 5 lines
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.
RFC v2 4/4 USB: Eliminate delays involved in root hub initialization during HNP
In reply to Pavankumar KondetiSome 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.
--- drivers/usb/core/hcd.c | 2 ++ drivers/usb/core/hub.c | 9 +++++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/usb/core/hcd.c +2 -0
@@ -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 "
drivers/usb/core/hub.c +9 -0
@@ -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));
Signature · 5 lines
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.
Re: [RFC v2 4/4] USB: Eliminate delays involved in root hub initialization during HNP
Hello.
Quoted 12 lines · Pavankumar Kondeti
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_supportedflag TRUE for B-host while registering the bus.Change-Id I821775e8c90bd71a7abbe17176f189664a1841e1Signed-off-by Pavankumar Kondeti<[email protected]>
[...]
drivers/usb/core/hub.c static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · line 683
Quoted 8 lines
index ac79fd5..2df61ba 100644
drivers/usb/core/hub.c +1
-0@@ -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 );
Parens here are not necessary.
WBR, Sergei
Re: [RFC v2 4/4] USB: Eliminate delays involved in root hub initialization during HNP
Quoted 18 lines · Sergei Shtylyov
Hello.
Quoted 12 lines · Pavankumar Kondeti
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_supportedflag TRUE for B-host while registering the bus.Change-Id I821775e8c90bd71a7abbe17176f189664a1841e1Signed-off-by Pavankumar Kondeti<[email protected]>[...]
Quoted 10 lines
drivers/usb/core/hub.c static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · line 683
Quoted 8 lines
index ac79fd5..2df61ba 100644
drivers/usb/core/hub.c +1
-0@@ -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 );Parens here are not necessary.
there's also a missing space before &&
Signature · 1 line
balbi
Re: [RFC v2 4/4] USB: Eliminate delays involved in root hub initialization during HNP
Quoted 30 lines · Felipe Balbi
Quoted 18 lines · Sergei Shtylyov
Hello.
Quoted 12 lines · Pavankumar Kondeti
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_supportedflag TRUE for B-host while registering the bus.Change-Id I821775e8c90bd71a7abbe17176f189664a1841e1Signed-off-by Pavankumar Kondeti<[email protected]>[...]
Quoted 10 lines
drivers/usb/core/hub.c static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · line 683
Quoted 8 lines
index ac79fd5..2df61ba 100644
drivers/usb/core/hub.c +1
-0@@ -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 );Parens here are not necessary.
Quoted 2 lines
there's also a missing space before &&
There is one. Please see my original patch. I am not sure why it is missing in Sergei's reply.
Thanks,
Pavan
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [RFC v2 4/4] USB: Eliminate delays involved in root hub initialization during HNP
In reply to Felipe BalbiQuoted 26 lines · Felipe Balbi
Quoted 14 lines
Quoted 12 lines
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_supportedflag TRUE for B-host while registering the bus.Change-Id I821775e8c90bd71a7abbe17176f189664a1841e1Signed-off-by Pavankumar Kondeti<[email protected]>[...]
Quoted 11 lines
drivers/usb/core/hub.c static void hub_activate(struct usb_hub *hub, enum · line 684
Quoted 9 lines
index ac79fd5..2df61ba 100644
drivers/usb/core/hub.c +1
-0@@ -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 );Parens here are not necessary.
Quoted 1 line
there's also a missing space before &&
That's my Thunderbird eating spaces before &. :-)
WBR, Sergei