xref: /openbmc/u-boot/include/power/tps65217.h (revision dd580801)
1 /*
2  * (C) Copyright 2011-2013
3  * Texas Instruments, <www.ti.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  *
7  * For more details, please see the TRM at http://www.ti.com/product/tps65217a
8  */
9 
10 #ifndef __POWER_TPS65217_H__
11 #define __POWER_TPS65217_H__
12 
13 /* I2C chip address */
14 #define TPS65217_CHIP_PM			0x24
15 
16 /* Registers */
17 enum {
18 	TPS65217_CHIPID				= 0x00,
19 	TPS65217_POWER_PATH,
20 	TPS65217_INTERRUPT,
21 	TPS65217_CHGCONFIG0,
22 	TPS65217_CHGCONFIG1,
23 	TPS65217_CHGCONFIG2,
24 	TPS65217_CHGCONFIG3,
25 	TPS65217_WLEDCTRL1,
26 	TPS65217_WLEDCTRL2,
27 	TPS65217_MUXCTRL,
28 	TPS65217_STATUS,
29 	TPS65217_PASSWORD,
30 	TPS65217_PGOOD,
31 	TPS65217_DEFPG,
32 	TPS65217_DEFDCDC1,
33 	TPS65217_DEFDCDC2,
34 	TPS65217_DEFDCDC3,
35 	TPS65217_DEFSLEW,
36 	TPS65217_DEFLDO1,
37 	TPS65217_DEFLDO2,
38 	TPS65217_DEFLS1,
39 	TPS65217_DEFLS2,
40 	TPS65217_ENABLE,
41 	TPS65217_DEFUVLO,
42 	TPS65217_SEQ1,
43 	TPS65217_SEQ2,
44 	TPS65217_SEQ3,
45 	TPS65217_SEQ4,
46 	TPS65217_SEQ5,
47 	TPS65217_SEQ6,
48 	TPS65217_PMIC_NUM_OF_REGS,
49 };
50 
51 #define TPS65217_PROT_LEVEL_NONE		0x00
52 #define TPS65217_PROT_LEVEL_1			0x01
53 #define TPS65217_PROT_LEVEL_2			0x02
54 
55 #define TPS65217_PASSWORD_LOCK_FOR_WRITE	0x00
56 #define TPS65217_PASSWORD_UNLOCK		0x7D
57 
58 #define TPS65217_DCDC_GO			0x80
59 
60 #define TPS65217_MASK_ALL_BITS			0xFF
61 
62 #define TPS65217_USB_INPUT_CUR_LIMIT_MASK	0x03
63 #define TPS65217_USB_INPUT_CUR_LIMIT_100MA	0x00
64 #define TPS65217_USB_INPUT_CUR_LIMIT_500MA	0x01
65 #define TPS65217_USB_INPUT_CUR_LIMIT_1300MA	0x02
66 #define TPS65217_USB_INPUT_CUR_LIMIT_1800MA	0x03
67 
68 #define TPS65217_DCDC_VOLT_SEL_1125MV		0x09
69 #define TPS65217_DCDC_VOLT_SEL_1275MV		0x0F
70 #define TPS65217_DCDC_VOLT_SEL_1325MV		0x11
71 
72 #define TPS65217_LDO_MASK			0x1F
73 #define TPS65217_LDO_VOLTAGE_OUT_1_8		0x06
74 #define TPS65217_LDO_VOLTAGE_OUT_3_3		0x1F
75 
76 #define TPS65217_PWR_SRC_USB_BITMASK		0x4
77 #define TPS65217_PWR_SRC_AC_BITMASK		0x8
78 
79 int tps65217_reg_read(uchar src_reg, uchar *src_val);
80 int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
81 		       uchar mask);
82 int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
83 #endif	/* __POWER_TPS65217_H__ */
84