summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/rv3028c7/rv3028c7.h
blob: 55617a724fef0a5c63736350e5ef975b2924d16a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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_ */