On Wed, Sep 08, 2010 at 12:05:39PM -0400, Alan Stern wrote: > On Wed, 8 Sep 2010, Pavan Kondeti wrote: > > > According to OTG 2.0 spec, B-device should observe A-device connect signal > > with in 155ms (min time) after A-device suspended the bus. usb_remove_hcd > > blocks till the B-device and root hub are completely disconnected (class > > drivers unbind). > > > > ehci_irq observes the PCD interrupt and B-device disconnection is carried out > > in hub thread context. Before hub thread observes, this device disconnection, > > root hub device state and HW_ACCESSIBLE flag is cleared and gadget driver is > > activated. Yeah. Its all looks like hacky and racy. But could not find a > > better method to meet HNP timings. > > To do this properly, we need to have a method for quickly taking the > hardware away from an OTG-compliant host controller driver. Then the > root hub and everything else on the host side can be unregistered in > a background thread or simply left idle. > This is excatly what we wanted for MSM OTG. We can use the same API for both Id state change and during HNP. > Probably this should be a new method in the hc_driver structure. Is > ehci-hcd the only driver where this matters? What about musb or > various versions of ohci-hcd? > MSM Host controller is EHCI compliant and uses ehci-hcd. I am not sure about others requirement. > > > > How can we avoid autosuspend/system suspend and intrusion from > > > > sysfs/debugfs without calling usb_remove_hcd? > > > > > > The only way would be to have the HCD check whether or not the hardware > > > is in host mode before allowing it to do anything. On the whole, > > > unregistering the host controller seems safer if it cannot operate > > > without interfering with the device controller. > > > > > I agree. I am trying to submit the basic OTG driver (host/device role based on > > Id pin state) first. So I will stick to usb_add_hcd() and usb_remove_hcd(). > > If the HCD can be prevented from touching the hardware, do you think it > is still necessary to add and remove the bus? > If the API gaurantess to gaurd against system/runtime suspend and sysfs/debugfs/usbfs access, I can use this instead of usb_add_hcd/usb_remove_hcd methods. -- 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