From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfDD4-0003M4-4u for qemu-devel@nongnu.org; Sun, 02 Dec 2012 12:20:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfDD3-0001M1-62 for qemu-devel@nongnu.org; Sun, 02 Dec 2012 12:20:06 -0500 Received: from mail-ea0-f173.google.com ([209.85.215.173]:35230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfDD2-0001Ht-S8 for qemu-devel@nongnu.org; Sun, 02 Dec 2012 12:20:05 -0500 Received: by mail-ea0-f173.google.com with SMTP id i13so924132eaa.4 for ; Sun, 02 Dec 2012 09:20:03 -0800 (PST) Message-ID: <50BB8DBF.5030505@gmail.com> Date: Sun, 02 Dec 2012 18:19:59 +0100 From: Antoine Mathys MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 3/4] hw/ds1338.c: ensure OSF can only be cleared List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, paul@codesourcery.com Per the datasheet, the OSF bit in the control register can only be cleared. Attempts to set it have no effect. Implement this. Signed-off-by: Antoine Mathys --- hw/ds1338.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/ds1338.c b/hw/ds1338.c index 1fb152e..f3c6bc5 100644 --- a/hw/ds1338.c +++ b/hw/ds1338.c @@ -160,7 +160,12 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data) } s->offset = qemu_timedate_diff(&now); } else if (s->ptr == 7) { - /* Control register. Currently ignored. */ + /* Control register. */ + + /* Attempting to write the OSF flag to logic 1 leaves the + value unchanged. */ + data = (data & 0xDF) | (data & s->nvram[s->ptr] & 0x20); + s->nvram[s->ptr] = data; } else { s->nvram[s->ptr] = data; -- 1.7.10.4