usb problems - ehci and umass and possible fix

Michal Mertl mime at traveller.cz
Mon Jan 10 15:11:53 PST 2005


Hello,

I've just found one problem with my hardware and I did some analysis of
the problem. Even when it's, as I suppose, a known issue, the fix
mentioned below might help someone.

I've got Pentium-M based notebook and an USB2 memory stick. When I try
to use it with EHCI it fails yet it works with UHCI. I found out that it
works with EHCI when I enable high debugging in EHCI driver
(hw.usb.ehci.debug). ISTR I read somewhere some USB problems might be
related to timing issues and that seems to confirm it - with high debug
lots of messages are generated which probably slow down the operation a
lot.

I need to enable the debug only for attaching the device. After it
succesfully attaches I can disable the debug and use the device without
problems. Lately I've also seen improper initialisation with UHCI, so
the problem isn't EHCI specific at the end. With UHCI I get 2 of 3 good
initilizations and none whatsoever with EHCI.

Error messages with debug disabled seem to come from the cam layer.

umass0: M-SysT5 Dell Memory Key, rev 2.00/2.00, addr 2
umass0: SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
pass0 at umass-sim0 bus 0 target 0 lun 0
pass0: <M-SysT5 Dell Memory Key 5.00> Removable Direct Access SCSI-0
device
pass0: Serial Number u
pass0: 1.000MB/s transfers
GEOM: new disk da0
(da0:umass-sim0:0:0:0): Retrying Command
(da0:umass-sim0:0:0:0): Retrying Command
(da0:umass-sim0:0:0:0): Retrying Command
(da0:umass-sim0:0:0:0): Retrying Command
(da0:umass-sim0:0:0:0): error 6
(da0:umass-sim0:0:0:0): Unretryable Error
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <M-SysT5 Dell Memory Key 5.00> Removable Direct Access SCSI-0
device
da0: Serial Number u
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: UNIT ATTENTION, Medium not
present
(da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI Status: Check Condition
(da0:umass-sim0:0:0:0): UNIT ATTENTION asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
(da0:umass-sim0:0:0:0): (da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0
0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): UNIT ATTENTION asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
Retrying Command (per Sense Data)
(da0:umass-sim0:0:0:0): Retrying Command


I thought the problem might be in the device doesn't get normally enough
time to initialize. The debug output/failure happens immediately when
the device is plugged in. I think most devices powered from USB might
actually need a bit of time before they are ready to process commands.
It seems FreeBSD gives them in general 300ms which is far too little.
For example in Linux sources I found out a delay (or timeout) of 20
seconds for umass devices.

I tried to look for information on allowed delays in usb specs but
wasn't successful.

One solution might be to increase the default delay #define'd in
src/sys/dev/usb.h USB_PORT_POWERUP_DELAY. According to mentioned Linux
source it seems no delay might be long enough :-(. Increasing it to 
say 2000 from the current 300ms might still be good enough for most
devices. Other solution might be to add some delay before initialization
of some classes of devices (like umass) or adding quirks.

P.S. The increase of USB_PORT_POWERUP_DELAY really works for me.

Regards

Michal Mertl 



More information about the freebsd-current mailing list