From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] rtc: ds1307: add support for m41t11
Date: Mon, 27 May 2019 08:13:41 +0200 [thread overview]
Message-ID: <20190527061341.1124610-1-hs@denx.de> (raw)
add m41t11 support in ds1307 driver. changes:
- add compatible string for m41t11
- check if RTC clock is running, if not
enable the clock
Signed-off-by: Heiko Schocher <hs@denx.de>
---
clean travis build, see:
https://travis-ci.org/hsdenx/u-boot-test/builds/537359553
drivers/rtc/ds1307.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/rtc/ds1307.c b/drivers/rtc/ds1307.c
index 48220b45db..a33f47525f 100644
--- a/drivers/rtc/ds1307.c
+++ b/drivers/rtc/ds1307.c
@@ -23,6 +23,7 @@ enum ds_type {
ds_1307,
ds_1337,
ds_1340,
+ m41t11,
mcp794xx,
};
@@ -260,6 +261,18 @@ read_rtc:
}
}
+ if (type == m41t11) {
+ /* clock halted? turn it on, so clock can tick. */
+ if (buf[RTC_SEC_REG_ADDR] & RTC_SEC_BIT_CH) {
+ buf[RTC_SEC_REG_ADDR] &= ~RTC_SEC_BIT_CH;
+ dm_i2c_reg_write(dev, RTC_SEC_REG_ADDR,
+ MCP7941X_BIT_ST);
+ dm_i2c_reg_write(dev, RTC_SEC_REG_ADDR,
+ buf[RTC_SEC_REG_ADDR]);
+ goto read_rtc;
+ }
+ }
+
if (type == mcp794xx) {
/* make sure that the backup battery is enabled */
if (!(buf[RTC_DAY_REG_ADDR] & MCP7941X_BIT_VBATEN)) {
@@ -332,6 +345,7 @@ static const struct udevice_id ds1307_rtc_ids[] = {
{ .compatible = "dallas,ds1337", .data = ds_1337 },
{ .compatible = "dallas,ds1340", .data = ds_1340 },
{ .compatible = "microchip,mcp7941x", .data = mcp794xx },
+ { .compatible = "st,m41t11", .data = m41t11 },
{ }
};
--
2.21.0
next reply other threads:[~2019-05-27 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 6:13 Heiko Schocher [this message]
2019-07-14 13:07 ` [U-Boot] [PATCH] rtc: ds1307: add support for m41t11 Tom Rini
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=20190527061341.1124610-1-hs@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/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.