Re: During xHC Initialization (device is not connected), when HC-RESET is asserted, software is not expecting WRC or PRC bit set

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

 



On Fri, 2 Nov 2012, Sarah Sharp wrote:

> On Thu, Oct 25, 2012 at 10:34:29AM -0400, Alan Stern wrote:
> > On Thu, 25 Oct 2012, Ankit wrote:
> > 
> > > Hi Alan,
> > > 
> > > Thanks for your response.
> > > 
> > > Yes, there is a handling of PRC bit in xhci-hub.c
> > > 
> > > Our query is, at the time of XHCI initialization (inserting xhci-hcd.ko and
> > > no USB device is attached), is there PRC and CSC bits should be set?
> > > 
> > > Our host controller sets PRC and CSC bits at the time of initialization,
> > > even though no USB device is attached. At the time of initialization,
> > > hub_probe() gets called and in-turn it calls hub_activate(). hub_activate()
> > > clears the CSC bit, but PRC bit does not get cleared (in linux 3.6.1).
> > > hub_events() has functionality to clear the PRC bit, but initially there is
> > > no events from HUB, so hub_events() may not clear the PRC bit. Due to this
> > > behavior, when we try to insert a USB device, interrupt does not generate
> > > (because, earlier, PRC bit was set and not cleared) and USB device does not
> > > get enumerated.
> > > 
> > > So, would you please tell us, what should be the behavior?
> > 
> > I believe the hub driver needs to clear the USB_PORT_FEAT_C_RESET and 
> > USB_PORT_FEAT_C_OVERCURRENT features along with the other ones in 
> > hub_activate().  Would you like to submit a patch to do this?
> 
> Alan, I was looking at the port state sections of the xHCI spec, and ran
> across this note in section 4.19.1.2.3:
> 
> "The completion of Host Controller Reset (i.e. the HCRST ‘1’ to ‘0’
> transition) does not depend on the completion of any port activity other
> than entering the Disconnected state. Software shall check the Port
> Reset (PR) flag to ensure that the Warm Reset is complete before issuing
> any commands to a port."
> 
> I think the problems with the host driving a warm port reset on HC reset
> goes deeper than just needing to clear the PR and WPR bits on
> hub_activate().  Perhaps the xHCI driver needs to wait until PRC is set
> for all ports in xhci_init(), so that khubd doesn't cause a write to the
> port status registers until the warm reset is complete.

I guess so.  Not just during initialization, but also whenever port 
power is turned on.  And it might be safer to wait until both PR and 
WPR are clear instead of looking at PRC and WRC.

However we still want hub_activate() to clear any outstanding 
reset-change status bits.

> That could also be part of John's issue (mail: problem with Roseweil
> eusb3 enclosure).  Maybe his host gets into a bad state when the xHCI
> driver attempts to write to the port status registers before the warm
> port reset is done?

Maybe...

Alan Stern

--
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