xref: /linux/include/linux/mfd/rohm-bd96801.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1*7276f425SMatti Vaittinen /* SPDX-License-Identifier: GPL-2.0-or-later */
2*7276f425SMatti Vaittinen /* Copyright (C) 2024 ROHM Semiconductors */
3*7276f425SMatti Vaittinen 
4*7276f425SMatti Vaittinen #ifndef __MFD_BD96801_H__
5*7276f425SMatti Vaittinen #define __MFD_BD96801_H__
6*7276f425SMatti Vaittinen 
7*7276f425SMatti Vaittinen #define BD96801_REG_SSCG_CTRL		0x09
8*7276f425SMatti Vaittinen #define BD96801_REG_SHD_INTB            0x20
9*7276f425SMatti Vaittinen #define BD96801_LDO5_VOL_LVL_REG	0x2c
10*7276f425SMatti Vaittinen #define BD96801_LDO6_VOL_LVL_REG	0x2d
11*7276f425SMatti Vaittinen #define BD96801_LDO7_VOL_LVL_REG	0x2e
12*7276f425SMatti Vaittinen #define BD96801_REG_BUCK_OVP		0x30
13*7276f425SMatti Vaittinen #define BD96801_REG_BUCK_OVD		0x35
14*7276f425SMatti Vaittinen #define BD96801_REG_LDO_OVP		0x31
15*7276f425SMatti Vaittinen #define BD96801_REG_LDO_OVD		0x36
16*7276f425SMatti Vaittinen #define BD96801_REG_BOOT_OVERTIME	0x3a
17*7276f425SMatti Vaittinen #define BD96801_REG_WD_TMO		0x40
18*7276f425SMatti Vaittinen #define BD96801_REG_WD_CONF		0x41
19*7276f425SMatti Vaittinen #define BD96801_REG_WD_FEED		0x42
20*7276f425SMatti Vaittinen #define BD96801_REG_WD_FAILCOUNT	0x43
21*7276f425SMatti Vaittinen #define BD96801_REG_WD_ASK		0x46
22*7276f425SMatti Vaittinen #define BD96801_REG_WD_STATUS		0x4a
23*7276f425SMatti Vaittinen #define BD96801_REG_PMIC_STATE		0x4f
24*7276f425SMatti Vaittinen #define BD96801_REG_EXT_STATE		0x50
25*7276f425SMatti Vaittinen 
26*7276f425SMatti Vaittinen #define BD96801_STATE_STBY		0x09
27*7276f425SMatti Vaittinen 
28*7276f425SMatti Vaittinen #define BD96801_LOCK_REG		0x04
29*7276f425SMatti Vaittinen #define BD96801_UNLOCK			0x9d
30*7276f425SMatti Vaittinen #define BD96801_LOCK			0x00
31*7276f425SMatti Vaittinen 
32*7276f425SMatti Vaittinen /* IRQ register area */
33*7276f425SMatti Vaittinen #define BD96801_REG_INT_MAIN		0x51
34*7276f425SMatti Vaittinen 
35*7276f425SMatti Vaittinen /*
36*7276f425SMatti Vaittinen  * The BD96801 has two physical IRQ lines, INTB and ERRB.
37*7276f425SMatti Vaittinen  *
38*7276f425SMatti Vaittinen  * The 'main status register' is located at 0x51.
39*7276f425SMatti Vaittinen  * The ERRB status registers are located at 0x52 ... 0x5B
40*7276f425SMatti Vaittinen  * INTB status registers are at range 0x5c ... 0x63
41*7276f425SMatti Vaittinen  */
42*7276f425SMatti Vaittinen #define BD96801_REG_INT_SYS_ERRB1	0x52
43*7276f425SMatti Vaittinen #define BD96801_REG_INT_SYS_INTB	0x5c
44*7276f425SMatti Vaittinen #define BD96801_REG_INT_LDO7_INTB	0x63
45*7276f425SMatti Vaittinen 
46*7276f425SMatti Vaittinen /* MASK registers */
47*7276f425SMatti Vaittinen #define BD96801_REG_MASK_SYS_INTB	0x73
48*7276f425SMatti Vaittinen #define BD96801_REG_MASK_SYS_ERRB	0x69
49*7276f425SMatti Vaittinen 
50*7276f425SMatti Vaittinen #define BD96801_MAX_REGISTER		0x7a
51*7276f425SMatti Vaittinen 
52*7276f425SMatti Vaittinen #define BD96801_OTP_ERR_MASK		BIT(0)
53*7276f425SMatti Vaittinen #define BD96801_DBIST_ERR_MASK		BIT(1)
54*7276f425SMatti Vaittinen #define BD96801_EEP_ERR_MASK		BIT(2)
55*7276f425SMatti Vaittinen #define BD96801_ABIST_ERR_MASK		BIT(3)
56*7276f425SMatti Vaittinen #define BD96801_PRSTB_ERR_MASK		BIT(4)
57*7276f425SMatti Vaittinen #define BD96801_DRMOS1_ERR_MASK		BIT(5)
58*7276f425SMatti Vaittinen #define BD96801_DRMOS2_ERR_MASK		BIT(6)
59*7276f425SMatti Vaittinen #define BD96801_SLAVE_ERR_MASK		BIT(7)
60*7276f425SMatti Vaittinen #define BD96801_VREF_ERR_MASK		BIT(0)
61*7276f425SMatti Vaittinen #define BD96801_TSD_ERR_MASK		BIT(1)
62*7276f425SMatti Vaittinen #define BD96801_UVLO_ERR_MASK		BIT(2)
63*7276f425SMatti Vaittinen #define BD96801_OVLO_ERR_MASK		BIT(3)
64*7276f425SMatti Vaittinen #define BD96801_OSC_ERR_MASK		BIT(4)
65*7276f425SMatti Vaittinen #define BD96801_PON_ERR_MASK		BIT(5)
66*7276f425SMatti Vaittinen #define BD96801_POFF_ERR_MASK		BIT(6)
67*7276f425SMatti Vaittinen #define BD96801_CMD_SHDN_ERR_MASK	BIT(7)
68*7276f425SMatti Vaittinen #define BD96801_INT_PRSTB_WDT_ERR_MASK	BIT(0)
69*7276f425SMatti Vaittinen #define BD96801_INT_CHIP_IF_ERR_MASK	BIT(3)
70*7276f425SMatti Vaittinen #define BD96801_INT_SHDN_ERR_MASK	BIT(7)
71*7276f425SMatti Vaittinen #define BD96801_OUT_PVIN_ERR_MASK	BIT(0)
72*7276f425SMatti Vaittinen #define BD96801_OUT_OVP_ERR_MASK	BIT(1)
73*7276f425SMatti Vaittinen #define BD96801_OUT_UVP_ERR_MASK	BIT(2)
74*7276f425SMatti Vaittinen #define BD96801_OUT_SHDN_ERR_MASK	BIT(7)
75*7276f425SMatti Vaittinen 
76*7276f425SMatti Vaittinen /* ERRB IRQs */
77*7276f425SMatti Vaittinen enum {
78*7276f425SMatti Vaittinen 	/* Reg 0x52, 0x53, 0x54 - ERRB system IRQs */
79*7276f425SMatti Vaittinen 	BD96801_OTP_ERR_STAT,
80*7276f425SMatti Vaittinen 	BD96801_DBIST_ERR_STAT,
81*7276f425SMatti Vaittinen 	BD96801_EEP_ERR_STAT,
82*7276f425SMatti Vaittinen 	BD96801_ABIST_ERR_STAT,
83*7276f425SMatti Vaittinen 	BD96801_PRSTB_ERR_STAT,
84*7276f425SMatti Vaittinen 	BD96801_DRMOS1_ERR_STAT,
85*7276f425SMatti Vaittinen 	BD96801_DRMOS2_ERR_STAT,
86*7276f425SMatti Vaittinen 	BD96801_SLAVE_ERR_STAT,
87*7276f425SMatti Vaittinen 	BD96801_VREF_ERR_STAT,
88*7276f425SMatti Vaittinen 	BD96801_TSD_ERR_STAT,
89*7276f425SMatti Vaittinen 	BD96801_UVLO_ERR_STAT,
90*7276f425SMatti Vaittinen 	BD96801_OVLO_ERR_STAT,
91*7276f425SMatti Vaittinen 	BD96801_OSC_ERR_STAT,
92*7276f425SMatti Vaittinen 	BD96801_PON_ERR_STAT,
93*7276f425SMatti Vaittinen 	BD96801_POFF_ERR_STAT,
94*7276f425SMatti Vaittinen 	BD96801_CMD_SHDN_ERR_STAT,
95*7276f425SMatti Vaittinen 	BD96801_INT_PRSTB_WDT_ERR,
96*7276f425SMatti Vaittinen 	BD96801_INT_CHIP_IF_ERR,
97*7276f425SMatti Vaittinen 	BD96801_INT_SHDN_ERR_STAT,
98*7276f425SMatti Vaittinen 
99*7276f425SMatti Vaittinen 	/* Reg 0x55 BUCK1 ERR IRQs */
100*7276f425SMatti Vaittinen 	BD96801_BUCK1_PVIN_ERR_STAT,
101*7276f425SMatti Vaittinen 	BD96801_BUCK1_OVP_ERR_STAT,
102*7276f425SMatti Vaittinen 	BD96801_BUCK1_UVP_ERR_STAT,
103*7276f425SMatti Vaittinen 	BD96801_BUCK1_SHDN_ERR_STAT,
104*7276f425SMatti Vaittinen 
105*7276f425SMatti Vaittinen 	/* Reg 0x56 BUCK2 ERR IRQs */
106*7276f425SMatti Vaittinen 	BD96801_BUCK2_PVIN_ERR_STAT,
107*7276f425SMatti Vaittinen 	BD96801_BUCK2_OVP_ERR_STAT,
108*7276f425SMatti Vaittinen 	BD96801_BUCK2_UVP_ERR_STAT,
109*7276f425SMatti Vaittinen 	BD96801_BUCK2_SHDN_ERR_STAT,
110*7276f425SMatti Vaittinen 
111*7276f425SMatti Vaittinen 	/* Reg 0x57 BUCK3 ERR IRQs */
112*7276f425SMatti Vaittinen 	BD96801_BUCK3_PVIN_ERR_STAT,
113*7276f425SMatti Vaittinen 	BD96801_BUCK3_OVP_ERR_STAT,
114*7276f425SMatti Vaittinen 	BD96801_BUCK3_UVP_ERR_STAT,
115*7276f425SMatti Vaittinen 	BD96801_BUCK3_SHDN_ERR_STAT,
116*7276f425SMatti Vaittinen 
117*7276f425SMatti Vaittinen 	/* Reg 0x58 BUCK4 ERR IRQs */
118*7276f425SMatti Vaittinen 	BD96801_BUCK4_PVIN_ERR_STAT,
119*7276f425SMatti Vaittinen 	BD96801_BUCK4_OVP_ERR_STAT,
120*7276f425SMatti Vaittinen 	BD96801_BUCK4_UVP_ERR_STAT,
121*7276f425SMatti Vaittinen 	BD96801_BUCK4_SHDN_ERR_STAT,
122*7276f425SMatti Vaittinen 
123*7276f425SMatti Vaittinen 	/* Reg 0x59 LDO5 ERR IRQs */
124*7276f425SMatti Vaittinen 	BD96801_LDO5_PVIN_ERR_STAT,
125*7276f425SMatti Vaittinen 	BD96801_LDO5_OVP_ERR_STAT,
126*7276f425SMatti Vaittinen 	BD96801_LDO5_UVP_ERR_STAT,
127*7276f425SMatti Vaittinen 	BD96801_LDO5_SHDN_ERR_STAT,
128*7276f425SMatti Vaittinen 
129*7276f425SMatti Vaittinen 	/* Reg 0x5a LDO6 ERR IRQs */
130*7276f425SMatti Vaittinen 	BD96801_LDO6_PVIN_ERR_STAT,
131*7276f425SMatti Vaittinen 	BD96801_LDO6_OVP_ERR_STAT,
132*7276f425SMatti Vaittinen 	BD96801_LDO6_UVP_ERR_STAT,
133*7276f425SMatti Vaittinen 	BD96801_LDO6_SHDN_ERR_STAT,
134*7276f425SMatti Vaittinen 
135*7276f425SMatti Vaittinen 	/* Reg 0x5b LDO7 ERR IRQs */
136*7276f425SMatti Vaittinen 	BD96801_LDO7_PVIN_ERR_STAT,
137*7276f425SMatti Vaittinen 	BD96801_LDO7_OVP_ERR_STAT,
138*7276f425SMatti Vaittinen 	BD96801_LDO7_UVP_ERR_STAT,
139*7276f425SMatti Vaittinen 	BD96801_LDO7_SHDN_ERR_STAT,
140*7276f425SMatti Vaittinen };
141*7276f425SMatti Vaittinen 
142*7276f425SMatti Vaittinen /* INTB IRQs */
143*7276f425SMatti Vaittinen enum {
144*7276f425SMatti Vaittinen 	/* Reg 0x5c (System INTB) */
145*7276f425SMatti Vaittinen 	BD96801_TW_STAT,
146*7276f425SMatti Vaittinen 	BD96801_WDT_ERR_STAT,
147*7276f425SMatti Vaittinen 	BD96801_I2C_ERR_STAT,
148*7276f425SMatti Vaittinen 	BD96801_CHIP_IF_ERR_STAT,
149*7276f425SMatti Vaittinen 
150*7276f425SMatti Vaittinen 	/* Reg 0x5d (BUCK1 INTB) */
151*7276f425SMatti Vaittinen 	BD96801_BUCK1_OCPH_STAT,
152*7276f425SMatti Vaittinen 	BD96801_BUCK1_OCPL_STAT,
153*7276f425SMatti Vaittinen 	BD96801_BUCK1_OCPN_STAT,
154*7276f425SMatti Vaittinen 	BD96801_BUCK1_OVD_STAT,
155*7276f425SMatti Vaittinen 	BD96801_BUCK1_UVD_STAT,
156*7276f425SMatti Vaittinen 	BD96801_BUCK1_TW_CH_STAT,
157*7276f425SMatti Vaittinen 
158*7276f425SMatti Vaittinen 	/* Reg 0x5e (BUCK2 INTB) */
159*7276f425SMatti Vaittinen 	BD96801_BUCK2_OCPH_STAT,
160*7276f425SMatti Vaittinen 	BD96801_BUCK2_OCPL_STAT,
161*7276f425SMatti Vaittinen 	BD96801_BUCK2_OCPN_STAT,
162*7276f425SMatti Vaittinen 	BD96801_BUCK2_OVD_STAT,
163*7276f425SMatti Vaittinen 	BD96801_BUCK2_UVD_STAT,
164*7276f425SMatti Vaittinen 	BD96801_BUCK2_TW_CH_STAT,
165*7276f425SMatti Vaittinen 
166*7276f425SMatti Vaittinen 	/* Reg 0x5f (BUCK3 INTB)*/
167*7276f425SMatti Vaittinen 	BD96801_BUCK3_OCPH_STAT,
168*7276f425SMatti Vaittinen 	BD96801_BUCK3_OCPL_STAT,
169*7276f425SMatti Vaittinen 	BD96801_BUCK3_OCPN_STAT,
170*7276f425SMatti Vaittinen 	BD96801_BUCK3_OVD_STAT,
171*7276f425SMatti Vaittinen 	BD96801_BUCK3_UVD_STAT,
172*7276f425SMatti Vaittinen 	BD96801_BUCK3_TW_CH_STAT,
173*7276f425SMatti Vaittinen 
174*7276f425SMatti Vaittinen 	/* Reg 0x60 (BUCK4 INTB)*/
175*7276f425SMatti Vaittinen 	BD96801_BUCK4_OCPH_STAT,
176*7276f425SMatti Vaittinen 	BD96801_BUCK4_OCPL_STAT,
177*7276f425SMatti Vaittinen 	BD96801_BUCK4_OCPN_STAT,
178*7276f425SMatti Vaittinen 	BD96801_BUCK4_OVD_STAT,
179*7276f425SMatti Vaittinen 	BD96801_BUCK4_UVD_STAT,
180*7276f425SMatti Vaittinen 	BD96801_BUCK4_TW_CH_STAT,
181*7276f425SMatti Vaittinen 
182*7276f425SMatti Vaittinen 	/* Reg 0x61 (LDO5 INTB) */
183*7276f425SMatti Vaittinen 	BD96801_LDO5_OCPH_STAT, /* bit [0] */
184*7276f425SMatti Vaittinen 	BD96801_LDO5_OVD_STAT,	/* bit [3] */
185*7276f425SMatti Vaittinen 	BD96801_LDO5_UVD_STAT,  /* bit [4] */
186*7276f425SMatti Vaittinen 
187*7276f425SMatti Vaittinen 	/* Reg 0x62 (LDO6 INTB) */
188*7276f425SMatti Vaittinen 	BD96801_LDO6_OCPH_STAT, /* bit [0] */
189*7276f425SMatti Vaittinen 	BD96801_LDO6_OVD_STAT,	/* bit [3] */
190*7276f425SMatti Vaittinen 	BD96801_LDO6_UVD_STAT,  /* bit [4] */
191*7276f425SMatti Vaittinen 
192*7276f425SMatti Vaittinen 	/* Reg 0x63 (LDO7 INTB) */
193*7276f425SMatti Vaittinen 	BD96801_LDO7_OCPH_STAT, /* bit [0] */
194*7276f425SMatti Vaittinen 	BD96801_LDO7_OVD_STAT,	/* bit [3] */
195*7276f425SMatti Vaittinen 	BD96801_LDO7_UVD_STAT,  /* bit [4] */
196*7276f425SMatti Vaittinen };
197*7276f425SMatti Vaittinen 
198*7276f425SMatti Vaittinen /* IRQ MASKs */
199*7276f425SMatti Vaittinen #define BD96801_TW_STAT_MASK		BIT(0)
200*7276f425SMatti Vaittinen #define BD96801_WDT_ERR_STAT_MASK	BIT(1)
201*7276f425SMatti Vaittinen #define BD96801_I2C_ERR_STAT_MASK	BIT(2)
202*7276f425SMatti Vaittinen #define BD96801_CHIP_IF_ERR_STAT_MASK	BIT(3)
203*7276f425SMatti Vaittinen 
204*7276f425SMatti Vaittinen #define BD96801_BUCK_OCPH_STAT_MASK	BIT(0)
205*7276f425SMatti Vaittinen #define BD96801_BUCK_OCPL_STAT_MASK	BIT(1)
206*7276f425SMatti Vaittinen #define BD96801_BUCK_OCPN_STAT_MASK	BIT(2)
207*7276f425SMatti Vaittinen #define BD96801_BUCK_OVD_STAT_MASK	BIT(3)
208*7276f425SMatti Vaittinen #define BD96801_BUCK_UVD_STAT_MASK	BIT(4)
209*7276f425SMatti Vaittinen #define BD96801_BUCK_TW_CH_STAT_MASK	BIT(5)
210*7276f425SMatti Vaittinen 
211*7276f425SMatti Vaittinen #define BD96801_LDO_OCPH_STAT_MASK	BIT(0)
212*7276f425SMatti Vaittinen #define BD96801_LDO_OVD_STAT_MASK	BIT(3)
213*7276f425SMatti Vaittinen #define BD96801_LDO_UVD_STAT_MASK	BIT(4)
214*7276f425SMatti Vaittinen 
215*7276f425SMatti Vaittinen #endif
216