Author: quozl
Date: Mon Apr 29 08:02:14 2013
New Revision: 3651
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3651
Log:
OLPC XO-1 - suppress the RTC amnesia check introduced in r3649, because the VRT bit works fine, and the century value at 0x1a is occasionally cleared by a power cycle. This clearing is ingored by ds1385r.fth get-time, which forces the returned century to 0x20. Curiously, the century value at 0x32 (as set by MSR 5140.0057) is not used in ds1385r.fth, and keeps what Linux set it to.
Modified:
cpu/x86/pc/olpc/via/config.fth
dev/ds1385r.fth
Modified: cpu/x86/pc/olpc/via/config.fth
==============================================================================
--- cpu/x86/pc/olpc/via/config.fth Mon Apr 29 07:55:38 2013 (r3650)
+++ cpu/x86/pc/olpc/via/config.fth Mon Apr 29 08:02:14 2013 (r3651)
@@ -3,6 +3,7 @@
create olpc \ OLPC-specific build
create olpc-cl1
+create olpc-xo-1.5
create compute-timings
\ create demo-board
Modified: dev/ds1385r.fth
==============================================================================
--- dev/ds1385r.fth Mon Apr 29 07:55:38 2013 (r3650)
+++ dev/ds1385r.fth Mon Apr 29 08:02:14 2013 (r3651)
@@ -88,6 +88,7 @@
cr
then
;
+[ifdef] olpc-xo-1.5
\ : $?lost ( flag head$ -- flag )
\ 2 pick if ." RTC amnesia - " type cr else 2drop then
\ ;
@@ -112,6 +113,7 @@
d# 10 rtc@ h# 70 and rega-mode h# 70 and <> \ " divider" $?lost
or
;
+[then]
: reinit
h# 20 h# 1a rtc! \ century
h# 13 h# 9 rtc! \ year
@@ -128,7 +130,9 @@
: open ( -- true )
my-unit 2 " map-in" $call-parent is rtc-adr
first-open? if
- amnesia? if reinit then
+ [ifdef] olpc-xo-1.5
+ amnesia? if reinit then
+ [then]
rega-mode d# 10 rtc!
regb-mode d# 11 rtc!
\ If the battery is bad, display a message, but go open the device anyway
Author: quozl
Date: Sat Apr 27 07:47:57 2013
New Revision: 3649
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3649
Log:
OLPC XO-1.5 - the Valid RAM and Time (VRT) bit in RTC register 0xd can't be trusted on the XO-1.5, so use other means to detect loss of data. This works in most cases, but there is still the possibility of data corruption when the battery is missing or discharged. #12600.
Modified:
dev/ds1385r.fth
Modified: dev/ds1385r.fth
==============================================================================
--- dev/ds1385r.fth Thu Apr 18 06:11:10 2013 (r3648)
+++ dev/ds1385r.fth Sat Apr 27 07:47:57 2013 (r3649)
@@ -88,6 +88,30 @@
cr
then
;
+\ : $?lost ( flag head$ -- flag )
+\ 2 pick if ." RTC amnesia - " type cr else 2drop then
+\ ;
+: amnesia? ( -- flag )
+ 0 rtc@ h# 59 > \ " seconds" $?lost
+ 2 rtc@ h# 59 > \ " minutes" $?lost
+ or
+ 4 rtc@ h# 23 > \ " hours" $?lost
+ or
+ 6 rtc@ h# 10 = \ " day of week" $?lost
+ or
+ 7 rtc@ dup 0= swap h# 31 > or \ " day of month" $?lost
+ or
+ 8 rtc@ dup 0= swap h# 12 > or \ " month" $?lost
+ or
+ 9 rtc@ h# 99 > \ " year high" $?lost
+ or
+ 9 rtc@ h# 13 < \ " year low" $?lost
+ or
+ h# 1a rtc@ h# 20 <> \ " century" $?lost
+ or
+ d# 10 rtc@ h# 70 and rega-mode h# 70 and <> \ " divider" $?lost
+ or
+;
: reinit
h# 20 h# 1a rtc! \ century
h# 13 h# 9 rtc! \ year
@@ -104,6 +128,7 @@
: open ( -- true )
my-unit 2 " map-in" $call-parent is rtc-adr
first-open? if
+ amnesia? if reinit then
rega-mode d# 10 rtc!
regb-mode d# 11 rtc!
\ If the battery is bad, display a message, but go open the device anyway