Skip to contentSkip to conversation

rtc: add support for DS3232 device

PATCH New Han Nandor 2 participants 2 messages Nov 12, 2019 – Jan 10, 2020 Real time clock (RTC)

lore
Share & tools
lore

Han Nandor

author
#0 lore raw

PATCH 1/1 rtc: add support for DS3232 device

DS3232 is an i2c RTC with 236 bytes of battery-backed SRAM.

Add an RTC driver for DS3232 device, which provides time and date support. Also read and write functions are provided, which can be used to access the SRAM memory.

---

Notes:
Description
----------
Add support for RTC DS3232 device.

Testing
------
1. Check that date/time can be reset: PASS

U-Boot> date reset
Reset RTC...
Date: 2000-01-01 (Saturday) Time: 0:00:00

2. Check that setting the date/time is successful: PASS

U-Boot> date 040114012019.00
Date: 2019-04-01 (Monday) Time: 14:01:00

3. Check that getting the date/time is successful: PASS

U-Boot> date
Date: 2019-04-01 (Monday) Time: 14:01:58

4. Verify that the date configured in U-Boot is the same read in Kernel.

 doc/device-tree-bindings/rtc/ds3232.txt |  15 ++
 drivers/rtc/Kconfig                     |   8 +
 drivers/rtc/Makefile                    |   1 +
 drivers/rtc/ds3232.c                    | 274 ++++++++++++++++++++++++
 4 files changed, 298 insertions(+)
 create mode 100644 doc/device-tree-bindings/rtc/ds3232.txt
 create mode 100644 drivers/rtc/ds3232.c
doc/device-tree-bindings/rtc/ds3232.txt new file +15 -0
new file mode 100644
index 0000000000..254b7bc3c3
@@ -0,0 +1,15 @@
+DS3232 Real-Time Clock with SRAM
+
+The RTC driver provides time and date functionality. Also read and write
+functions are provided that can be used to access the SRAM memory.
+
+Required properties:
+- compatible     : should contain "dallas,ds3232"
+- reg            : the I2C RTC address
+
+Example:
+
+rtc at 68 {
+	compatible = "dallas,ds3232";
+	reg = <0x68>;
+};
drivers/rtc/Kconfig +8 -0
index 8778cc7b26..a82f79bf16 100644
@@ -54,6 +54,14 @@ config RTC_DS1307
 	  Support for Dallas Semiconductor (now Maxim) DS1307 and DS1338/9 and
 	  compatible Real Time Clock devices.
 
+config RTC_DS3232
+	bool "Enable DS3232 driver"
+	depends on DM_RTC
+	depends on DM_I2C
+	help
+	  Support for Dallas Semiconductor (now Maxim) DS3232 compatible
+	  Real Time Clock devices.
+
 config RTC_ISL1208
 	bool "Enable ISL1208 driver"
 	depends on DM_RTC
drivers/rtc/Makefile +1 -0
index f97a669982..e89de73b11 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_RTC_DS1556) += ds1556.o
 obj-$(CONFIG_RTC_DS164x) += ds164x.o
 obj-$(CONFIG_RTC_DS174x) += ds174x.o
 obj-$(CONFIG_RTC_DS3231) += ds3231.o
+obj-$(CONFIG_RTC_DS3232) += ds3232.o
 obj-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o
 obj-$(CONFIG_RTC_IMXDI) += imxdi.o
drivers/rtc/ds3232.c new file +274 -0

274 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 rtc: add support for DS3232 device

Quoted 7 lines · Han Nandor

DS3232 is an i2c RTC with 236 bytes of battery-backed SRAM.

Add an RTC driver for DS3232 device, which provides time and date support. Also read and write functions are provided, which can be used to access the SRAM memory.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200110/f34240f9/attachment.sig>