[OpenBIOS] r412 - cpu/x86/pc/olpc dev/usb2/hcd/ehci

svn at openbios.org svn at openbios.org
Tue May 22 03:52:08 CEST 2007


Author: wmb
Date: 2007-05-22 03:52:08 +0200 (Tue, 22 May 2007)
New Revision: 412

Modified:
   cpu/x86/pc/olpc/suspend.fth
   dev/usb2/hcd/ehci/probe.fth
Log:
OLPC - USB2 devices now work after suspend/resume.


Modified: cpu/x86/pc/olpc/suspend.fth
===================================================================
--- cpu/x86/pc/olpc/suspend.fth	2007-05-22 01:51:09 UTC (rev 411)
+++ cpu/x86/pc/olpc/suspend.fth	2007-05-22 01:52:08 UTC (rev 412)
@@ -28,6 +28,7 @@
   " video-save" stdout @ $call-method  \ Freeze display
   s3
    " video-restore" stdout @ $call-method  \ Unfreeze display
+   " /usb at f,5" open-dev  ?dup  if  " resume" 2 pick $call-method  close-dev  then
 ;
 alias s suspend
 

Modified: dev/usb2/hcd/ehci/probe.fth
===================================================================
--- dev/usb2/hcd/ehci/probe.fth	2007-05-22 01:51:09 UTC (rev 411)
+++ dev/usb2/hcd/ehci/probe.fth	2007-05-22 01:52:08 UTC (rev 412)
@@ -4,6 +4,15 @@
 hex
 headers
 
+: retry-set-address  ( dev -- error? )
+   d# 200 ms
+   d# 5  0  do
+      dup  set-address  0=  if  drop false  unloop exit  then
+      d# 1000
+   loop   
+   drop true
+;
+
 : make-root-hub-node  ( port -- )
    ok-to-add-device? 0=  if  drop exit  then		\ Can't add another device
 
@@ -11,7 +20,11 @@
    speed-high over di-speed!		( port dev )
 
    0 set-target				( port dev )	\ Address it as device 0
-   dup set-address  if  2drop exit  then ( port dev )	\ Assign it usb addr dev
+
+   dup retry-set-address  if  2drop exit  then ( port dev )	\ Assign it usb addr dev
+\ d# 4000 ms
+\   dup set-address  if  2drop exit  then ( port dev )	\ Assign it usb addr dev
+
    dup set-target			( port dev )	\ Address it as device dev
    make-device-node			( )
 ;
@@ -74,6 +87,13 @@
    true
 ;
 
+: resume  ( -- )
+   init-ehci-regs
+   start-usb
+   claim-ownership
+   framelist-phys periodic!
+;
+
 : close  ( -- )
    open-count 1- to open-count
    end-extra




More information about the OpenBIOS mailing list