Author: quozl
Date: Thu Oct 25 09:30:24 2012
New Revision: 3383
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3383
Log:
OLPC XO-4 - automatic reflash of Neonode touchscreen firmware, costs 276ms each boot
Added:
cpu/arm/olpc/4.0/nn-version.fth
cpu/arm/olpc/4.0/nn.bth
cpu/arm/olpc/fetch-nn.fth
cpu/arm/olpc/nnflash.fth
Modified:
cpu/arm/olpc/4.0/olpc.bth
cpu/arm/olpc/bsl.fth
cpu/arm/olpc/build-fw.fth
Added: cpu/arm/olpc/4.0/nn-version.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/4.0/nn-version.fth Thu Oct 25 09:30:24 2012 (r3383)
@@ -0,0 +1,5 @@
+\ The Neonode touchscreen firmware
+macro: NN_VERSION 0_0_0_5
+
+\ FIXME: change in nnflash.fth too, until it knows how to read it
+\ using Neonode's instructions.
Added: cpu/arm/olpc/4.0/nn.bth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/4.0/nn.bth Thu Oct 25 09:30:24 2012 (r3383)
@@ -0,0 +1,7 @@
+purpose: Fetch the Neonode touchscreen firmware
+
+command: &builder &this
+build-now
+
+fload ${BP}/cpu/arm/olpc/4.0/nn-version.fth
+fload ${BP}/cpu/arm/olpc/fetch-nn.fth
Modified: cpu/arm/olpc/4.0/olpc.bth
==============================================================================
--- cpu/arm/olpc/4.0/olpc.bth Thu Oct 25 09:17:51 2012 (r3382)
+++ cpu/arm/olpc/4.0/olpc.bth Thu Oct 25 09:30:24 2012 (r3383)
@@ -2,6 +2,7 @@
command: &builder &this
in: ${BP}/cpu/arm/olpc/4.0/build/ec.img
+in: ${BP}/cpu/arm/olpc/4.0/build/nn.img
in: ${BP}/cpu/arm/olpc/4.0/build/fw.img
in: ${BP}/cpu/arm/olpc/4.0/build/resetvec.img
in: ${BP}/cpu/arm/olpc/4.0/build/mcastnand.bin
@@ -154,6 +155,7 @@
" nandblaster_tx.bin" " nb_tx" $add-deflated-dropin
" ec.img" " ecimage.bin" $add-deflated-dropin
+ " nn.hex" " nn.hex" $add-deflated-dropin
" ${BP}/clients/emacs/x86/emacs.rc" " emacs.rc" $add-deflated-dropin
" ${BP}/clients/emacs/emacs.hlp" " emacs.hlp" $add-deflated-dropin
" ${BP}/clients/emacs/arm/emacs" " emacs" $add-deflated-dropin
Modified: cpu/arm/olpc/bsl.fth
==============================================================================
--- cpu/arm/olpc/bsl.fth Thu Oct 25 09:17:51 2012 (r3382)
+++ cpu/arm/olpc/bsl.fth Thu Oct 25 09:30:24 2012 (r3383)
@@ -222,7 +222,9 @@
ack? 0= abort" BSL - no ACK!"
;
+defer bsl-progress ' 2drop is bsl-progress ( offset size -- )
: rx-data-block ( adr len device-adr -- )
+ dup h# 8000 - h# 8000 bsl-progress
over h# 12 frame( ( adr len device-adr )
send-summed ( adr len ) \ device address
dup send-summed ( adr len ) \ data length
Modified: cpu/arm/olpc/build-fw.fth
==============================================================================
--- cpu/arm/olpc/build-fw.fth Thu Oct 25 09:17:51 2012 (r3382)
+++ cpu/arm/olpc/build-fw.fth Thu Oct 25 09:30:24 2012 (r3383)
@@ -366,6 +366,7 @@
fload ${BP}/cpu/arm/mmp2/fuse.fth
[ifdef] bsl-uart-base
fload ${BP}/cpu/arm/olpc/bsl.fth
+fload ${BP}/cpu/arm/olpc/nnflash.fth
[then]
[ifndef] virtual-mode
@@ -857,6 +858,19 @@
update-ec-flash
then
then
+[ifdef] update-nn-flash?
+ update-nn-flash? if
+ ['] ?enough-power catch ?dup if ( error )
+ show-no-power
+ .error
+ ." Skipping NN reflash, not enough power" cr
+ d# 1000 ms
+ else
+ jots ['] jot to bsl-progress
+ update-nn-flash
+ then
+ then
+[then]
\+ use-screen-kbd open-hotspot
install-alarm
Added: cpu/arm/olpc/fetch-nn.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/fetch-nn.fth Thu Oct 25 09:30:24 2012 (r3383)
@@ -0,0 +1,15 @@
+purpose: Common code for fetching the NN firmware
+
+\ The macro NN_VERSION, and optionally GET_NN, must be defined externally
+
+\ If there is a GET_NN macro, use it instead of fetching the released version.
+" ${GET_NN}" expand$ nip [if]
+ " ${GET_NN}" expand$ $sh
+[else]
+ " wget -q http://dev.laptop.org/pub/firmware/nn/zForce_Touch_Driver_OLPC_${NN_VERSION… -O nn.hex" expand$ $sh
+[then]
+
+\ This forces the creation of an nn.log file, so we don't re-fetch nn.img
+writing nn.version
+" ${NN_VERSION}"n" expand$ ofd @ fputs
+ofd @ fclose
Added: cpu/arm/olpc/nnflash.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/nnflash.fth Thu Oct 25 09:30:24 2012 (r3383)
@@ -0,0 +1,58 @@
+\ See license at end of file
+purpose: Reflash a Neonode touchscreen controller
+
+: get-touchscreen-version ( -- version.d )
+ " /touchscreen" open-dev ( handle )
+ dup 0= abort" could not open touchscreen"
+ " get-version" 2 pick $call-method ( handle version.d )
+ >r >r close-dev r> r> ( version.d )
+;
+
+: nn-image$ " rom:\nn.hex" ;
+
+: reflash-nn ( file$ -- )
+ $flash-bsl
+;
+: flash-nn ( "filename" -- ) safe-parse-word ?enough-power reflash-nn ;
+: flash-nn! ( "filename" -- ) safe-parse-word reflash-nn ;
+: nn-up-to-date? ( file$ -- flag )
+ 2drop h# 0000.0000.0000.0005. \ FIXME: get version from file
+ get-touchscreen-version
+ d<=
+;
+
+: update-nn-flash ( -- )
+ nn-image$ 2dup nn-up-to-date? if
+ 2drop
+ else
+ reflash-nn
+ then
+;
+
+: update-nn-flash? ( -- flag )
+ nn-image$ nn-up-to-date? 0=
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2012 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Author: wmb
Date: Wed Oct 24 20:37:38 2012
New Revision: 3380
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3380
Log:
OLPC XO-1.75 - Script to modify fuse settings so that production 1 GHz MMP2 chips use the same speed code as 1 Ghz engineering sample chips.
Added:
cpu/arm/mmp2/fusepgm.fth
Added: cpu/arm/mmp2/fusepgm.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/fusepgm.fth Wed Oct 24 20:37:38 2012 (r3380)
@@ -0,0 +1,86 @@
+\ Script to change the speed code in 1 GHz production MMP2 chips to
+\ match the old speed code value that was used for 1 GHz engineering
+\ sample MMP2 chips.
+
+0 value fuse-block#
+: fuse-ena! ( n -- ) h# 68 pmua! ;
+: fuse-ena@ ( -- n ) h# 68 pmua@ ;
+
+: ena-fuse-module ( -- )
+ \ Do not touch the enable register if it is already enabled.
+ \ That register also controls the interface between the SP and
+ \ PJ4 processors, which is used for keyboard communication.
+ \ The enabling process resets the device, causing system lockups
+ \ if the keyboard interface is active.
+ fuse-ena@ h# 1b = if exit then
+
+ h# 08 fuse-ena!
+ h# 09 fuse-ena!
+ h# 19 fuse-ena!
+ h# 1b fuse-ena!
+;
+
+: fuse-ctl! ( n -- )
+ fuse-block# d# 18 lshift or h# 292804 io!
+ d# 100 ms
+;
+
+: otp-setup ( -- )
+ ena-fuse-module
+ h# 0002.0000 fuse-ctl! \ HiV
+ h# 0042.0000 fuse-ctl! \ Reset + HiV
+ h# 0002.0000 fuse-ctl! \ HiV
+;
+: otp-teardown ( -- )
+ h# 0200.4000 fuse-ctl! \ ClkDiv + SOFT
+ h# 0240.4000 fuse-ctl! \ ClkDiv + SetRst + SOFT
+ h# 0200.4000 fuse-ctl! \ ClkDiv + SOFT
+;
+
+: pgm-fuses2 ( v7 v6 v5 v4 v3 v2 v1 v0 block# -- )
+ to fuse-block# ( v7 v6 v5 v4 v3 v2 v1 v0 )
+ otp-setup ( v7 v6 v5 v4 v3 v2 v1 v0 )
+ h# 292838 h# 20 bounds do i io! 4 +loop ( )
+
+ h# 0203.4000 fuse-ctl! \ ClkDiv + HiV + Burn + SOFT
+ begin h# 292984 io@ h# 100 and until \ Wait for complete
+ h# 0202.4000 fuse-ctl! \ ClkDiv + HiV + + SOFT
+ h# 0200.4000 fuse-ctl! \ ClkDiv + + SOFT
+ h# 0240.4000 fuse-ctl! \ ClkDiv + SetRst + SOFT
+ h# 0200.4000 fuse-ctl! \ ClkDiv + + SOFT
+
+ otp-teardown
+;
+
+2 value es-speed-1g \ This is the engineering sample speed code for 1 GHz parts
+: fix-speed ( -- )
+ ena-fuse-module
+
+ \ Reprogram only if the divider values are the ones that we
+ \ observe in the first batch of production parts - indicating
+ \ that the SoC is not an engineering sample
+ h# 290c fuse@ h# 90001410 = if
+
+ \ Reprogram only if the SW version field is 0 - a virgin part
+ \ that we have not yet reprogrammed
+ h# 2898 fuse@ 0= if
+
+ \ If the speed code indicates a 988 MHz part, change the
+ \ speed code to the old engineering sample code for 1001 MHz
+ \ and reboot to switch to the higher speed
+ rated-speed 0= if
+ es-speed-1g d# 14 lshift 0 0 1 0 0 0 0 3 pgm-fuses2
+ bye
+ then
+
+ \ If the speed code has already been reprogrammed to the
+ \ engineering sample 1001 MHz value, but the SW version field
+ \ is 0, set the SW version field to 1. This fixes an initial
+ \ batch of 200 chips whose speed code was reprogrammed
+ \ using a different procedure.
+ rated-speed 2 = if
+ 0 0 0 1 0 0 0 0 3 pgm-fuses2
+ then
+ then
+ then
+;
Author: rsmith
Date: Sat Oct 20 03:43:01 2012
New Revision: 3376
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3376
Log:
OLPC XO-4 - EC Code 0.2.04
Modified:
cpu/arm/olpc/4.0/ec-version.fth
Modified: cpu/arm/olpc/4.0/ec-version.fth
==============================================================================
--- cpu/arm/olpc/4.0/ec-version.fth Sat Oct 20 03:42:59 2012 (r3375)
+++ cpu/arm/olpc/4.0/ec-version.fth Sat Oct 20 03:43:01 2012 (r3376)
@@ -1,6 +1,6 @@
\ The EC microcode
macro: EC_PLATFORM cl4
-macro: EC_VERSION 7_0_2_03
+macro: EC_VERSION 7_0_2_04
\ Alternate command for getting EC microcode, for testing new versions.
\ Temporarily uncomment the line and modify the path as necessary