summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/rv3028c7/rv3028c7.h
diff options
context:
space:
mode:
authorWerner Zeh <werner.zeh@siemens.com>2022-08-26 13:40:47 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-09-07 09:23:27 +0000
commit5fb66adc323cba3f23cd668d6d2d1cb586724f0e (patch)
treec98e1e74769e717b652b40577cfd738c60eaea4c /src/drivers/i2c/rv3028c7/rv3028c7.h
parent2c789782add9cfb85026212cd5f8b2cda288c7be (diff)
drivers/i2c: Add a new RTC RV-3028-C7 from Micro Crystal
This patch adds a driver for a new RTC from Micro Crystal. Supported features are: * configure backup voltage switchover via devicetree * configure backup capacitor charging mode via devicetree * set date if a voltage drop on backup voltage was detected to either a user definable (devicetree) or coreboot build date Change-Id: I37176ea726e50e4e74d409488981d7618ecff8bb Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67099 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Diffstat (limited to 'src/drivers/i2c/rv3028c7/rv3028c7.h')
-rw-r--r--src/drivers/i2c/rv3028c7/rv3028c7.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/drivers/i2c/rv3028c7/rv3028c7.h b/src/drivers/i2c/rv3028c7/rv3028c7.h
new file mode 100644
index 0000000000..55617a724f
--- /dev/null
+++ b/src/drivers/i2c/rv3028c7/rv3028c7.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _I2C_RV3028C7_H_
+#define _I2C_RV3028C7_H_
+
+/* Register layout */
+#define SECOND_REG 0x00
+#define MINUTE_REG 0x01
+#define HOUR_REG 0x02
+#define WEEK_REG 0x03
+#define DAY_REG 0x04
+#define MONTH_REG 0x05
+#define YEAR_REG 0x06
+#define STATUS_REG 0x0e
+#define PORF_BIT (1 << 0)
+#define EE_BUSY_BIT (1 << 7)
+#define CTRL1_REG 0x0f
+#define EERD_BIT (1 << 3)
+#define CTRL2_REG 0x10
+#define HOUR_12_24_BIT (1 << 1)
+/* Registers for the internal EEPROM */
+#define EEP_ADR_REG 0x25
+#define EEP_DATA_REG 0x26
+#define EEP_CMD_REG 0x27
+#define EEP_CMD_PREFIX 0x00
+#define EEP_CMD_UPDATE 0x11
+#define EEP_BACKUP_REG 0x37
+#define FEDE_BIT (1 << 4)
+#define BSM_BIT 2
+#define BSM_MASK (3 << BSM_BIT)
+#define TCR_BIT 0
+#define TCR_MASK (3 << TCR_BIT)
+#define TCE_BIT (1 << 5)
+
+#define EEP_REFRESH_EN 1
+#define EEP_REFRESH_DIS 0
+
+/* The longest mentioned timeout in the datasheet is 63 ms,
+ round up to 70 ms to be on the safe side. */
+#define EEP_SYNC_TIMEOUT_MS 70
+
+#endif /* _I2C_RV3028C7_H_ */