Commits (1)
  • Jeffrey Lee's avatar
    Fix time warp caused by TWL6030 RTC being set running before a valid time has been programmed · 80bb48f0
    Jeffrey Lee authored
    Detail:
      s/RTC - Remove TWL6030 RTC startup code from RTC_Init, to ensure that RTC_Read is able to report that the time is invalid if the RTC isn't running. This avoids the RTC module getting confused and thinking the century needs incrementing (RTC will report a year of xx00, CMOS will hold 2015, RTC module assumes year can only go forward -> therefore must be 2100)
      Also perform a dummy read of RTC_STATUS_REG before reading actual value, as the manual warns that this is required.
    Admin:
      Tested on Pandaboard
      With CMOS available:
      - *Time defaults to year 1970 on power up (CMOS year ignored due to RTC read error)
      - After setting time and rebooting, time is retained and 4 digit year is reconstructed correctly
      Without CMOS available:
      - *Time defaults to year 1970 on power up (default CMOS year ignored due to RTC read error)
      - After setting time and rebooting, time is retained and 4 digit year is reconstructed correctly (RTC year xx15 deemed higher than CMOS default year 2000)
    
    
    Version 0.45. Tagged as 'OMAP4-0_45'
    80bb48f0
/* (0.44)
/* (0.45)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.44
#define Module_MajorVersion_CMHG 0.45
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Apr 2015
#define Module_Date_CMHG 16 Apr 2015
#define Module_MajorVersion "0.44"
#define Module_Version 44
#define Module_MajorVersion "0.45"
#define Module_Version 45
#define Module_MinorVersion ""
#define Module_Date "08 Apr 2015"
#define Module_Date "16 Apr 2015"
#define Module_ApplicationDate "08-Apr-15"
#define Module_ApplicationDate "16-Apr-15"
#define Module_ComponentName "OMAP4"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP4"
#define Module_FullVersion "0.44"
#define Module_HelpVersion "0.44 (08 Apr 2015)"
#define Module_LibraryVersionInfo "0:44"
#define Module_FullVersion "0.45"
#define Module_HelpVersion "0.45 (16 Apr 2015)"
#define Module_LibraryVersionInfo "0:45"
......@@ -186,29 +186,6 @@ RTC_Init
LDR a2, =0x0002 ; output + Mode 2 (Reserved)
STRH a2, [a1, #0x0054] ; gpio_wk6
; check TWL6030 RTC state
LDR v1, OSentries+4*OS_IICOpV ; for TPSRead/TPSWrite
MOV a1, #TPSRTC_IIC
MOV a3, #1
MOV a4, #RTC_STATUS_REG
MOV a2, sp
BL TPSRead
CMP a1, #IICStatus_Completed
BNE %FT50
MOV a1, #TPSRTC_IIC
BL TPSWrite
; check for running clock and start it (if not running)
MOV a4, #RTC_CTRL_REG
MOV a1, #TPSRTC_IIC
BL TPSRead
LDRB a1, [a2]
TST a1, #RTC_CTRL_STOP_RTC_M
BNE %FT50
ORR a1, a1, #RTC_CTRL_STOP_RTC_M
STRB a1, [a2]
MOV a1, #TPSRTC_IIC
BL TPSWrite
50
ADD sp, sp, #4
......@@ -281,6 +258,8 @@ RTCReadTime
MOV a3, #1
MOV a4, #RTC_STATUS_REG
MOV a2, sp
BL TPSRead ; RTC_STATUS_REG requires a dummy read to ensure the status is correct
MOV a1, #TPSRTC_IIC
BL TPSRead
CMP a1, #IICStatus_Completed
LDRB ip, [a2]
......