Author: rsmith Date: 2009-06-28 03:14:50 +0200 (Sun, 28 Jun 2009) New Revision: 1227
Modified: cpu/x86/pc/olpc/rtcwake.fth cpu/x86/pc/olpc/via/versions.fth dev/olpc/kb3700/battery.fth dev/olpc/kb3700/ecio.fth Log: - Add support for general purpose ec timer driven wakeups - Add some test code for testing ec timer driven wakeups - words for flipping of a LiFePO4 debug dump bit - autowack support code update - Make OFW pull EC version 1.9.4
Modified: cpu/x86/pc/olpc/rtcwake.fth =================================================================== --- cpu/x86/pc/olpc/rtcwake.fth 2009-06-26 18:19:51 UTC (rev 1226) +++ cpu/x86/pc/olpc/rtcwake.fth 2009-06-28 01:14:50 UTC (rev 1227) @@ -69,6 +69,21 @@ key drop ;
+\ for testing wakeups from the EC +: wackup-test-ec ( ms -- ) + d# 3000 autowack-delay \ At small ms delays the host can miss the SCI so this + \ is the back up. + 0 begin ( ms count ) + autowack-on swap dup ( count ms ms ) + ec-wackup ( count ms ) + s + swap dup ( ms count count ) + space .d (cr 1+ key? ( ms count+1 ) + until + key drop 2drop + autowack-off +; + stand-init: Century h# 20 cmos-century cmos! \ The century is in BCD, hence h# ;
Modified: cpu/x86/pc/olpc/via/versions.fth =================================================================== --- cpu/x86/pc/olpc/via/versions.fth 2009-06-26 18:19:51 UTC (rev 1226) +++ cpu/x86/pc/olpc/via/versions.fth 2009-06-28 01:14:50 UTC (rev 1227) @@ -2,10 +2,10 @@
\ The overall firmware revision macro: FW_MAJOR A -macro: FW_MINOR 04a +macro: FW_MINOR 04b
\ The EC microcode -macro: EC_VERSION 1_9_1 +macro: EC_VERSION 1_9_4
\ Alternate command for getting EC microcode, for testing new versions. \ Temporarily uncomment the line and modify the path as necessary
Modified: dev/olpc/kb3700/battery.fth =================================================================== --- dev/olpc/kb3700/battery.fth 2009-06-26 18:19:51 UTC (rev 1226) +++ dev/olpc/kb3700/battery.fth 2009-06-28 01:14:50 UTC (rev 1227) @@ -134,10 +134,11 @@
: see-bstate 0 begin - next-bstate dup . - dup 4 = if + next-bstate + dup 0 = if cr - then key? + then + dup . key? until ;
@@ -166,6 +167,13 @@ \ Turn off the trickle charger : bat-disable-trickle ( -- ) fc23 ec@ 1 invert and fc23 ec! ;
+\ Turn on the EC lifepo4 dump +: bat-enable-ec-life-dump ( -- ) f915 ec@ 8 or f915 ec! ; + +\ Turn on the EC lifepo4 dump +: bat-disable-ec-life-dump ( -- ) f915 ec@ 8 invert and f915 ec! ; + + \ Access the 1-wire data line via the EC GPIO ports
h# 383 constant dataport
Modified: dev/olpc/kb3700/ecio.fth =================================================================== --- dev/olpc/kb3700/ecio.fth 2009-06-26 18:19:51 UTC (rev 1226) +++ dev/olpc/kb3700/ecio.fth 2009-06-28 01:14:50 UTC (rev 1227) @@ -20,10 +20,6 @@ iobase 3 + pc! ;
-: autowak! ( value -- ) f64f ec! ; -: autowak-on ( -- ) 1 autowak! ; -: autowak-off ( -- ) 0 autowak! ; -: autowak-delay ( delay -- ) wbsplit f650 ec! f651 ec! ; : kbc-debug-on ( -- ) 1 fbfe ec! ; : kbc-debug-off ( -- ) 0 fbfe ec! ;
@@ -66,8 +62,10 @@
: ec-rw ( -- w ) ec-rb ec-rb swap bwjoin ; : ec-ww ( -- w ) wbsplit ec-wb ec-wb ; +: ec-wl ( -- l ) lbsplit ec-wb ec-wb ec-wb ec-wb ;
: (ec-cmd-b!) ( b cmd -- ) ec-cmd-out ec-wb ; +: (ec-cmd-l!) ( l cmd -- ) ec-cmd-out ec-wl ; : (ec-cmd-b@) ( cmd -- b ) ec-cmd-out ec-rb ; : (ec-cmd-w@) ( cmd -- w ) ec-cmd-out ec-rw ;
@@ -94,6 +92,17 @@ loop ( b cmd ) too-many-retries ; + +: ec-cmd-l! ( l cmd -- ) + #ec-retries 0 do ( b cmd ) + 2dup ['] (ec-cmd-l!) catch 0= if ( b cmd ) + 2drop unloop exit + then ( b cmd x x ) + 2drop ( b cmd ) + loop ( b cmd ) + too-many-retries +; + : ec-cmd-b@ ( cmd -- b ) #ec-retries 0 do ( cmd ) dup ['] (ec-cmd-b@) catch 0= if ( cmd b ) @@ -157,7 +166,7 @@ too-many-retries ;
-: ec-wakeup! ( wakeup -- ) lbsplit h# 36 ec-cmd-out ec-wb ec-wb ec-wb ec-wb ; +: ec-wackup ( ms -- ) lbsplit h# 36 ec-cmd-out ec-wb ec-wb ec-wb ec-wb ;
: ec-abnormal@ ( -- b ) h# 1f ec-cmd-b@ ;
@@ -181,7 +190,10 @@ : sci-inhibit ( -- ) h# 32 ec-cmd ; : sci-uninhibit ( -- ) h# 34 ec-cmd ;
-: sci-inhibit-delay ( delay -- ) wbsplit f64d ec! f64e ec! ; +: autowack-on ( -- ) 1 33 ec-cmd-b! ; +: autowack-off ( -- ) 0 33 ec-cmd-b! ; +: autowack-delay ( delay -- ) wbsplit f650 ec! f651 ec! ; + : ec-indexed-io-off ( -- ) h# fe95 ec@ h# 40 invert and h# fe95 ec! ;
0 [if]