[openfirmware] [commit] r3589 - cpu/arm/mmp3
repository service
svn at openfirmware.info
Tue Mar 5 06:25:21 CET 2013
Author: quozl
Date: Tue Mar 5 06:25:21 2013
New Revision: 3589
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3589
Log:
OLPC XO-4 - fix scaling of battery temperature when using .thermal , a regression introduced in r3400. Add a command for testing the low range of the first sensor. Remove some dead code.
Modified:
cpu/arm/mmp3/thermal.fth
Modified: cpu/arm/mmp3/thermal.fth
==============================================================================
--- cpu/arm/mmp3/thermal.fth Tue Mar 5 06:05:16 2013 (r3588)
+++ cpu/arm/mmp3/thermal.fth Tue Mar 5 06:25:21 2013 (r3589)
@@ -133,21 +133,32 @@
dup ts@ h# 0800.0000 invert and swap ts!
;
-: ts-watchdog-enable ( n -- )
- dup ts@ h# 0400.0d00 or swap ts! \ 100.5C
+h# 0400.0d00 value ts-watchdog-mask \ 100.5C
+: ts-watchdog-on ( n -- )
+ dup ts@ ts-watchdog-mask or swap ts!
+;
+
+: ts-watchdog-off ( n -- )
+ dup ts@ ts-watchdog-mask invert and swap ts!
;
: init-thermal-sensor ( -- )
ts-clocks
0 ts-range-high
- 0 ts-watchdog-enable
- \ WDT reset will cause system hang, per errata 472630,
- \ but on XO-4 A2 and XO-4 B1 is detected by EC
+ 0 ts-watchdog-on
+ \ WDT reset causes SoC hang, per errata 472630, on XO-4 A2 and B1,
+ \ but is detected and handled by EC
1 ts-range-low
2 ts-range-low
3 0 do i ts-auto-read loop
;
+\ for testing, swing our normally highrange sensor back to lowrange
+: 0ts-low
+ 0 ts-watchdog-off
+ 0 ts-range-low
+;
+
\ read and average the two sensors on lowrange duty
: cpu-temperature ( -- celcius )
1 ts-read gc>c
@@ -171,7 +182,7 @@
1 ts@ gc>c .c.c \ FIXME: show <n and >n too here
2 ts@ gc>c .c.c
." cpu: " cpu-temperature .c
- ." battery: " bat-temp .c
+ ." battery: " .bat-temp ." C "
pop-base
;
@@ -211,7 +222,6 @@
i tsense-regx-bits count type space
then
loop cr
- \ dup d# 12 rshift h# 7ff and dup if 4 spaces ." reserved=" . cr else drop then
4 spaces dup 8 rshift h# f and ." wdog_tshld=" .tc cr
4 spaces dup 4 rshift h# f and ." int_tshld=" .tc cr
4 spaces dup h# f and ." temp_value=" .tc cr
@@ -248,27 +258,6 @@
h# 0c20.0000 h# 03.b004 io! \ lowrange, en_wdog, auto_read_en, wdog_tshld 26C
;
-
-[ifdef] notyet \ FIXME
-: test-thermal
- .thermal cr
-
- \ save the threshold set by cforth
- thermal-base 4 + io@ >r
-
- \ temporarily set the threshold close to current value
- thermal-base io@ h# 3ff and 8 + wd-thresh!
-
- begin
- (cr .thermal kill-line d# 500 ms key?
- until key drop cr
-
- \ restore the threshold
- r> wd-thresh!
- .thermal cr
-;
-[then]
-
stand-init: Thermal sensor
init-thermal-sensor
;
More information about the openfirmware
mailing list