Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753379AbcDUXUq (ORCPT ); Thu, 21 Apr 2016 19:20:46 -0400 Received: from down.free-electrons.com ([37.187.137.238]:48897 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751829AbcDUXUp (ORCPT ); Thu, 21 Apr 2016 19:20:45 -0400 Date: Fri, 22 Apr 2016 01:20:42 +0200 From: Alexandre Belloni To: Anurag Kumar Vulisha Cc: Alessandro Zummo , soren.brinkmann@xilinx.com, Michal Simek , rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Punnaiah Choudary Kalluri , Anirudha Sarangi , Srikanth Vemula , Srinivas Goud , Anurag Kumar Vulisha Subject: Re: [PATCH V4] rtc: zynqmp: Update seconds time programming logic Message-ID: <20160421232042.GD29844@piout.net> References: <1461167255-33945-1-git-send-email-anuragku@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1461167255-33945-1-git-send-email-anuragku@xilinx.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 37 On 20/04/2016 at 21:17:35 +0530, Anurag Kumar Vulisha wrote : > We programe 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 an 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. > > This patch updates the above said. > > Signed-off-by: Anurag Kumar Vulisha > --- > Changes in v4: > 1. Corrected the read time logic > Changes in v2: > 1. Updated the Time programming logic as suggested by Alexandre Belloni > 2. Changed the commit message > --- > drivers/rtc/rtc-zynqmp.c | 45 +++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 39 insertions(+), 6 deletions(-) > Applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com