From patchwork Sun Dec 2 17:19:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Mathys X-Patchwork-Id: 203233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B0E452C0081 for ; Mon, 3 Dec 2012 04:20:15 +1100 (EST) Received: from localhost ([::1]:57787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfDDB-0003OQ-OC for incoming@patchwork.ozlabs.org; Sun, 02 Dec 2012 12:20:13 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=acdabUXcJ4zrR3/6HIFj7Bt0KaDt6kLp+UW8888PrPs=; b=brmLRvzb+RK17Z1Gf0I+n4ibq/UHE06lFLUarJx4JWenmzHFU4GmVdx4OM8WfSsO4j 55A0A/gSLVFkMuWk/KNZC2r89IxSeyfJ9U0HmUZ+R/7INlxHIwoQSqFc0U6OXKCB5qTB 69cWixBdjZ4mUF0bHYzZP8zsl8YNQ9+DI4qHbgHgCeM4nXsCXHzaq+r9dHVtsmEf+P6/ zf0jPqQ9Gu829XagZPTuryXjY+v6LNQrB5bH/CzdrsSqfcnq5lST+lqRJS774PFct8xP Wy5qdnKiy+UpZSQqsuijCvBYDMJ4Xl+GP7VJkhdqYB3J9VDOxdBbBeTtuDzEIYjgntcA eGfg== Received: by 10.14.175.198 with SMTP id z46mr27238361eel.26.1354468803656; Sun, 02 Dec 2012 09:20:03 -0800 (PST) Received: from [192.168.1.33] (adsl-89-217-2-169.adslplus.ch. [89.217.2.169]) by mx.google.com with ESMTPS id n7sm25776480eeo.2.2012.12.02.09.20.01 (version=SSLv3 cipher=OTHER); Sun, 02 Dec 2012 09:20:02 -0800 (PST) Message-ID: <50BB8DBF.5030505@gmail.com> Date: Sun, 02 Dec 2012 18:19:59 +0100 From: Antoine Mathys User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.173 Cc: peter.maydell@linaro.org, paul@codesourcery.com Subject: [Qemu-devel] [PATCH 3/4] hw/ds1338.c: ensure OSF can only be cleared X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;