diff options
author | Heiko Schocher <hs@denx.de> | 2019-05-27 09:13:41 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-13 18:11:26 +0300 |
commit | 8dd6803dedeada63749f93111e6501b50b180419 (patch) | |
tree | 7fa58a8f56c0fd12ca3f4130b9434b032ba592b5 | |
parent | d66fb5b1f6662a8aa5f78994696994c2594dbb22 (diff) | |
download | u-boot-8dd6803dedeada63749f93111e6501b50b180419.tar.xz |
rtc: ds1307: add support for m41t11
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>
-rw-r--r-- | drivers/rtc/ds1307.c | 14 |
1 files changed, 14 insertions, 0 deletions
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 }, { } }; |