On Tue, 7 Feb 2006, Curran, Dominic wrote:

> Hi
> 
> I've been walking through the EHCI HCD & usbcore code for a few days
> now.  
> I'm new to USB and EHCI so I'm at the bottom on the learning curve.
> 
> I'm sure my question is simple, but I've been starring at code and I
> can't work it out...
> 
> I'm trying to understand the code flow from HW, through EHCI and up to
> usbcore/khubd.

I'm not fully up-to-date on the details of ehci-hcd, but I'll try to 
help...

> Lets say a new device is plugged into a EHCI port.
> My understanding is that this generates and interrupt and the USBSTS's
> 'Port Change Detect' bit is set (STS_PCD).

I don't think so.  It may or may not generate an interrupt; I'm not sure
whether port-change interrupts are enabled in ehci-hcd.  In any case it
doesn't matter, because the interrupt handler wouldn't do much.

> So what functions get called ?
> 
> ehci_irq() -> ehci_work() -> ???

No, essentially nothing gets called.

> I'm fairly sure the root hub code gets called in order to enumerate the
> new device like this:
> 
> kick_khubd()
>      |
>      |
>      v
> hub_thread() -> hub_events() -> hub_port_connect_change() ->
> hub_port_init()
>                                                           ->
> usb_new_device()
> 
> hub_port_init() & usb_new_device() request descriptors and enumerate the
> device, that's easy enough to understand.

Right.

> So what I don't understand is how the EHCI isr (ehci_irq) calls
> kick_khubd() ?

It doesn't.  

> I expect its glaringly obvious.  I'd appreciate it if someone could help
> me understand it.

What happens is that the root hub timer goes off every 250 ms (see 
rh_timer_func and usb_hcd_poll_rh_status in hcd.c), and that completes the 
hub's status URB, thereby invoking hub_irq in hub.c.  That last routine 
is the one which calls kick_khubd.

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
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