Author: wmb Date: Thu Nov 25 00:38:16 2010 New Revision: 2037 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2037
Log: OLPC XO-1.75 - Get board revision from the EC.
Modified: cpu/arm/olpc/1.75/devices.fth cpu/arm/olpc/1.75/fw.bth dev/olpc/kb3700/eccmds.fth dev/olpc/kb3700/ecio.fth
Modified: cpu/arm/olpc/1.75/devices.fth ============================================================================== --- cpu/arm/olpc/1.75/devices.fth Wed Nov 24 21:33:20 2010 (r2036) +++ cpu/arm/olpc/1.75/devices.fth Thu Nov 25 00:38:16 2010 (r2037) @@ -230,6 +230,7 @@
fload ${BP}/dev/olpc/kb3700/eccmds.fth fload ${BP}/cpu/arm/olpc/1.75/ecflash.fth +fload ${BP}/cpu/arm/olpc/1.75/boardrev.fth \ Board revision decoding
0 0 " d4208000" " /" begin-package \ USB Host Controller h# 200 constant /regs @@ -281,15 +282,14 @@ : stand-init stand-init root-device -[ifdef] notyet model-name$ 2dup model ( name$ ) " OLPC " encode-bytes 2swap encode-string encode+ " banner-name" property board-revision " board-revision-int" integer-property -[then] + \ The "1-" removes the null byte " SN" find-tag if 1- else " Unknown" then " serial-number" string-property [ifdef] notyet - 8 ec-cmd-b@ dup " ec-version" integer-property + ec-api-ver@ " ec-version" integer-property
XXX Get EC name with an EC command " ec-name" string-property
Modified: cpu/arm/olpc/1.75/fw.bth ============================================================================== --- cpu/arm/olpc/1.75/fw.bth Wed Nov 24 21:33:20 2010 (r2036) +++ cpu/arm/olpc/1.75/fw.bth Thu Nov 25 00:38:16 2010 (r2037) @@ -126,8 +126,6 @@
fload ${BP}/cpu/x86/pc/olpc/via/banner.fth
-h# d00 value board-revision \ Implement me!!! - \ This must be defined after spiui.fth, otherwise spiui will choose some wrong code : rom-pa ( -- adr ) mfg-data-buf mfg-data-offset - ; \ Fake out setwp.fth fload ${BP}/cpu/x86/pc/olpc/setwp.fth
Modified: dev/olpc/kb3700/eccmds.fth ============================================================================== --- dev/olpc/kb3700/eccmds.fth Wed Nov 24 21:33:20 2010 (r2036) +++ dev/olpc/kb3700/eccmds.fth Thu Nov 25 00:38:16 2010 (r2037) @@ -37,40 +37,30 @@ loop too-many-retries ; -: (bat-gauge@) ( -- b ) h# 31 1 1 h# 18 do-ec-cmd ; \ 31 is the EEPROM address -: bat-gauge@ ( -- b ) - #ec-retries 0 do - ['] (bat-gauge@) catch 0= if unloop exit then - loop - too-many-retries -;
-: (bat-type@) ( -- b ) h# 5f 1 1 h# 18 do-ec-cmd ; \ 5f is the EEPROM address -: bat-type@ ( -- b ) - #ec-retries 0 do - ['] (bat-type@) catch 0= if unloop exit then - loop - too-many-retries -;
-: board-id ( -- n ) h# 19 ec-cmd-w@ ; +: board-id@ ( -- n ) h# 19 ec-cmd-w@ ; : reset-ec ( -- ) h# 28 ec-cmd ;
+: bat-type@ ( -- b ) h# 2c ec-cmd-b@ ; : autowack-on ( -- ) 1 33 ec-cmd-b! ; : autowack-off ( -- ) 0 33 ec-cmd-b! ;
+: bat-gauge@ ( -- w ) h# 4e ec-cmd-w@ ; + : ec-echo ( ... n -- ... ) dup h# 52 do-ec-cmd ;
+: mppt-active@ ( -- b ) h# 3d ec-cmd-b@ ; + +: bat-cause@ ( -- b ) h# 1f ec-cmd-b@ ; + [ifdef] notdef -#define CMD_READ_BATT_ERR_CODE 0x1f -#define CMD_READ_BATTERY_TYPE 0x2c #define CMD_SET_EC_WAKEUP_TIMER 0x36 #define CMD_READ_EXT_SCI_MASK 0x37 #define CMD_WRITE_EXT_SCI_MASK 0x38 #define CMD_CLEAR_EC_WAKEUP_TIMER 0x39 #define CMD_ENABLE_RUNIN_DISCHARGE 0x3B #define CMD_DISABLE_RUNIN_DISCHARGE 0x3C -#define CMD_READ_MPPT_ACTIVE 0x3d #define CMD_READ_MPPT_LIMIT 0x3e #define CMD_SET_MPPT_LIMIT 0x3f #define CMD_DISABLE_MPPT 0x40 @@ -79,15 +69,12 @@ #define CMD_EXT_SCI_QUERY 0x43 #define CMD_READ_LOCATION 0x44 #define CMD_WRITE_LOCATION 0x45 -#define CMD_KEYBOARD_CMD 0x46 -#define CMD_TOUCHPAD_CMD 0x47 #define RSP_KEYBOARD_DATA 0x48 #define RSP_TOUCHPAD_DATA 0x49 #define CMD_GET_FW_VER 0x4a #define CMD_POWER_CYCLE 0x4b #define CMD_POWER_OFF 0x4c #define CMD_RESET_EC_SOFT 0x4d -#define CMD_READ_GUAGE_U16 0x4e #define CMD_ENABLE_MOUSE 0x4f [then]
Modified: dev/olpc/kb3700/ecio.fth ============================================================================== --- dev/olpc/kb3700/ecio.fth Wed Nov 24 21:33:20 2010 (r2036) +++ dev/olpc/kb3700/ecio.fth Thu Nov 25 00:38:16 2010 (r2037) @@ -238,6 +238,8 @@ : sci-inhibit ( -- ) h# 32 ec-cmd ; : sci-uninhibit ( -- ) h# 34 ec-cmd ;
+: mppt-active@ ( -- b ) h# 3d ec-cmd-b@ ; + : autowack-on ( -- ) 1 33 ec-cmd-b! ; : autowack-off ( -- ) 0 33 ec-cmd-b! ; : autowack-delay ( delay -- ) wbsplit f650 ec! f651 ec! ;
openfirmware@openfirmware.info