From: James Chapman <jchapman@katalix.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Michael Burian <dynmail1@gassner-waagen.at>
Subject: [PATCH: 2.6.14] i2c chips: ds1337 1/2
Date: Thu, 03 Nov 2005 20:23:21 +0000 [thread overview]
Message-ID: <436A71B9.6060205@katalix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
Patch for ds1337 i2c driver:
Add code to handle case where board firmware does not start the
RTC.
This patch was contributed by Michael Burian.
Signed-off-by: Michael Burian <dynmail1@gassner-waagen.at>
Signed-off-by: James Chapman <jchapman@katalix.com>
--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
[-- Attachment #2: ds1337-init.patch --]
[-- Type: text/plain, Size: 1314 bytes --]
Add code to handle case where board firmware does not start the
RTC.
This patch was contributed by Michael Burian.
Signed-off-by: Michael Burian <dynmail1@gassner-waagen.at>
Signed-off-by: James Chapman <jchapman@katalix.com>
Index: linux-2.6.14/drivers/i2c/chips/ds1337.c
===================================================================
--- linux-2.6.14.orig/drivers/i2c/chips/ds1337.c 2005-11-02 19:30:17.000000000 +0000
+++ linux-2.6.14/drivers/i2c/chips/ds1337.c 2005-11-03 20:14:58.981735046 +0000
@@ -149,12 +149,25 @@
u8 buf[8];
u8 val;
struct i2c_msg msg[1];
+ u8 status, control;
+ int i;
if (!dt) {
dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
return -EINVAL;
}
+ status = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
+ control = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL);
+
+ /* On some boards, the RTC isn't configured by boot firmware.
+ * Handle that case by starting/configuring the RTC now.
+ */
+ if ((status & 0x80) || (control & 0x80))
+ /* Initialize all, including STATUS and CONTROL to zero */
+ for (i = 0; i < 16; i++)
+ i2c_smbus_write_byte_data(client, i, 0);
+
dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
"mday=%d, mon=%d, year=%d, wday=%d\n", __FUNCTION__,
dt->tm_sec, dt->tm_min, dt->tm_hour,
next reply other threads:[~2005-11-03 20:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-03 20:23 James Chapman [this message]
2005-11-05 7:54 ` [PATCH: 2.6.14] i2c chips: ds1337 1/2 Jean Delvare
2005-11-05 10:55 ` James Chapman
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=436A71B9.6060205@katalix.com \
--to=jchapman@katalix.com \
--cc=dynmail1@gassner-waagen.at \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.