From: Antoine Mathys <barsamin@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, paul@codesourcery.com
Subject: [Qemu-devel] [PATCH 3/4] hw/ds1338.c: ensure OSF can only be cleared
Date: Sun, 02 Dec 2012 18:19:59 +0100 [thread overview]
Message-ID: <50BB8DBF.5030505@gmail.com> (raw)
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 <barsamin@gmail.com>
---
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
next reply other threads:[~2012-12-02 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-02 17:19 Antoine Mathys [this message]
2012-12-04 17:58 ` [Qemu-devel] [PATCH 3/4] hw/ds1338.c: ensure OSF can only be cleared Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50BB8DBF.5030505@gmail.com \
--to=barsamin@gmail.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).