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