[OpenBIOS] r567 - in dev/olpc: kb3700 spiflash

svn at openbios.org svn at openbios.org
Sun Aug 19 03:39:34 CEST 2007


Author: wmb
Date: 2007-08-19 03:39:34 +0200 (Sun, 19 Aug 2007)
New Revision: 567

Modified:
   dev/olpc/kb3700/ecserial.fth
   dev/olpc/spiflash/recover.fth
   dev/olpc/spiflash/spiui.fth
Log:
OLPC - reliability improvements in "clone" (for debricking machines).
a) Eliminate EC watchdog resets by reading the SPI FLASH slowly (c.f. Trac #2636)
b) Tell user when and how to reset the target machine.


Modified: dev/olpc/kb3700/ecserial.fth
===================================================================
--- dev/olpc/kb3700/ecserial.fth	2007-08-19 01:13:03 UTC (rev 566)
+++ dev/olpc/kb3700/ecserial.fth	2007-08-19 01:39:34 UTC (rev 567)
@@ -17,11 +17,22 @@
    ['] noop to spi-reprogrammed
 
    d# 57600 baud
+
+   \ We have to reset the target here because it is probably confused by having
+   \ received other characters from our serial line
+   ." Reset the target system with a full power-cycle, then type a key to continue"  cr
+   begin  key?  until  key drop
+
    h# 5a uemit    ( divisor )  \ ( wait-tx )
    h# 88 spicfg!  ( divisor )  \ Write enable for SPICMD register
    h# 45 spibaud! ( )
+
+   d# 50 ms         \ Settling time
+
    d# 115200 baud
 
+   d# 50 ms         \ Settling time
+
    -1 to flash-base
 ;
 : use-serial-ec  ( -- )  ['] serial-spi-start to spi-start  ;

Modified: dev/olpc/spiflash/recover.fth
===================================================================
--- dev/olpc/spiflash/recover.fth	2007-08-19 01:13:03 UTC (rev 566)
+++ dev/olpc/spiflash/recover.fth	2007-08-19 01:39:34 UTC (rev 567)
@@ -28,7 +28,7 @@
 
 : clone  ( -- )
    ." Getting a copy of this machine's FLASH" cr
-   h# fff0.0000 flash-buf /flash move
+   slow-flash-read
    true to file-loaded?
 
    (serial-flash)

Modified: dev/olpc/spiflash/spiui.fth
===================================================================
--- dev/olpc/spiflash/spiui.fth	2007-08-19 01:13:03 UTC (rev 566)
+++ dev/olpc/spiflash/spiui.fth	2007-08-19 01:39:34 UTC (rev 567)
@@ -203,6 +203,12 @@
    /flash mfg-data-end-offset  write-flash-range         \ Write last part
 ;
 
+: .verify-msg  ( -- )
+   ." Type verify if you want to verify the data just written."  cr
+   ." Verification will take about 17 minutes if the host is running Linux" cr
+   ." or about 5 minutes if the host is running OFW." cr
+;
+
 : reflash   ( -- )   \ Flash from data already in memory
    ?file
    spi-start
@@ -222,8 +228,7 @@
       then
       spi-reprogrammed
    else
-      ." Type verify if you want to verify the data just written."  cr
-      ." Verification will take about 17 minutes..." cr
+      .verify-msg
    then   
 ;
 
@@ -238,21 +243,26 @@
 
 : flash  ( ["filename"] -- )  get-file reflash  ;
 
-[ifdef] dev
-dev /flash
+\ This is a slower version of "rom-va flash-buf /flash lmove"
+\ It works around the problem that continuous CPU access to the
+\ SPI FLASH starves the EC of instruction fetch cycles, often
+\ causing it to turn off the system.
 0 value rom-va
-: selftest  ( -- error? )
-   rom-va 0=  if  rom-pa /flash root-map-in to rom-va  then
-
-   \ This is a slower version of "rom-va flash-buf /flash lmove"
-   \ It works around the problem that continuous CPU access to the
-   \ SPI FLASH starves the EC of instruction fetch cycles, often
-   \ causing it to turn off the system.
+: slow-flash-read  ( -- )
+   rom-pa /flash root-map-in to rom-va
    /flash  0  do
       rom-va i +  flash-buf i +  h# 1.0000 lmove
       d# 200 ms
    h# 1.0000 +loop
+   rom-va /flash root-map-out  0 to rom-va
+;
 
+[ifdef] dev
+dev /flash
+: selftest  ( -- error? )
+
+   slow-flash-read
+
    \ Replace the manufacturing data block with all FF
    flash-buf mfg-data-offset +  /flash-block  h# ff fill
 
@@ -261,7 +271,6 @@
    -1 swap l!
 
    flash-buf /flash crc  <>
-   rom-va /flash root-map-out  0 to rom-va
 ;
 device-end
 [then]
@@ -291,8 +300,7 @@
    \ Don't overwrite the EC code
    flash-buf  /flash  /ec  write-flash-range
 
-   ." Type verify-bios if you want to verify the data just written."  cr
-   ." Verification will take about 17 minutes..." cr
+   .verify-msg
 ;
 : verify-bios  ( -- )  flash-buf  /flash  /ec  verify-flash-range  ;
 




More information about the OpenBIOS mailing list