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