Author: wmb Date: Fri May 20 06:24:32 2011 New Revision: 2209 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2209
Log: OLPC trac #10819 - Improved the previous fix for this problem, now correctly handling the case where you unplug a device and immediately plug in a different device on the same port.
Modified: dev/usb2/hcd/ehci/probe.fth dev/usb2/hcd/ohci/probe.fth dev/usb2/hcd/probehub.fth dev/usb2/hcd/uhci/probe.fth
Modified: dev/usb2/hcd/ehci/probe.fth ============================================================================== --- dev/usb2/hcd/ehci/probe.fth Fri May 20 06:00:11 2011 (r2208) +++ dev/usb2/hcd/ehci/probe.fth Fri May 20 06:24:32 2011 (r2209) @@ -22,11 +22,10 @@ 0 instance value probe-error? \ Back channel to selftest
: probe-root-hub-port ( port -- ) - false to probe-error? ( port ) - dup portsc@ 1 and 0= if ( port ) \ No device detected - disable-old-nodes ( ) - exit ( -- ) - then ( port ) + false to probe-error? ( port ) + dup disable-old-nodes ( port ) + dup portsc@ 1 and 0= if drop exit then ( port ) \ No device detected + dup portsc@ h# c00 and h# 400 = if \ A low speed device detected dup disown-port \ Disown the port else \ Don't know what it is
Modified: dev/usb2/hcd/ohci/probe.fth ============================================================================== --- dev/usb2/hcd/ohci/probe.fth Fri May 20 06:00:11 2011 (r2208) +++ dev/usb2/hcd/ohci/probe.fth Fri May 20 06:24:32 2011 (r2209) @@ -5,20 +5,18 @@ headers
: probe-root-hub-port ( port -- ) - dup hc-rh-psta@ 1 and 0= if ( port ) - disable-old-nodes ( ) - exit ( -- ) - then ( port ) + dup disable-old-nodes ( port ) + dup hc-rh-psta@ 1 and 0= if drop exit then ( port )
\ Reset the port to determine the speed - dup reset-port ( port ) + dup reset-port ( port ) dup hc-rh-psta@ 200 and if speed-low else speed-full then ( port speed )
\ hub-port and hub-speed are irrelevant for OHCI (USB 1.1) - 0 0 ( port speed hub-port hub-dev ) + 0 0 ( port speed hub-port hub-dev )
\ Execute setup-new-node in root context and make-device-node in hub node context - setup-new-node if execute then ( port dev xt ) + setup-new-node if execute then ( port dev xt ) ;
false value ports-powered?
Modified: dev/usb2/hcd/probehub.fth ============================================================================== --- dev/usb2/hcd/probehub.fth Fri May 20 06:00:11 2011 (r2208) +++ dev/usb2/hcd/probehub.fth Fri May 20 06:24:32 2011 (r2209) @@ -68,10 +68,8 @@ over clear-status-change ( port error? ) if drop exit then ( port )
- hub-buf c@ 1 and 0= if ( port ) \ No device connected - disable-old-nodes ( port ) - exit - then + dup disable-old-nodes ( port ) + hub-buf c@ 1 and 0= if drop exit then ( port ) \ No device connected hub-buf le-w@ h# 600 and 9 >> ( port speed )
\ hub-port and hub-dev route USB 1.1 transactions through USB 2.0 hubs @@ -142,10 +140,9 @@
1+ 1 ?do ( hub-dev ) dup i port-status-changed? if ( hub-dev connected? ) + i disable-old-nodes ( hub-dev connected? ) if ( hub-dev ) dup i safe-probe-hub-port ( hub-dev ) - else \ Handle disconnect - i disable-old-nodes ( hub-dev ) then ( hub-dev ) else ( hub-dev ) i port-is-hub? if ( hub-dev phandle )
Modified: dev/usb2/hcd/uhci/probe.fth ============================================================================== --- dev/usb2/hcd/uhci/probe.fth Fri May 20 06:00:11 2011 (r2208) +++ dev/usb2/hcd/uhci/probe.fth Fri May 20 06:24:32 2011 (r2209) @@ -7,10 +7,8 @@ : probe-root-hub-port ( port -- ) \ Reset the port to perform connection status and speed detection dup reset-port ( port ) - dup portsc@ 1 and 0= if ( port ) \ No device-connected - disable-old-nodes ( ) - exit ( -- ) - then ( port ) + dup disable-old-nodes ( port ) + dup portsc@ 1 and 0= if drop exit then ( port ) \ No device-connected
dup portsc@ 100 and if speed-low else speed-full then ( port speed )
openfirmware@openfirmware.info