[openfirmware] [commit] r2509 - cpu/arm/mmp2

repository service svn at openfirmware.info
Thu Sep 15 07:39:43 CEST 2011


Author: quozl
Date: Thu Sep 15 07:39:43 2011
New Revision: 2509
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2509

Log:
OLPC XO-1.75 - avoid turning off thermal sensor watchdog reset during watchdog configuration, add thermal sensor watchdog test script

Modified:
   cpu/arm/mmp2/thermal.fth
   cpu/arm/mmp2/watchdog.fth

Modified: cpu/arm/mmp2/thermal.fth
==============================================================================
--- cpu/arm/mmp2/thermal.fth	Wed Sep 14 00:43:10 2011	(r2508)
+++ cpu/arm/mmp2/thermal.fth	Thu Sep 15 07:39:43 2011	(r2509)
@@ -7,7 +7,7 @@
    3 h# 015090 io!            \ Enable clocks to thermal sensor
    h# 10000 thermal-base io!  \ Enable sensing
 ;
-   
+
 : cpu-temperature  ( -- celcius )
    0                   ( acc )
    d# 100 0  do        ( acc )  \ Accumulate 100 samples
@@ -21,6 +21,35 @@
 
    d# 52940 -  d# 196 /  ( celcius )
 ;
+
+thermal-base h# 4 +  value wd-thresh
+: wd-thresh@  ( -- n )  wd-thresh io@  ;
+: wd-thresh!  ( n -- )  wd-thresh io!  ;
+
+: .thermal
+   ." degrees="  cpu-temperature  .d
+   ." raw="  thermal-base io@  h# 3ff and  .
+   ." threshold="  wd-thresh@  h# 3ff and  .
+;
+
+: 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
+;
+
 stand-init: Thermal sensor
    init-thermal-sensor
 ;

Modified: cpu/arm/mmp2/watchdog.fth
==============================================================================
--- cpu/arm/mmp2/watchdog.fth	Wed Sep 14 00:43:10 2011	(r2508)
+++ cpu/arm/mmp2/watchdog.fth	Thu Sep 15 07:39:43 2011	(r2509)
@@ -1,10 +1,10 @@
 \ See license at end of file
 purpose: System reset using the watchdog timer
 
+main-pmu-pa h# 200 + constant wdtpcr
 : enable-wdt-clock
    main-pmu-pa h# 1020 +  dup io@  h# 10 or  swap io!  \ enable wdt 2 clock  PMUM_PRR_PJ
-   7  main-pmu-pa h# 200 +  io!
-   3  main-pmu-pa h# 200 +  io!
+   wdtpcr io@  dup  h# 7 or wdtpcr io!  h# 3 or wdtpcr io!
 ;
 
 h# 080000 value wdt-pa
@@ -17,7 +17,7 @@
 : wdt-reset  ( -- )
    enable-wdt-clock
    2 h# 68 wdt!   \ set match register
-   3 h# 64 wdt!   \ match enable: just interrupt, no reset yet
+   3 h# 64 wdt!   \ match enable: enable counting, enable reset
    1 h# 98 wdt!   \ Reset counter
    begin  again
 ;
@@ -26,7 +26,7 @@
 : test-wdt  ( -- )
    enable-wdt-clock
    h# 100  h# 68  wdt!  \ set match register
-   1 h# 64 wdt!         \ match enable: just interrupt, no reset yet
+   1 h# 64 wdt!         \ match enable: enable counting, no reset yet
    h# 6c wdt@ .  d# 100 ms  h# 6c wdt@ .
 ;
 [then]



More information about the openfirmware mailing list