xref: /openbmc/linux/include/linux/mfd/tps65086.h (revision c0146735)
1abd46274SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2b45b719eSAndrew F. Davis /*
34f4ed454SAlexander A. Klimov  * Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
4b45b719eSAndrew F. Davis  *	Andrew F. Davis <afd@ti.com>
5b45b719eSAndrew F. Davis  *
6b45b719eSAndrew F. Davis  * Based on the TPS65912 driver
7b45b719eSAndrew F. Davis  */
8b45b719eSAndrew F. Davis 
9b45b719eSAndrew F. Davis #ifndef __LINUX_MFD_TPS65086_H
10b45b719eSAndrew F. Davis #define __LINUX_MFD_TPS65086_H
11b45b719eSAndrew F. Davis 
12b45b719eSAndrew F. Davis #include <linux/device.h>
13b45b719eSAndrew F. Davis #include <linux/regmap.h>
14b45b719eSAndrew F. Davis 
15b45b719eSAndrew F. Davis /* List of registers for TPS65086 */
16*c0146735SAndre Werner #define TPS65086_DEVICEID1		0x00
17*c0146735SAndre Werner #define TPS65086_DEVICEID2		0x01
18b45b719eSAndrew F. Davis #define TPS65086_IRQ		0x02
19b45b719eSAndrew F. Davis #define TPS65086_IRQ_MASK		0x03
20b45b719eSAndrew F. Davis #define TPS65086_PMICSTAT		0x04
21b45b719eSAndrew F. Davis #define TPS65086_SHUTDNSRC		0x05
22b45b719eSAndrew F. Davis #define TPS65086_BUCK1CTRL		0x20
23b45b719eSAndrew F. Davis #define TPS65086_BUCK2CTRL		0x21
24b45b719eSAndrew F. Davis #define TPS65086_BUCK3DECAY		0x22
25b45b719eSAndrew F. Davis #define TPS65086_BUCK3VID		0x23
26b45b719eSAndrew F. Davis #define TPS65086_BUCK3SLPCTRL		0x24
27b45b719eSAndrew F. Davis #define TPS65086_BUCK4CTRL		0x25
28b45b719eSAndrew F. Davis #define TPS65086_BUCK5CTRL		0x26
29b45b719eSAndrew F. Davis #define TPS65086_BUCK6CTRL		0x27
30b45b719eSAndrew F. Davis #define TPS65086_LDOA2CTRL		0x28
31b45b719eSAndrew F. Davis #define TPS65086_LDOA3CTRL		0x29
32b45b719eSAndrew F. Davis #define TPS65086_DISCHCTRL1		0x40
33b45b719eSAndrew F. Davis #define TPS65086_DISCHCTRL2		0x41
34b45b719eSAndrew F. Davis #define TPS65086_DISCHCTRL3		0x42
35b45b719eSAndrew F. Davis #define TPS65086_PG_DELAY1		0x43
36b45b719eSAndrew F. Davis #define TPS65086_FORCESHUTDN		0x91
37b45b719eSAndrew F. Davis #define TPS65086_BUCK1SLPCTRL		0x92
38b45b719eSAndrew F. Davis #define TPS65086_BUCK2SLPCTRL		0x93
39b45b719eSAndrew F. Davis #define TPS65086_BUCK4VID		0x94
40b45b719eSAndrew F. Davis #define TPS65086_BUCK4SLPVID		0x95
41b45b719eSAndrew F. Davis #define TPS65086_BUCK5VID		0x96
42b45b719eSAndrew F. Davis #define TPS65086_BUCK5SLPVID		0x97
43b45b719eSAndrew F. Davis #define TPS65086_BUCK6VID		0x98
44b45b719eSAndrew F. Davis #define TPS65086_BUCK6SLPVID		0x99
45b45b719eSAndrew F. Davis #define TPS65086_LDOA2VID		0x9A
46b45b719eSAndrew F. Davis #define TPS65086_LDOA3VID		0x9B
47b45b719eSAndrew F. Davis #define TPS65086_BUCK123CTRL		0x9C
48b45b719eSAndrew F. Davis #define TPS65086_PG_DELAY2		0x9D
49b45b719eSAndrew F. Davis #define TPS65086_PIN_EN_MASK1		0x9E
50b45b719eSAndrew F. Davis #define TPS65086_PIN_EN_MASK2		0x9F
51b45b719eSAndrew F. Davis #define TPS65086_SWVTT_EN		0x9F
52b45b719eSAndrew F. Davis #define TPS65086_PIN_EN_OVR1		0xA0
53b45b719eSAndrew F. Davis #define TPS65086_PIN_EN_OVR2		0xA1
54b45b719eSAndrew F. Davis #define TPS65086_GPOCTRL		0xA1
55b45b719eSAndrew F. Davis #define TPS65086_PWR_FAULT_MASK1	0xA2
56b45b719eSAndrew F. Davis #define TPS65086_PWR_FAULT_MASK2	0xA3
57b45b719eSAndrew F. Davis #define TPS65086_GPO1PG_CTRL1		0xA4
58b45b719eSAndrew F. Davis #define TPS65086_GPO1PG_CTRL2		0xA5
59b45b719eSAndrew F. Davis #define TPS65086_GPO4PG_CTRL1		0xA6
60b45b719eSAndrew F. Davis #define TPS65086_GPO4PG_CTRL2		0xA7
61b45b719eSAndrew F. Davis #define TPS65086_GPO2PG_CTRL1		0xA8
62b45b719eSAndrew F. Davis #define TPS65086_GPO2PG_CTRL2		0xA9
63b45b719eSAndrew F. Davis #define TPS65086_GPO3PG_CTRL1		0xAA
64b45b719eSAndrew F. Davis #define TPS65086_GPO3PG_CTRL2		0xAB
65b45b719eSAndrew F. Davis #define TPS65086_LDOA1CTRL		0xAE
66b45b719eSAndrew F. Davis #define TPS65086_PG_STATUS1		0xB0
67b45b719eSAndrew F. Davis #define TPS65086_PG_STATUS2		0xB1
68b45b719eSAndrew F. Davis #define TPS65086_PWR_FAULT_STATUS1	0xB2
69b45b719eSAndrew F. Davis #define TPS65086_PWR_FAULT_STATUS2	0xB3
70b45b719eSAndrew F. Davis #define TPS65086_TEMPCRIT		0xB4
71b45b719eSAndrew F. Davis #define TPS65086_TEMPHOT		0xB5
72b45b719eSAndrew F. Davis #define TPS65086_OC_STATUS		0xB6
73b45b719eSAndrew F. Davis 
74b45b719eSAndrew F. Davis /* IRQ Register field definitions */
75b45b719eSAndrew F. Davis #define TPS65086_IRQ_DIETEMP_MASK	BIT(0)
76b45b719eSAndrew F. Davis #define TPS65086_IRQ_SHUTDN_MASK	BIT(3)
77b45b719eSAndrew F. Davis #define TPS65086_IRQ_FAULT_MASK		BIT(7)
78b45b719eSAndrew F. Davis 
79*c0146735SAndre Werner /* DEVICEID1 Register field definitions */
80*c0146735SAndre Werner #define TPS6508640_ID			0x00
81*c0146735SAndre Werner #define TPS65086401_ID			0x01
82*c0146735SAndre Werner #define TPS6508641_ID			0x10
83*c0146735SAndre Werner #define TPS65086470_ID			0x70
84*c0146735SAndre Werner 
85*c0146735SAndre Werner /* DEVICEID2 Register field definitions */
86*c0146735SAndre Werner #define TPS65086_DEVICEID2_PART_MASK	GENMASK(3, 0)
87*c0146735SAndre Werner #define TPS65086_DEVICEID2_OTP_MASK	GENMASK(5, 4)
88*c0146735SAndre Werner #define TPS65086_DEVICEID2_REV_MASK	GENMASK(7, 6)
89b45b719eSAndrew F. Davis 
90b45b719eSAndrew F. Davis /* VID Masks */
91b45b719eSAndrew F. Davis #define BUCK_VID_MASK			GENMASK(7, 1)
92b45b719eSAndrew F. Davis #define VDOA1_VID_MASK			GENMASK(4, 1)
93b45b719eSAndrew F. Davis #define VDOA23_VID_MASK			GENMASK(3, 0)
94b45b719eSAndrew F. Davis 
95b45b719eSAndrew F. Davis /* Define the TPS65086 IRQ numbers */
96b45b719eSAndrew F. Davis enum tps65086_irqs {
97b45b719eSAndrew F. Davis 	TPS65086_IRQ_DIETEMP,
98b45b719eSAndrew F. Davis 	TPS65086_IRQ_SHUTDN,
99b45b719eSAndrew F. Davis 	TPS65086_IRQ_FAULT,
100b45b719eSAndrew F. Davis };
101b45b719eSAndrew F. Davis 
102b45b719eSAndrew F. Davis /**
103b45b719eSAndrew F. Davis  * struct tps65086 - state holder for the tps65086 driver
104b45b719eSAndrew F. Davis  *
105b45b719eSAndrew F. Davis  * Device data may be used to access the TPS65086 chip
106b45b719eSAndrew F. Davis  */
107b45b719eSAndrew F. Davis struct tps65086 {
108b45b719eSAndrew F. Davis 	struct device *dev;
109b45b719eSAndrew F. Davis 	struct regmap *regmap;
110*c0146735SAndre Werner 	unsigned int chip_id;
111b45b719eSAndrew F. Davis 
112b45b719eSAndrew F. Davis 	/* IRQ Data */
113b45b719eSAndrew F. Davis 	int irq;
114b45b719eSAndrew F. Davis 	struct regmap_irq_chip_data *irq_data;
115b45b719eSAndrew F. Davis };
116b45b719eSAndrew F. Davis 
117b45b719eSAndrew F. Davis #endif /* __LINUX_MFD_TPS65086_H */
118