[openfirmware] [commit] r2362 - cpu/arm/olpc/1.75

repository service svn at openfirmware.info
Thu Jul 14 08:14:19 CEST 2011


Author: wmb
Date: Thu Jul 14 08:14:19 2011
New Revision: 2362
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2362

Log:
OLPC XO-1.75 - RTC driver - force the Clock Halt bit off if necessary, and verify that it worked.

Modified:
   cpu/arm/olpc/1.75/rtc.fth

Modified: cpu/arm/olpc/1.75/rtc.fth
==============================================================================
--- cpu/arm/olpc/1.75/rtc.fth	Thu Jul 14 07:39:10 2011	(r2361)
+++ cpu/arm/olpc/1.75/rtc.fth	Thu Jul 14 08:14:19 2011	(r2362)
@@ -1,3 +1,5 @@
+purpose: Driver for external IDT1338 RTC chip on XO-1.75
+
 0 0  " "  " /" begin-package
 " rtc" name
 
@@ -20,8 +22,22 @@
 headerless
 
 headers
-: open  ( -- true )
-   true
+: open  ( -- okay )
+   0 ['] rtc@ catch  if        ( x )
+      drop false  exit         ( -- false )
+   then                        ( value )
+
+   \ Ensure that the Clock Halt bit is off
+   dup h# 80 and  if           ( value )
+      \ Turn off Clock Halt
+      h# 7f and 0 rtc!         ( )
+      \ Verify that it went off
+      0 rtc@ h# 80 and         ( error? )
+      dup  if  ." RTC Clock Halt is stuck on" cr  then  ( error? )
+      0=                       ( okay? )
+   else                        ( value )
+      drop true                ( true )
+   then                        ( okay? )
 ;
 : close  ( -- )
 ;



More information about the openfirmware mailing list