xref: /openbmc/u-boot/include/power/tps65217.h (revision 640ff60af7a36ba9649dc79be6d117c9c12429fe)
18b65b12aSGreg Guyotte /*
28b65b12aSGreg Guyotte  * (C) Copyright 2011-2013
38b65b12aSGreg Guyotte  * Texas Instruments, <www.ti.com>
48b65b12aSGreg Guyotte  *
58b65b12aSGreg Guyotte  * SPDX-License-Identifier:	GPL-2.0+
68b65b12aSGreg Guyotte  *
78b65b12aSGreg Guyotte  * For more details, please see the TRM at http://www.ti.com/product/tps65217a
88b65b12aSGreg Guyotte  */
98b65b12aSGreg Guyotte 
108b65b12aSGreg Guyotte #ifndef __POWER_TPS65217_H__
118b65b12aSGreg Guyotte #define __POWER_TPS65217_H__
128b65b12aSGreg Guyotte 
138b65b12aSGreg Guyotte /* I2C chip address */
148b65b12aSGreg Guyotte #define TPS65217_CHIP_PM			0x24
158b65b12aSGreg Guyotte 
168b65b12aSGreg Guyotte /* Registers */
178b65b12aSGreg Guyotte enum {
188b65b12aSGreg Guyotte 	TPS65217_CHIPID				= 0x00,
198b65b12aSGreg Guyotte 	TPS65217_POWER_PATH,
208b65b12aSGreg Guyotte 	TPS65217_INTERRUPT,
218b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG0,
228b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG1,
238b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG2,
248b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG3,
258b65b12aSGreg Guyotte 	TPS65217_WLEDCTRL1,
268b65b12aSGreg Guyotte 	TPS65217_WLEDCTRL2,
278b65b12aSGreg Guyotte 	TPS65217_MUXCTRL,
288b65b12aSGreg Guyotte 	TPS65217_STATUS,
298b65b12aSGreg Guyotte 	TPS65217_PASSWORD,
308b65b12aSGreg Guyotte 	TPS65217_PGOOD,
318b65b12aSGreg Guyotte 	TPS65217_DEFPG,
328b65b12aSGreg Guyotte 	TPS65217_DEFDCDC1,
338b65b12aSGreg Guyotte 	TPS65217_DEFDCDC2,
348b65b12aSGreg Guyotte 	TPS65217_DEFDCDC3,
358b65b12aSGreg Guyotte 	TPS65217_DEFSLEW,
368b65b12aSGreg Guyotte 	TPS65217_DEFLDO1,
378b65b12aSGreg Guyotte 	TPS65217_DEFLDO2,
388b65b12aSGreg Guyotte 	TPS65217_DEFLS1,
398b65b12aSGreg Guyotte 	TPS65217_DEFLS2,
408b65b12aSGreg Guyotte 	TPS65217_ENABLE,
418b65b12aSGreg Guyotte 	TPS65217_DEFUVLO,
428b65b12aSGreg Guyotte 	TPS65217_SEQ1,
438b65b12aSGreg Guyotte 	TPS65217_SEQ2,
448b65b12aSGreg Guyotte 	TPS65217_SEQ3,
458b65b12aSGreg Guyotte 	TPS65217_SEQ4,
468b65b12aSGreg Guyotte 	TPS65217_SEQ5,
478b65b12aSGreg Guyotte 	TPS65217_SEQ6,
488b65b12aSGreg Guyotte 	TPS65217_PMIC_NUM_OF_REGS,
498b65b12aSGreg Guyotte };
508b65b12aSGreg Guyotte 
518b65b12aSGreg Guyotte #define TPS65217_PROT_LEVEL_NONE		0x00
528b65b12aSGreg Guyotte #define TPS65217_PROT_LEVEL_1			0x01
538b65b12aSGreg Guyotte #define TPS65217_PROT_LEVEL_2			0x02
548b65b12aSGreg Guyotte 
558b65b12aSGreg Guyotte #define TPS65217_PASSWORD_LOCK_FOR_WRITE	0x00
568b65b12aSGreg Guyotte #define TPS65217_PASSWORD_UNLOCK		0x7D
578b65b12aSGreg Guyotte 
588b65b12aSGreg Guyotte #define TPS65217_DCDC_GO			0x80
598b65b12aSGreg Guyotte 
608b65b12aSGreg Guyotte #define TPS65217_MASK_ALL_BITS			0xFF
618b65b12aSGreg Guyotte 
628b65b12aSGreg Guyotte #define TPS65217_USB_INPUT_CUR_LIMIT_MASK	0x03
638b65b12aSGreg Guyotte #define TPS65217_USB_INPUT_CUR_LIMIT_100MA	0x00
648b65b12aSGreg Guyotte #define TPS65217_USB_INPUT_CUR_LIMIT_500MA	0x01
658b65b12aSGreg Guyotte #define TPS65217_USB_INPUT_CUR_LIMIT_1300MA	0x02
668b65b12aSGreg Guyotte #define TPS65217_USB_INPUT_CUR_LIMIT_1800MA	0x03
678b65b12aSGreg Guyotte 
68*640ff60aSHeiko Schocher #define TPS65217_DCDC_VOLT_SEL_950MV		0x02
69*640ff60aSHeiko Schocher #define TPS65217_DCDC_VOLT_SEL_1100MV		0x08
7052f7d844SSteve Kipisz #define TPS65217_DCDC_VOLT_SEL_1125MV		0x09
71*640ff60aSHeiko Schocher #define TPS65217_DCDC_VOLT_SEL_1200MV		0x0c
728b65b12aSGreg Guyotte #define TPS65217_DCDC_VOLT_SEL_1275MV		0x0F
738b65b12aSGreg Guyotte #define TPS65217_DCDC_VOLT_SEL_1325MV		0x11
748b65b12aSGreg Guyotte 
758b65b12aSGreg Guyotte #define TPS65217_LDO_MASK			0x1F
768b65b12aSGreg Guyotte #define TPS65217_LDO_VOLTAGE_OUT_1_8		0x06
778b65b12aSGreg Guyotte #define TPS65217_LDO_VOLTAGE_OUT_3_3		0x1F
788b65b12aSGreg Guyotte 
79fbd5aedaSHannes Petermaier #define TPS65217_PWR_OFF			0x80
808b65b12aSGreg Guyotte #define TPS65217_PWR_SRC_USB_BITMASK		0x4
818b65b12aSGreg Guyotte #define TPS65217_PWR_SRC_AC_BITMASK		0x8
828b65b12aSGreg Guyotte 
838b65b12aSGreg Guyotte int tps65217_reg_read(uchar src_reg, uchar *src_val);
848b65b12aSGreg Guyotte int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
858b65b12aSGreg Guyotte 		       uchar mask);
868b65b12aSGreg Guyotte int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
878b65b12aSGreg Guyotte #endif	/* __POWER_TPS65217_H__ */
88