Author: quozl Date: Fri Dec 7 02:22:53 2012 New Revision: 3477 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3477
Log: OLPC XO-4 - add EC 16-bit battery status command, rework to allow automatic upgrade from Q7B07 EC 0.3.04, reported by Chia-Hsiu
Modified: dev/olpc/kb3700/eccmdcom.fth dev/olpc/kb3700/eccmds.fth
Modified: dev/olpc/kb3700/eccmdcom.fth ============================================================================== --- dev/olpc/kb3700/eccmdcom.fth Thu Dec 6 23:11:22 2012 (r3476) +++ dev/olpc/kb3700/eccmdcom.fth Fri Dec 7 02:22:53 2012 (r3477) @@ -23,16 +23,10 @@ : mppt-off ( -- ) h# 40 ec-cmd ; : mppt-on ( -- ) h# 41 ec-cmd ; : vin@ ( -- b ) h# 42 ec-cmd-w@ ; -: bat-status16@ ( -- w ) h# 70 ec-cmd-w@ ;
-defer bat-status@ +defer bat-status@ ( -- w ) ' bat-status8@ is bat-status@
-[ifdef] olpc-xo4 -' bat-status16@ is bat-status@ -[then] - - \ LICENSE_BEGIN \ Copyright (c) 2010 FirmWorks \
Modified: dev/olpc/kb3700/eccmds.fth ============================================================================== --- dev/olpc/kb3700/eccmds.fth Thu Dec 6 23:11:22 2012 (r3476) +++ dev/olpc/kb3700/eccmds.fth Fri Dec 7 02:22:53 2012 (r3477) @@ -30,7 +30,7 @@ : ec-cmd-w! ( w cmd -- ) >r wbsplit 2 0 r> do-ec-cmd ; : ec-cmd-l! ( l cmd -- ) >r lbsplit 4 0 r> do-ec-cmd ;
-fload ${BP}/dev/olpc/kb3700/eccmdcom.fth \ Common commands +fload ${BP}/dev/olpc/kb3700/eccmdcom.fth \ Common commands
\ Commands that are different for XO-1.75 : board-id@ ( -- n ) h# 19 ec-cmd-w@ ; @@ -112,6 +112,26 @@ #define CMD_ENABLE_MOUSE 0x4f [then]
+\ Commands that are different for XO-4 + +: bat-status16@ ( -- w ) h# 70 ec-cmd-w@ ; +[ifdef] olpc-xo4 +' bat-status16@ is bat-status@ +[then] + +\ until EC 0.3.04 and earlier are purged from prototype population, +\ choose command based on API version reported by EC. +: bat-status@' ( -- w ) + ec-api-ver@ 5 < if + ['] bat-status8@ + else + ['] bat-status16@ + then + is bat-status@ + bat-status@ +; +' bat-status@' is bat-status@ + \ LICENSE_BEGIN \ Copyright (c) 2010 FirmWorks \
openfirmware@openfirmware.info