On Wed, 4 May 2005, David Brownell wrote:

> On Sunday 01 May 2005 7:14 pm, Alan Stern wrote:
> > David:
> > 
> > I found part of the source for the trouble I've had with root-hub 
> > suspend/resume on OHCI.  It's these two lines near the end of 
> > ohci-hub.c:ohci_hub_suspend():
> > 
> >         if (status == 0)
> >                 hcd->state = HC_STATE_SUSPENDED;
> 
> I think I remember why that's there.   It pairs the earlier line
> in the same function to set hcd->state to QUIESCING.  And the reason
> for that is because hcd->state is the only hook we have for, erm,
> quiescing the traffic going into the HCD.

More testing showed that this causes a problem at the end of ohci_irq(), 
where the code says:

      if (HC_IS_RUNNING(hcd->state)) {
                ohci_writel (ohci, ints, &regs->intrstatus);
                ohci_writel (ohci, OHCI_INTR_MIE, &regs->intrenable);   
                // flush those writes
                (void) ohci_readl (ohci, &ohci->regs->control);
        }

The HC_IS_RUNNING test fails after the state has been set to 
HC_STATE_SUSPENDED, so the interrupt handling isn't completed.  If I 
replace that test with "if (1) {" then my system no longer hangs.  It 
still doesn't work correctly, in that the root hub doesn't get resumed as 
one would expect, but that's a separate issue...

So one of the two places appears to be wrong.  Either ohci_hub_suspend()  
shouldn't set hcd->state to HC_STATE_SUSPENDED or ohci_irq() shouldn't 
contain this test for HC_IS_RUNNING(hcd->state).  Could this be an example 
of trying to use hcd->state to mean too many different things?

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to