2011年5月24日 星期二

USB Hub Problem

工作中有遇到一個問題,有些hub 無法正確工作在 high speed mode.
最後找到一個software resolution, 假如不是High Speed Mode 時,就一直reset 直到ok.
這段code 在 BSP的 USB20 的ehci 的 chw.cpp 中。
CHW::ResetAndEnablePort()
EHCI controller 以 owner 這個bit 來決定High Speed or Full Speed.
http://mkl-note.blogspot.com/2009/02/linux-ehci.html

當不是High Speed 的時候,EHCI set Owner bit 釋放所有權給UHCI或OHCI

Device detection& handover (ref EHCI r1.0 4.2.2 p.56)

  • EHCI is port owner initially
  • device connected, port detect the change, set the port connect change bit, (if enabled) issue interrupt
  • driver check LineStatus (PORTSC[11:10])
    • Not Low-speed device, perform EHCI reset (PORTSC[8])
      • if PortEnable (PORTSC[2]) == 1, the device is a High-speed device
      • if PortEnable (PORTSC[2]) == 0, the device is a Full-speed device, set PortOwner (PORTSC[13]) to 1 to release the port ownership
    • Low-speed device, set PortOwner(PORTSC[13]) to 1 to release the port ownership

Whenever the PortOwner(PORTSC[13]) is set to 1,
  • EHCI set the disconnect change bit, (if enabled) issue interrupt, and the port reported no device connected.
While EHCI doesn't own the port, the port stay in disconnected state.
When disconnect occur, both cHC and EHCI would detect the disconnect event, and the port ownership is returned to the EHCI.

沒有留言: