From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9bnN-0004uD-BE for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9bnF-0001Gh-N1 for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:11:29 -0400 Received: from multi.imgtec.com ([194.200.65.239]:4750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9bnF-0001G7-Dx for qemu-devel@nongnu.org; Wed, 14 Aug 2013 10:11:21 -0400 From: James Hogan Date: Wed, 14 Aug 2013 15:10:36 +0100 Message-ID: <1376489436-29136-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 1/1] mc146818rtc: correct UIP hold length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , James Hogan , Paolo Bonzini , Yang Zhang , Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= The UIP (update in progress) hold time was set to 8 32.768KHz clock cycles (around 244uS). However the timing diagram in the datasheet (Figure 16) shows that the UIP bit is held for both the update cycle time (either 248uS or 1984uS depending on the clock source), and the minimum time before update cycle (244uS). It's clear from periodic_timer_update() that only a 32.768KHz clock source is expected, so correct the hold time to 244uS + 1984uS = 73 32.768KHz clock cycles. Signed-off-by: James Hogan Cc: Andreas Färber Cc: Anthony Liguori Cc: Igor Mammedov Cc: Paolo Bonzini Cc: Yang Zhang --- hw/timer/mc146818rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 3c3baac..6000feb 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -55,7 +55,7 @@ #define RTC_REINJECT_ON_ACK_COUNT 20 #define RTC_CLOCK_RATE 32768 -#define UIP_HOLD_LENGTH (8 * NSEC_PER_SEC / 32768) +#define UIP_HOLD_LENGTH (73 * NSEC_PER_SEC / 32768) #define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC) @@ -597,7 +597,7 @@ static int update_in_progress(RTCState *s) } guest_nsec = get_guest_rtc_ns(s); - /* UIP bit will be set at last 244us of every second. */ + /* UIP bit will be set at last 1984us + 244us of every second. */ if ((guest_nsec % NSEC_PER_SEC) >= (NSEC_PER_SEC - UIP_HOLD_LENGTH)) { return 1; } -- 1.8.1.2