Author: wmb Date: Wed Oct 5 00:21:03 2011 New Revision: 2578 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2578
Log: OLPC XO-1.75 - trac #11298 - reinit USB hardware as necessary after suspend/resume.
Modified: cpu/arm/mmp2/dramrecal.fth cpu/arm/olpc/1.75/devices.fth cpu/arm/olpc/1.75/usb.fth
Modified: cpu/arm/mmp2/dramrecal.fth ============================================================================== --- cpu/arm/mmp2/dramrecal.fth Wed Oct 5 00:14:31 2011 (r2577) +++ cpu/arm/mmp2/dramrecal.fth Wed Oct 5 00:21:03 2011 (r2578) @@ -725,6 +725,7 @@
: str ( -- ) disable-interrupts + suspend-usb timers-off
screen-off @@ -770,8 +771,8 @@
screen-on timers-on + resume-usb enable-interrupts - hdd-led-off ; : strp ( -- ) ec-rst-pwr str ec-max-pwr .d ." mW " soc .% space ;
Modified: cpu/arm/olpc/1.75/devices.fth ============================================================================== --- cpu/arm/olpc/1.75/devices.fth Wed Oct 5 00:14:31 2011 (r2577) +++ cpu/arm/olpc/1.75/devices.fth Wed Oct 5 00:21:03 2011 (r2578) @@ -334,20 +334,9 @@ then ;
-fload ${BP}/cpu/arm/olpc/1.75/usb.fth - fload ${BP}/cpu/arm/marvell/utmiphy.fth
-: init-usb ( -- ) - h# 9 h# 28285c io! \ Enable clock to USB block - reset-usb-hub - init-usb-phy -; - -stand-init: Init USB Phy -\ usb-power-on \ The EC now controls the USB power - init-usb -; +fload ${BP}/cpu/arm/olpc/1.75/usb.fth
fload ${BP}/dev/olpc/mmp2camera/loadpkg.fth
Modified: cpu/arm/olpc/1.75/usb.fth ============================================================================== --- cpu/arm/olpc/1.75/usb.fth Wed Oct 5 00:14:31 2011 (r2577) +++ cpu/arm/olpc/1.75/usb.fth Wed Oct 5 00:21:03 2011 (r2578) @@ -22,9 +22,25 @@ \ Port 3 is left \ Port 4 is right lower " 3,4,2" " usb-hub-test-list" string-property - + : suspend ( -- ) true to first-open? ; + : resume ( -- ) ; end-package
+\ Turn on USB power after a delay, to ensure that USB devices are reset correctly on boot +: usb-power-on ( -- ) ; \ The EC controls the USB power +: reset-usb-hub ( -- ) d# 146 gpio-set d# 10 ms d# 146 gpio-set ; + +: init-usb ( -- ) + h# 9 h# 5c pmua! \ Enable clock to USB block + reset-usb-hub + init-usb-phy +; + +stand-init: Init USB Phy +\ usb-power-on \ The EC now controls the USB power + init-usb +; + d# 300 config-int usb-delay \ Milliseconds to wait before probing hub ports
devalias u /usb/disk @@ -108,6 +124,24 @@ then ;
+: suspend-usb ( -- ) + detach-usb-keyboard + " /usb" " suspend" execute-device-method drop +; +: has-children? ( devspec$ -- flag ) + locate-device if false else child 0<> then +; +: any-usb-devices? ( -- flag ) " /usb/hub" has-children? ; +: resume-usb ( -- ) + init-usb + " /usb" " resume" execute-device-method drop + any-usb-devices? if + d# 2000 ms \ USB misses devices if you probe too soon + then + silent-probe-usb + attach-usb-keyboard +; + \ Unlink every node whose phys.hi component matches port : port-match? ( port -- flag ) get-unit if drop false exit then @@ -128,10 +162,6 @@ previous definitions ;
-\ Turn on USB power after a delay, to ensure that USB devices are reset correctly on boot -: usb-power-on ( -- ) ; \ The EC controls the USB power -: reset-usb-hub ( -- ) d# 146 gpio-set d# 10 ms d# 146 gpio-set ; - \ LICENSE_BEGIN \ Copyright (c) 2010 FirmWorks \
openfirmware@openfirmware.info