Author: quozl
Date: Sat Oct 27 05:15:27 2012
New Revision: 3388
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3388
Log:
OLPC XO-1.75 - fix incorrect SPI FLASH size detection for XO-1.75 only, the same JEDEC ID exists on parts with different sizes.
Modified:
dev/olpc/spiflash/spiflash.fth
Modified: dev/olpc/spiflash/spiflash.fth
==============================================================================
--- dev/olpc/spiflash/spiflash.fth Fri Oct 26 08:55:56 2012 (r3387)
+++ dev/olpc/spiflash/spiflash.fth Sat Oct 27 05:15:27 2012 (r3388)
@@ -307,7 +307,7 @@
\ ST, Spansion, and WinBond
h# 13 of ['] common-write 1mb-flash endof
h# 34 of ['] common-write 1mb-flash
- jedec-id h# 3425c2 = if 2mb-flash then \ MXIC 25E8035
+ \ jedec-id h# 3425c2 = if 2mb-flash then \ MXIC 25E8035
endof
\ the SST part with its unique auto-increment address writing scheme
h# bf of ['] sst-write 1mb-flash endof
Author: quozl
Date: Fri Oct 26 07:36:10 2012
New Revision: 3386
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3386
Log:
spiflash - identify some second source parts by JEDEC ID rather than the short ID
Modified:
dev/olpc/spiflash/spiflash.fth
Modified: dev/olpc/spiflash/spiflash.fth
==============================================================================
--- dev/olpc/spiflash/spiflash.fth Fri Oct 26 01:11:14 2012 (r3385)
+++ dev/olpc/spiflash/spiflash.fth Fri Oct 26 07:36:10 2012 (r3386)
@@ -303,26 +303,20 @@
0 value spi-id#
: spi-identify ( -- )
ab-id to spi-id#
- \ ST, Spansion, and WinBond all identify as 13
- \ For now, we only need to distinguish between if it's
- \ a common page-write part or the SST part with its
- \ unique auto-increment address writing scheme.
spi-id# case
+ \ ST, Spansion, and WinBond
h# 13 of ['] common-write 1mb-flash endof
- h# 34 of ['] common-write 1mb-flash endof
+ h# 34 of ['] common-write 1mb-flash
+ jedec-id h# 3425c2 = if 2mb-flash then \ MXIC 25E8035
+ endof
+ \ the SST part with its unique auto-increment address writing scheme
h# bf of ['] sst-write 1mb-flash endof
- h# 14 of ['] common-write 1mb-flash endof
- h# 35 of ['] common-write 2mb-flash endof
-\ On some old board the ID would read as 14 when it should have been something else.
-\ On CL4, 14 is the expected ID.
-\ ." The SPI FLASH ID reads as 14. This is due to an infrequent hardware problem." cr
-\ ." If you power cycle and try again, it will probably work the next time." cr
-\ abort
-\ endof
-
-\ ( default ) true abort" Unsupported SPI FLASH ID"
- ( default ) ." Bad SPI FLASH ID " dup . cr ['] null-write swap
- endcase
+ h# 14 of ['] common-write 1mb-flash
+ jedec-id h# 1540c8 = if 2mb-flash then \ XO-4 B1
+ endof
+ h# 35 of ['] common-write 2mb-flash endof \ W25Q16CV 3525c2
+ ( default ) ." Bad SPI FLASH ID " dup . cr ['] null-write swap
+ endcase ( writer )
to write-spi-flash
spi-unprotect
;
@@ -336,7 +330,7 @@
else
spi-id# case
h# 13 of ." type 13 - Spansion, Winbond, or ST" endof
- h# 14 of ." type 14 - 2 MB" endof
+ h# 14 of ." type 14" endof
h# 34 of ." type 34 - Macronyx" endof
h# 35 of ." type 35 - 2 MB" endof
endcase
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