[openfirmware] [commit] r3004 - dev/usb2/hcd/ehci

repository service svn at openfirmware.info
Thu Jun 7 08:05:24 CEST 2012


Author: quozl
Date: Thu Jun  7 08:05:24 2012
New Revision: 3004
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3004

Log:
OLPC - probe all ports of the EHC during a test, regardless of whether they are in use.  Remove fisheye test from default testing, because it is not used in manufacturing, and had been incorrectly used in the field to verify a port is working.  No change to manufacturing tests.  #11845.

Modified:
   dev/usb2/hcd/ehci/probe.fth

Modified: dev/usb2/hcd/ehci/probe.fth
==============================================================================
--- dev/usb2/hcd/ehci/probe.fth	Thu Jun  7 02:04:14 2012	(r3003)
+++ dev/usb2/hcd/ehci/probe.fth	Thu Jun  7 08:05:24 2012	(r3004)
@@ -60,6 +60,7 @@
    then                                              ( #testable-ports )
 ;
 
+\ Port owned by usb 1.1 controller (2000) or device is present (1)
 : port-connected?  ( port# -- flag )  portsc@ h# 2001 and  ;
 : wait-connect  ( port# -- error? )
    begin                            ( port# )
@@ -153,29 +154,60 @@
    open-count 0=  if  free-dma-buf unmap-regs  then
 ;
 
-: selftest  ( -- error? )
-   ehci-reg dup 0=  if  map-regs  then
+: .occupied  ( port -- )  ." USB 2.0 port " u. ."  in use" cr  ;
+: regs{  ( -- prev )  ehci-reg dup 0=  if  map-regs  then  ;
+: }regs  ( prev -- )  0=  if  unmap-regs  then  ;
 
+: fisheye  ( -- )
+   regs{
    #testable-ports  0  ?do
-      i port-connected?  if		\ Port owned by usb 1.1 controller (2000) or device is present (1)
-         ." USB 2.0 port " i u. ."  in use" cr
+      i port-connected?  if
+         i .occupied
       else
-         diagnostic-mode?  if
-            ." Please connect a device to USB port " i u. cr
-            i wait-connect  if  true unloop exit  then
-         else
-            ." Fisheye pattern out to USB 2.0 port " i u. cr
-            i test-port-begin
-            d# 2,000 ms
-            i test-port-end
-            0 i portsc!  i reset-port  i power-port
-         then
+         ." Fisheye pattern out to USB 2.0 port " i u. cr
+         i test-port-begin
+         d# 2,000 ms
+         i test-port-end
+         0 i portsc!  i reset-port  i power-port
+      then
+   loop
+   }regs
+;
+
+: thorough  ( -- error? )
+   #testable-ports  0  ?do
+      i port-connected?  if
+         i .occupied
+      else
+         ." Please connect a device to USB port " i u. cr
+         i wait-connect  if  true unloop exit  then
+      then
+   loop
+   false
+;
+
+: sagacity  ( -- error? )
+   #testable-ports  0  ?do
+      ." USB port " i u. ." ... "
+      i port-connected?  if
+         i wait-connect  if  true unloop exit  then
+      else
+         ." Empty" cr
       then
    loop
-   0=  if  unmap-regs  then
    false
 ;
 
+: selftest  ( -- error? )
+   regs{                        ( prev )
+   diagnostic-mode?  if
+      thorough
+   else
+      sagacity
+   then                         ( prev error? )
+   swap }regs                   ( error? )
+;
+
 headers
 
 \ LICENSE_BEGIN



More information about the openfirmware mailing list