xref: /minix/minix/drivers/power/tps65950/tps65950.h (revision 433d6423)
1 #ifndef __TPS65950_H
2 #define __TPS65950_H
3 
4 /*
5  * The chip is so huge it's split into multiple sub-modules, each with 256
6  * byte register maps on it's own slave addresses. Use ID1, ID2, ... to
7  * specify which sub-module to communicate with. Each slave address can have
8  * registers for one or more peripherals.
9  */
10 
11 /* Slave Address 0x48 (USB) */
12 #define ID1 0
13 
14 /* Slave Address 0x49 (AUDIO_VOICE/GPIO/INTBR/PIH/TEST) */
15 #define ID2 1
16 
17 /* Interface Bit Registers (INTBR) */
18 
19 /* Chip Identifier
20  *
21  * When combined to uint32_t, these are the subfields:
22  *   [31:28] - Silicon version number
23  *   [27:12] - Part code number
24  *   [11: 1] - Manufacturer code
25  *   [    0] - Least-significant bit (LSB)
26  */
27 #define IDCODE_7_0_REG 0x85
28 #define IDCODE_15_8_REG 0x86
29 #define IDCODE_23_16_REG 0x87
30 #define IDCODE_31_24_REG 0x88
31 
32 #define IDCODE_REV_1_0 0x00009002f
33 #define IDCODE_REV_1_1 0x01009002f
34 #define IDCODE_REV_1_2 0x03009002f
35 
36 /* Write 0x49 to UNLOCK_TEST_REG to unlock reading of IDCODE and DIEID */
37 #define UNLOCK_TEST_REG 0x97
38 #define UNLOCK_TEST_CODE 0x49
39 
40 
41 /* Slave Address 0x4a (BCI/MADC/MAIN_CHARGE/PWM01/LED/PWMAB/KEYPAD) */
42 #define ID3 2
43 
44 
45 /* Slave Address 0x4b (BACKUP_REG/INT/PM_MASTER/SECURED_REG) */
46 #define ID4 3
47 
48 /*
49  * Real Time Clock
50  */
51 
52 #define SECONDS_REG 0x1c
53 #define MINUTES_REG 0x1d
54 #define HOURS_REG 0x1e
55 #define DAYS_REG 0x1f
56 #define MONTHS_REG 0x20
57 #define YEARS_REG 0x21
58 
59 #define RTC_CTRL_REG 0x00000029
60 #define GET_TIME_BIT 6
61 #define STOP_RTC_BIT 0
62 
63 #define RTC_STATUS_REG 0x0000002A
64 #define RUN_BIT 1
65 
66 #define NADDRESSES 4
67 
68 extern endpoint_t bus_endpoint;
69 extern i2c_addr_t addresses[NADDRESSES];
70 
71 #endif /* __TPS65950_H */
72