xref: /openbmc/u-boot/include/power/tps65217.h (revision 7ff485c68b7e5573e5a4a877066e98398283a24f)
183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
28b65b12aSGreg Guyotte /*
38b65b12aSGreg Guyotte  * (C) Copyright 2011-2013
48b65b12aSGreg Guyotte  * Texas Instruments, <www.ti.com>
58b65b12aSGreg Guyotte  *
68b65b12aSGreg Guyotte  * For more details, please see the TRM at http://www.ti.com/product/tps65217a
78b65b12aSGreg Guyotte  */
88b65b12aSGreg Guyotte 
98b65b12aSGreg Guyotte #ifndef __POWER_TPS65217_H__
108b65b12aSGreg Guyotte #define __POWER_TPS65217_H__
118b65b12aSGreg Guyotte 
128b65b12aSGreg Guyotte /* I2C chip address */
138b65b12aSGreg Guyotte #define TPS65217_CHIP_PM			0x24
148b65b12aSGreg Guyotte 
158b65b12aSGreg Guyotte /* Registers */
168b65b12aSGreg Guyotte enum {
178b65b12aSGreg Guyotte 	TPS65217_CHIPID				= 0x00,
188b65b12aSGreg Guyotte 	TPS65217_POWER_PATH,
198b65b12aSGreg Guyotte 	TPS65217_INTERRUPT,
208b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG0,
218b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG1,
228b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG2,
238b65b12aSGreg Guyotte 	TPS65217_CHGCONFIG3,
248b65b12aSGreg Guyotte 	TPS65217_WLEDCTRL1,
258b65b12aSGreg Guyotte 	TPS65217_WLEDCTRL2,
268b65b12aSGreg Guyotte 	TPS65217_MUXCTRL,
278b65b12aSGreg Guyotte 	TPS65217_STATUS,
288b65b12aSGreg Guyotte 	TPS65217_PASSWORD,
298b65b12aSGreg Guyotte 	TPS65217_PGOOD,
308b65b12aSGreg Guyotte 	TPS65217_DEFPG,
318b65b12aSGreg Guyotte 	TPS65217_DEFDCDC1,
328b65b12aSGreg Guyotte 	TPS65217_DEFDCDC2,
338b65b12aSGreg Guyotte 	TPS65217_DEFDCDC3,
348b65b12aSGreg Guyotte 	TPS65217_DEFSLEW,
358b65b12aSGreg Guyotte 	TPS65217_DEFLDO1,
368b65b12aSGreg Guyotte 	TPS65217_DEFLDO2,
378b65b12aSGreg Guyotte 	TPS65217_DEFLS1,
388b65b12aSGreg Guyotte 	TPS65217_DEFLS2,
398b65b12aSGreg Guyotte 	TPS65217_ENABLE,
40abf54bf9SBrock Zheng Techyauld Ltd 	TPS65217_RESERVED0, /* no 0x17 register available */
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 
68640ff60aSHeiko Schocher #define TPS65217_DCDC_VOLT_SEL_950MV		0x02
69640ff60aSHeiko Schocher #define TPS65217_DCDC_VOLT_SEL_1100MV		0x08
7052f7d844SSteve Kipisz #define TPS65217_DCDC_VOLT_SEL_1125MV		0x09
71640ff60aSHeiko 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 
83*fb1b7712SJean-Jacques Hiblot int power_tps65217_init(unsigned char bus);
84*fb1b7712SJean-Jacques Hiblot 
858b65b12aSGreg Guyotte int tps65217_reg_read(uchar src_reg, uchar *src_val);
868b65b12aSGreg Guyotte int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
878b65b12aSGreg Guyotte 		       uchar mask);
888b65b12aSGreg Guyotte int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
898b65b12aSGreg Guyotte #endif	/* __POWER_TPS65217_H__ */
90