OSDN Git Service

rtc: zynqmp: Update seconds time programming logic
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Wed, 20 Apr 2016 15:47:35 +0000 (21:17 +0530)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Fri, 20 May 2016 10:33:51 +0000 (12:33 +0200)
commitb62c3a1158c0abc98e03c68934fa7ee6ca10dd49
tree2142a220dfe34610e95b13ff8385aef341a356d3
parent01dc6992b3e888e7bf17691e4e86c9cc33e8f8b5
rtc: zynqmp: Update seconds time programming logic

We program RTC time using SET_TIME_WRITE register and read the RTC
current time using CURRENT_TIME register. When we set the time by
writing into SET_TIME_WRITE Register and immediately try to read the
rtc time from CURRENT_TIME register, the previous old value is
returned instead of the new loaded time. This is because RTC takes
nearly 1 sec to update the  new loaded value into the CURRENT_TIME
register. This behaviour is expected in our RTC IP.

This patch updates the driver to read the current time from SET_TIME_WRITE
register instead of CURRENT_TIME when rtc time is requested within an 1sec
period after setting the RTC time. Doing so will ensure the correct time is
given to the user.

Since there is a delay of 1sec in updating the CURRENT_TIME we are loading
set time +1sec while programming the SET_TIME_WRITE register, doing this
will give correct time without any delay when read from CURRENT_TIME.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-zynqmp.c