On 12/16/2010 5:45 PM, Felipe Balbi wrote: > On Thu, Dec 16, 2010 at 04:56:15PM +0530, Pavan Kondeti wrote: >> On 12/15/2010 5:51 PM, Felipe Balbi wrote: >>> On Wed, Dec 15, 2010 at 04:44:14PM +0530, Pavankumar Kondeti wrote: >>>> 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. >>> >>> I wonder if this is the best approach. Would it be easier to not touch >>> usbcore, probe the entire stack during boot but have a "core" layer >>> handling synchronization to shared resources ? >>> >> The implementation is like this: >> >> Actually OTG synchronizes UDC and HCD. OTG driver probe will be called >> first and it takes care of turning on clocks, resetting controller and >> PHY and enabling interrupts (VBUS and Id). UDC and HCD will not modify >> hardware registers in their probe functions. So HCD will not call >> usb_add_hcd() function in it's probe(). After HCD and UDC registers with >> OTG via otg_set_xxx(), OTG activates HCD (by calling usb_add_hcd()) or >> UDC (usb_gadget_connect()) based on Id/VBUS status. When gadget is >> active, HCD is detached from USB core (usb_remove_hcd()). So user space >> can not poke into sysfs/debugfs nodes provided in the usb core. >> >>> Maybe you could make your device an MFD device that allocates >>> platform_devices for its children (HCI, UDC, OTG, etc) and pass in a >>> bunch of read/write functions as platform_data for them to use as >>> accessors to shared register space ?!? Would that work ? >>> >> The easy way to deal this problem is removing HCD when Mini/Micro -A >> cable is detached. > > But why do you need to do that isn't clear. What's the problem in > keeping HCD always available ? If it's a mini/micro-B cable you will > enter peripheral role anyway. > If you keep the HCD, root hub auto/system suspend can happen, user may un-configure the root hub or remove the HCD etc. There is not standard way of guarding against PM & user for this kind of HCD. We had a discussion about this some time back. Please see http://www.spinics.net/lists/linux-usb/msg35847.html Thanks, Pavan -- 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