blob: c567ec2752c11c7bdcba3cec86a5615bdadd45c1 [file] [log] [blame]
Nicholas Troast34db5032016-03-28 12:26:44 -07001/* Copyright (c) 2016 The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __SMB2_CHARGER_REG_H
14#define __SMB2_CHARGER_REG_H
15
16#include <linux/bitops.h>
17
18#define CHGR_BASE 0x1000
19#define OTG_BASE 0x1100
20#define BATIF_BASE 0x1200
21#define USBIN_BASE 0x1300
22#define DCIN_BASE 0x1400
23#define MISC_BASE 0x1600
24
25#define PERPH_TYPE_OFFSET 0x04
26#define TYPE_MASK GENMASK(7, 0)
27#define PERPH_SUBTYPE_OFFSET 0x05
28#define SUBTYPE_MASK GENMASK(7, 0)
29#define INT_RT_STS_OFFSET 0x10
30
31/* CHGR Peripheral Registers */
32#define BATTERY_CHARGER_STATUS_1_REG (CHGR_BASE + 0x06)
33#define BVR_INITIAL_RAMP_BIT BIT(7)
34#define CC_SOFT_TERMINATE_BIT BIT(6)
Harry Yangbedee332016-08-31 16:14:29 -070035#define STEP_CHARGING_STATUS_SHIFT 3
Nicholas Troast34db5032016-03-28 12:26:44 -070036#define STEP_CHARGING_STATUS_MASK GENMASK(5, 3)
37#define BATTERY_CHARGER_STATUS_MASK GENMASK(2, 0)
38enum {
39 TRICKLE_CHARGE = 0,
40 PRE_CHARGE,
41 FAST_CHARGE,
42 FULLON_CHARGE,
43 TAPER_CHARGE,
Nicholas Troast8cb77552016-09-23 11:50:18 -070044 TERMINATE_CHARGE,
Nicholas Troast34db5032016-03-28 12:26:44 -070045 INHIBIT_CHARGE,
Nicholas Troast8cb77552016-09-23 11:50:18 -070046 DISABLE_CHARGE,
Nicholas Troast34db5032016-03-28 12:26:44 -070047};
48
49#define BATTERY_CHARGER_STATUS_2_REG (CHGR_BASE + 0x07)
50#define INPUT_CURRENT_LIMITED_BIT BIT(7)
51#define CHARGER_ERROR_STATUS_SFT_EXPIRE_BIT BIT(6)
52#define CHARGER_ERROR_STATUS_BAT_OV_BIT BIT(5)
53#define CHARGER_ERROR_STATUS_BAT_TERM_MISSING_BIT BIT(4)
54#define BAT_TEMP_STATUS_MASK GENMASK(3, 0)
55#define BAT_TEMP_STATUS_HOT_SOFT_LIMIT_BIT BIT(3)
56#define BAT_TEMP_STATUS_COLD_SOFT_LIMIT_BIT BIT(2)
57#define BAT_TEMP_STATUS_TOO_HOT_BIT BIT(1)
58#define BAT_TEMP_STATUS_TOO_COLD_BIT BIT(0)
59
60#define CHG_OPTION_REG (CHGR_BASE + 0x08)
61#define PIN_BIT BIT(7)
62
63#define BATTERY_CHARGER_STATUS_3_REG (CHGR_BASE + 0x09)
64#define FV_POST_JEITA_MASK GENMASK(7, 0)
65
66#define BATTERY_CHARGER_STATUS_4_REG (CHGR_BASE + 0x0A)
67#define CHARGE_CURRENT_POST_JEITA_MASK GENMASK(7, 0)
68
69#define BATTERY_CHARGER_STATUS_5_REG (CHGR_BASE + 0x0B)
70#define VALID_INPUT_POWER_SOURCE_BIT BIT(7)
71#define DISABLE_CHARGING_BIT BIT(6)
72#define FORCE_ZERO_CHARGE_CURRENT_BIT BIT(5)
73#define CHARGING_ENABLE_BIT BIT(4)
74#define TAPER_BIT BIT(3)
75#define ENABLE_CHG_SENSORS_BIT BIT(2)
76#define ENABLE_TAPER_SENSOR_BIT BIT(1)
77#define TAPER_REGION_BIT BIT(0)
78
79#define BATTERY_CHARGER_STATUS_6_REG (CHGR_BASE + 0x0C)
80#define GF_BATT_OV_BIT BIT(7)
81#define DROP_IN_BATTERY_VOLTAGE_REFERENCE_BIT BIT(6)
82#define VBATT_LTET_RECHARGE_BIT BIT(5)
83#define VBATT_GTET_INHIBIT_BIT BIT(4)
84#define VBATT_GTET_FLOAT_VOLTAGE_BIT BIT(3)
85#define BATT_GT_PRE_TO_FAST_BIT BIT(2)
86#define BATT_GT_FULL_ON_BIT BIT(1)
87#define VBATT_LT_2V_BIT BIT(0)
88
89#define BATTERY_CHARGER_STATUS_7_REG (CHGR_BASE + 0x0D)
90#define ENABLE_TRICKLE_BIT BIT(7)
91#define ENABLE_PRE_CHARGING_BIT BIT(6)
92#define ENABLE_FAST_CHARGING_BIT BIT(5)
93#define ENABLE_FULLON_MODE_BIT BIT(4)
94#define TOO_COLD_ADC_BIT BIT(3)
95#define TOO_HOT_ADC_BIT BIT(2)
96#define HOT_SL_ADC_BIT BIT(1)
97#define COLD_SL_ADC_BIT BIT(0)
98
99#define BATTERY_CHARGER_STATUS_8_REG (CHGR_BASE + 0x0E)
100#define PRE_FAST_BIT BIT(7)
101#define PRE_FULLON_BIT BIT(6)
102#define PRE_RCHG_BIT BIT(5)
103#define PRE_INHIBIT_BIT BIT(4)
104#define PRE_OVRV_BIT BIT(3)
105#define PRE_TERM_BIT BIT(2)
106#define BAT_ID_BMISS_CMP_BIT BIT(1)
107#define THERM_CMP_BIT BIT(0)
108
109/* CHGR Interrupt Bits */
110#define CHGR_7_RT_STS_BIT BIT(7)
111#define CHGR_6_RT_STS_BIT BIT(6)
112#define FG_FVCAL_QUALIFIED_RT_STS_BIT BIT(5)
113#define STEP_CHARGING_SOC_UPDATE_REQUEST_RT_STS_BIT BIT(4)
114#define STEP_CHARGING_SOC_UPDATE_FAIL_RT_STS_BIT BIT(3)
115#define STEP_CHARGING_STATE_CHANGE_RT_STS_BIT BIT(2)
116#define CHARGING_STATE_CHANGE_RT_STS_BIT BIT(1)
117#define CHGR_ERROR_RT_STS_BIT BIT(0)
118
119#define STEP_CHG_SOC_VBATT_V_REG (CHGR_BASE + 0x40)
120#define STEP_CHG_SOC_VBATT_V_MASK GENMASK(7, 0)
121
122#define STEP_CHG_SOC_VBATT_V_UPDATE_REG (CHGR_BASE + 0x41)
123#define STEP_CHG_SOC_VBATT_V_UPDATE_BIT BIT(0)
124
125#define CHARGING_ENABLE_CMD_REG (CHGR_BASE + 0x42)
126#define CHARGING_ENABLE_CMD_BIT BIT(0)
127
128#define ALLOW_FAST_CHARGING_CMD_REG (CHGR_BASE + 0x43)
129#define ALLOW_FAST_CHARGING_CMD_BIT BIT(0)
130
131#define QNOVO_PT_ENABLE_CMD_REG (CHGR_BASE + 0x44)
132#define QNOVO_PT_ENABLE_CMD_BIT BIT(0)
133
134#define CHGR_CFG1_REG (CHGR_BASE + 0x50)
135#define INCREASE_RCHG_TIMEOUT_CFG_BIT BIT(1)
136#define LOAD_BAT_BIT BIT(0)
137
138#define CHGR_CFG2_REG (CHGR_BASE + 0x51)
139#define CHG_EN_SRC_BIT BIT(7)
140#define CHG_EN_POLARITY_BIT BIT(6)
141#define PRETOFAST_TRANSITION_CFG_BIT BIT(5)
142#define BAT_OV_ECC_BIT BIT(4)
143#define I_TERM_BIT BIT(3)
144#define AUTO_RECHG_BIT BIT(2)
145#define EN_ANALOG_DROP_IN_VBATT_BIT BIT(1)
146#define CHARGER_INHIBIT_BIT BIT(0)
147
148#define CHARGER_ENABLE_CFG_REG (CHGR_BASE + 0x52)
149#define CHG_ENB_TIMEOUT_SETTING_BIT BIT(1)
150#define FORCE_ZERO_CFG_BIT BIT(0)
151
152#define CFG_REG (CHGR_BASE + 0x53)
153#define CHG_OPTION_PIN_TRIM_BIT BIT(7)
154#define BATN_SNS_CFG_BIT BIT(4)
155#define CFG_TAPER_DIS_AFVC_BIT BIT(3)
156#define BATFET_SHUTDOWN_CFG_BIT BIT(2)
157#define VDISCHG_EN_CFG_BIT BIT(1)
158#define VCHG_EN_CFG_BIT BIT(0)
159
160#define CHARGER_SPARE_REG (CHGR_BASE + 0x54)
161#define CHARGER_SPARE_MASK GENMASK(5, 0)
162
163#define PRE_CHARGE_CURRENT_CFG_REG (CHGR_BASE + 0x60)
164#define PRE_CHARGE_CURRENT_SETTING_MASK GENMASK(5, 0)
165
166#define FAST_CHARGE_CURRENT_CFG_REG (CHGR_BASE + 0x61)
167#define FAST_CHARGE_CURRENT_SETTING_MASK GENMASK(7, 0)
168
169#define CHARGE_CURRENT_TERMINATION_CFG_REG (CHGR_BASE + 0x62)
170#define ANALOG_CHARGE_CURRENT_TERMINATION_SETTING_MASK GENMASK(2, 0)
171
172#define TCCC_CHARGE_CURRENT_TERMINATION_CFG_REG (CHGR_BASE + 0x63)
173#define TCCC_CHARGE_CURRENT_TERMINATION_SETTING_MASK GENMASK(3, 0)
174
175#define CHARGE_CURRENT_SOFTSTART_SETTING_CFG_REG (CHGR_BASE + 0x64)
176#define CHARGE_CURRENT_SOFTSTART_SETTING_MASK GENMASK(1, 0)
177
178#define FLOAT_VOLTAGE_CFG_REG (CHGR_BASE + 0x70)
179#define FLOAT_VOLTAGE_SETTING_MASK GENMASK(7, 0)
180
181#define AUTO_FLOAT_VOLTAGE_COMPENSATION_CFG_REG (CHGR_BASE + 0x71)
182#define AUTO_FLOAT_VOLTAGE_COMPENSATION_MASK GENMASK(2, 0)
183
184#define CHARGE_INHIBIT_THRESHOLD_CFG_REG (CHGR_BASE + 0x72)
185#define CHARGE_INHIBIT_THRESHOLD_MASK GENMASK(1, 0)
186
187#define RECHARGE_THRESHOLD_CFG_REG (CHGR_BASE + 0x73)
188#define RECHARGE_THRESHOLD_MASK GENMASK(1, 0)
189
190#define PRE_TO_FAST_CHARGE_THRESHOLD_CFG_REG (CHGR_BASE + 0x74)
191#define PRE_TO_FAST_CHARGE_THRESHOLD_MASK GENMASK(1, 0)
192
193#define FV_HYSTERESIS_CFG_REG (CHGR_BASE + 0x75)
194#define FV_DROP_HYSTERESIS_CFG_MASK GENMASK(7, 4)
195#define THRESH_HYSTERESIS_CFG_MASK GENMASK(3, 0)
196
197#define FVC_CHARGE_INHIBIT_THRESHOLD_CFG_REG (CHGR_BASE + 0x80)
198#define FVC_CHARGE_INHIBIT_THRESHOLD_MASK GENMASK(5, 0)
199
200#define FVC_RECHARGE_THRESHOLD_CFG_REG (CHGR_BASE + 0x81)
201#define FVC_RECHARGE_THRESHOLD_MASK GENMASK(7, 0)
202
203#define FVC_PRE_TO_FAST_CHARGE_THRESHOLD_CFG_REG (CHGR_BASE + 0x82)
204#define FVC_PRE_TO_FAST_CHARGE_THRESHOLD_MASK GENMASK(7, 0)
205
206#define FVC_FULL_ON_THRESHOLD_CFG_REG (CHGR_BASE + 0x83)
207#define FVC_FULL_ON_THRESHOLD_MASK GENMASK(7, 0)
208
209#define FVC_CC_MODE_GLITCH_FILTER_SEL_CFG_REG (CHGR_BASE + 0x84)
210#define FVC_CC_MODE_GLITCH_FILTER_SEL_MASK GENMASK(1, 0)
211
212#define FVC_TERMINATION_GLITCH_FILTER_SEL_CFG_REG (CHGR_BASE + 0x85)
213#define FVC_TERMINATION_GLITCH_FILTER_SEL_MASK GENMASK(1, 0)
214
215#define JEITA_EN_CFG_REG (CHGR_BASE + 0x90)
216#define JEITA_EN_HARDLIMIT_BIT BIT(4)
217#define JEITA_EN_HOT_SL_FCV_BIT BIT(3)
218#define JEITA_EN_COLD_SL_FCV_BIT BIT(2)
219#define JEITA_EN_HOT_SL_CCC_BIT BIT(1)
220#define JEITA_EN_COLD_SL_CCC_BIT BIT(0)
221
222#define JEITA_FVCOMP_CFG_REG (CHGR_BASE + 0x91)
223#define JEITA_FVCOMP_MASK GENMASK(7, 0)
224
225#define JEITA_CCCOMP_CFG_REG (CHGR_BASE + 0x92)
226#define JEITA_CCCOMP_MASK GENMASK(7, 0)
227
228#define FV_CAL_CFG_REG (CHGR_BASE + 0x76)
229#define FV_CALIBRATION_CFG_MASK GENMASK(2, 0)
230
231#define FV_ADJUST_REG (CHGR_BASE + 0x77)
232#define FLOAT_VOLTAGE_ADJUSTMENT_MASK GENMASK(4, 0)
233
234#define FG_VADC_DISQ_THRESH_REG (CHGR_BASE + 0x78)
235#define VADC_DISQUAL_THRESH_MASK GENMASK(7, 0)
236
237#define FG_IADC_DISQ_THRESH_REG (CHGR_BASE + 0x79)
238#define IADC_DISQUAL_THRESH_MASK GENMASK(7, 0)
239
240#define FG_UPDATE_CFG_1_REG (CHGR_BASE + 0x7A)
241#define BT_TMPR_TCOLD_BIT BIT(7)
242#define BT_TMPR_COLD_BIT BIT(6)
243#define BT_TMPR_HOT_BIT BIT(5)
244#define BT_TMPR_THOT_BIT BIT(4)
245#define CHG_DIE_TMPR_HOT_BIT BIT(3)
246#define CHG_DIE_TMPR_THOT_BIT BIT(2)
247#define SKIN_TMPR_HOT_BIT BIT(1)
248#define SKIN_TMPR_THOT_BIT BIT(0)
249
250#define FG_UPDATE_CFG_1_SEL_REG (CHGR_BASE + 0x7B)
251#define BT_TMPR_TCOLD_SEL_BIT BIT(7)
252#define BT_TMPR_COLD_SEL_BIT BIT(6)
253#define BT_TMPR_HOT_SEL_BIT BIT(5)
254#define BT_TMPR_THOT_SEL_BIT BIT(4)
255#define CHG_DIE_TMPR_HOT_SEL_BIT BIT(3)
256#define CHG_DIE_TMPR_THOT_SEL_BIT BIT(2)
257#define SKIN_TMPR_HOT_SEL_BIT BIT(1)
258#define SKIN_TMPR_THOT_SEL_BIT BIT(0)
259
260#define FG_UPDATE_CFG_2_REG (CHGR_BASE + 0x7C)
261#define SOC_LT_OTG_THRESH_BIT BIT(3)
262#define SOC_LT_CHG_RECHARGE_THRESH_BIT BIT(2)
263#define VBT_LT_CHG_RECHARGE_THRESH_BIT BIT(1)
264#define IBT_LT_CHG_TERM_THRESH_BIT BIT(0)
265
266#define FG_UPDATE_CFG_2_SEL_REG (CHGR_BASE + 0x7D)
267#define SOC_LT_OTG_THRESH_SEL_BIT BIT(3)
268#define SOC_LT_CHG_RECHARGE_THRESH_SEL_BIT BIT(2)
269#define VBT_LT_CHG_RECHARGE_THRESH_SEL_BIT BIT(1)
270#define IBT_LT_CHG_TERM_THRESH_SEL_BIT BIT(0)
271
272#define FG_CHG_INTERFACE_CFG_REG (CHGR_BASE + 0x7E)
273#define ESR_ISINK_CFG_MASK GENMASK(7, 6)
274#define ESR_FASTCHG_DECR_CFG_MASK GENMASK(5, 4)
275#define FG_CHARGER_INHIBIT_BIT BIT(3)
276#define FG_BATFET_BIT BIT(2)
277#define IADC_SYNC_CNV_BIT BIT(1)
278#define VADC_SYNC_CNV_BIT BIT(0)
279
280#define FG_CHG_INTERFACE_CFG_SEL_REG (CHGR_BASE + 0x7F)
281#define ESR_ISINK_CFG_SEL_BIT BIT(5)
282#define ESR_FASTCHG_DECR_CFG_SEL_BIT BIT(4)
283#define FG_CHARGER_INHIBIT_SEL_BIT BIT(3)
284#define FG_BATFET_SEL_BIT BIT(2)
285#define IADC_SYNC_CNV_SEL_BIT BIT(1)
286#define VADC_SYNC_CNV_SEL_BIT BIT(0)
287
Harry Yangfe913842016-08-10 12:27:28 -0700288#define CHGR_STEP_CHG_MODE_CFG_REG (CHGR_BASE + 0xB0)
289#define STEP_CHARGING_SOC_FAIL_OPTION_BIT BIT(3)
290#define STEP_CHARGING_MODE_SELECT_BIT BIT(2)
291#define STEP_CHARGING_SOURCE_SELECT_BIT BIT(1)
292#define STEP_CHARGING_ENABLE_BIT BIT(0)
293
294#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_CFG_REG (CHGR_BASE + 0xB1)
295#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_CFG_MASK GENMASK(0, 1)
296#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_5S 0
297#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_10S 1
298#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_20S 2
299#define STEP_CHG_UPDATE_REQUEST_TIMEOUT_40S 3
300
301#define STEP_CHG_UPDATE_FAIL_TIMEOUT_CFG_REG (CHGR_BASE + 0xB2)
302#define STEP_CHG_UPDATE_FAIL_TIMEOUT_CFG_MASK GENMASK(0, 1)
303#define STEP_CHG_UPDATE_FAIL_TIMEOUT_10S 0
304#define STEP_CHG_UPDATE_FAIL_TIMEOUT_30S 1
305#define STEP_CHG_UPDATE_FAIL_TIMEOUT_60S 2
306#define STEP_CHG_UPDATE_FAIL_TIMEOUT_120S 3
307
308#define STEP_CHG_SOC_OR_BATT_V_TH1_REG (CHGR_BASE + 0xB3)
309#define STEP_CHG_SOC_OR_BATT_V_TH2_REG (CHGR_BASE + 0xB4)
310#define STEP_CHG_SOC_OR_BATT_V_TH3_REG (CHGR_BASE + 0xB5)
311#define STEP_CHG_SOC_OR_BATT_V_TH4_REG (CHGR_BASE + 0xB6)
312#define STEP_CHG_CURRENT_DELTA1_REG (CHGR_BASE + 0xB7)
313#define STEP_CHG_CURRENT_DELTA2_REG (CHGR_BASE + 0xB8)
314#define STEP_CHG_CURRENT_DELTA3_REG (CHGR_BASE + 0xB9)
315#define STEP_CHG_CURRENT_DELTA4_REG (CHGR_BASE + 0xBA)
316#define STEP_CHG_CURRENT_DELTA5_REG (CHGR_BASE + 0xBB)
317
Nicholas Troast34db5032016-03-28 12:26:44 -0700318/* OTG Peripheral Registers */
319#define RID_CC_CONTROL_23_16_REG (OTG_BASE + 0x06)
320#define RID_CC_CONTROL_23_BIT BIT(7)
321#define VCONN_SOFTSTART_EN_BIT BIT(6)
322#define VCONN_SFTST_CFG_MASK GENMASK(5, 4)
323#define CONNECT_RIDCC_SENSOR_TO_CC_MASK GENMASK(3, 2)
324#define EN_CC_1P1CLAMP_BIT BIT(1)
325#define ENABLE_CRUDESEN_CC_1_BIT BIT(0)
326
327#define RID_CC_CONTROL_15_8_REG (OTG_BASE + 0x07)
328#define ENABLE_CRUDESEN_CC_0_BIT BIT(7)
329#define EN_FMB_2P5UA_CC_MASK GENMASK(6, 5)
330#define EN_ISRC_180UA_BIT BIT(4)
331#define ENABLE_CURRENTSOURCE_CC_MASK GENMASK(3, 2)
332#define EN_BANDGAP_RID_C_DET_BIT BIT(1)
333#define ENABLE_RD_CC_1_BIT BIT(0)
334
335#define RID_CC_CONTROL_7_0_REG (OTG_BASE + 0x08)
336#define ENABLE_RD_CC_0_BIT BIT(7)
337#define VCONN_ILIM500MA_BIT BIT(6)
338#define EN_MICRO_USB_MODE_BIT BIT(5)
339#define UFP_DFP_MODE_BIT BIT(4)
340#define VCONN_EN_CC_MASK GENMASK(3, 2)
341#define VREF_SEL_RIDCC_SENSOR_MASK GENMASK(1, 0)
342
343#define OTG_STATUS_REG (OTG_BASE + 0x09)
344#define BOOST_SOFTSTART_DONE_BIT BIT(3)
345#define OTG_STATE_MASK GENMASK(2, 0)
346
347/* OTG Interrupt Bits */
348#define TESTMODE_CHANGE_DETECT_RT_STS_BIT BIT(3)
349#define OTG_OC_DIS_SW_STS_RT_STS_BIT BIT(2)
350#define OTG_OVERCURRENT_RT_STS_BIT BIT(1)
351#define OTG_FAIL_RT_STS_BIT BIT(0)
352
353#define CMD_OTG_REG (OTG_BASE + 0x40)
354#define OTG_EN_BIT BIT(0)
355
356#define BAT_UVLO_THRESHOLD_CFG_REG (OTG_BASE + 0x51)
357#define BAT_UVLO_THRESHOLD_MASK GENMASK(1, 0)
358
359#define OTG_CURRENT_LIMIT_CFG_REG (OTG_BASE + 0x52)
360#define OTG_CURRENT_LIMIT_MASK GENMASK(2, 0)
361
362#define OTG_CFG_REG (OTG_BASE + 0x53)
363#define OTG_RESERVED_MASK GENMASK(7, 4)
364#define INCREASE_DFP_TIME_BIT BIT(3)
365#define ENABLE_OTG_IN_DEBUG_MODE_BIT BIT(2)
366#define OTG_EN_SRC_CFG_BIT BIT(1)
367#define CONCURRENT_MODE_CFG_BIT BIT(0)
368
Harry Yang360bd532016-09-26 11:03:22 -0700369#define OTG_ENG_OTG_CFG_REG (OTG_BASE + 0xC0)
370#define ENG_BUCKBOOST_HALT1_8_MODE_BIT BIT(0)
371
Nicholas Troast34db5032016-03-28 12:26:44 -0700372/* BATIF Peripheral Registers */
373/* BATIF Interrupt Bits */
374#define BAT_7_RT_STS_BIT BIT(7)
375#define BAT_6_RT_STS_BIT BIT(6)
376#define BAT_TERMINAL_MISSING_RT_STS_BIT BIT(5)
377#define BAT_THERM_OR_ID_MISSING_RT_STS_BIT BIT(4)
378#define BAT_LOW_RT_STS_BIT BIT(3)
379#define BAT_OV_RT_STS_BIT BIT(2)
380#define BAT_OCP_RT_STS_BIT BIT(1)
381#define BAT_TEMP_RT_STS_BIT BIT(0)
382
383#define SHIP_MODE_REG (BATIF_BASE + 0x40)
384#define SHIP_MODE_EN_BIT BIT(0)
385
386#define BATOCP_THRESHOLD_CFG_REG (BATIF_BASE + 0x50)
387#define BATOCP_ENABLE_CFG_BIT BIT(3)
388#define BATOCP_THRESHOLD_MASK GENMASK(2, 0)
389
390#define BATOCP_INTRPT_DELAY_TMR_CFG_REG (BATIF_BASE + 0x51)
391#define BATOCP_INTRPT_TIMEOUT_MASK GENMASK(5, 3)
392#define BATOCP_DELAY_TIMEOUT_MASK GENMASK(2, 0)
393
394#define BATOCP_RESET_TMR_CFG_REG (BATIF_BASE + 0x52)
395#define EN_BATOCP_RESET_TMR_BIT BIT(3)
396#define BATOCP_RESET_TIMEOUT_MASK GENMASK(2, 0)
397
398#define LOW_BATT_DETECT_EN_CFG_REG (BATIF_BASE + 0x60)
399#define LOW_BATT_DETECT_EN_BIT BIT(0)
400
401#define LOW_BATT_THRESHOLD_CFG_REG (BATIF_BASE + 0x61)
402#define LOW_BATT_THRESHOLD_MASK GENMASK(3, 0)
403
404#define BAT_FET_CFG_REG (BATIF_BASE + 0x62)
405#define BAT_FET_CFG_BIT BIT(0)
406
407#define BAT_MISS_SRC_CFG_REG (BATIF_BASE + 0x70)
408#define BAT_MISS_ALG_EN_BIT BIT(2)
409#define BAT_MISS_RESERVED_BIT BIT(1)
410#define BAT_MISS_PIN_SRC_EN_BIT BIT(0)
411
412#define BAT_MISS_ALG_OPTIONS_CFG_REG (BATIF_BASE + 0x71)
413#define BAT_MISS_INPUT_PLUGIN_BIT BIT(2)
414#define BAT_MISS_TMR_START_OPTION_BIT BIT(1)
415#define BAT_MISS_POLL_EN_BIT BIT(0)
416
417#define BAT_MISS_PIN_GF_CFG_REG (BATIF_BASE + 0x72)
418#define BAT_MISS_PIN_GF_MASK GENMASK(1, 0)
419
420/* USBIN Peripheral Registers */
421#define USBIN_INPUT_STATUS_REG (USBIN_BASE + 0x06)
422#define USBIN_INPUT_STATUS_7_BIT BIT(7)
423#define USBIN_INPUT_STATUS_6_BIT BIT(6)
424#define USBIN_12V_BIT BIT(5)
425#define USBIN_9V_TO_12V_BIT BIT(4)
426#define USBIN_9V_BIT BIT(3)
427#define USBIN_5V_TO_12V_BIT BIT(2)
428#define USBIN_5V_TO_9V_BIT BIT(1)
429#define USBIN_5V_BIT BIT(0)
430
431#define APSD_STATUS_REG (USBIN_BASE + 0x07)
432#define APSD_STATUS_7_BIT BIT(7)
Harry Yang1369b7a2016-09-27 15:59:50 -0700433#define HVDCP_CHECK_TIMEOUT_BIT BIT(6)
Nicholas Troast34db5032016-03-28 12:26:44 -0700434#define SLOW_PLUGIN_TIMEOUT_BIT BIT(5)
435#define ENUMERATION_DONE_BIT BIT(4)
436#define VADP_CHANGE_DONE_AFTER_AUTH_BIT BIT(3)
437#define QC_AUTH_DONE_STATUS_BIT BIT(2)
438#define QC_CHARGER_BIT BIT(1)
439#define APSD_DTC_STATUS_DONE_BIT BIT(0)
440
441#define APSD_RESULT_STATUS_REG (USBIN_BASE + 0x08)
442#define ICL_OVERRIDE_LATCH_BIT BIT(7)
443#define APSD_RESULT_STATUS_MASK GENMASK(6, 0)
444#define QC_3P0_BIT BIT(6)
445#define QC_2P0_BIT BIT(5)
446#define FLOAT_CHARGER_BIT BIT(4)
447#define DCP_CHARGER_BIT BIT(3)
448#define CDP_CHARGER_BIT BIT(2)
449#define OCP_CHARGER_BIT BIT(1)
450#define SDP_CHARGER_BIT BIT(0)
451
452#define QC_CHANGE_STATUS_REG (USBIN_BASE + 0x09)
453#define QC_CHANGE_STATUS_7_BIT BIT(7)
454#define QC_CHANGE_STATUS_6_BIT BIT(6)
455#define QC_9V_TO_12V_REASON_BIT BIT(5)
456#define QC_5V_TO_9V_REASON_BIT BIT(4)
457#define QC_CONTINUOUS_BIT BIT(3)
458#define QC_12V_BIT BIT(2)
459#define QC_9V_BIT BIT(1)
460#define QC_5V_BIT BIT(0)
461
462#define QC_PULSE_COUNT_STATUS_REG (USBIN_BASE + 0x0A)
463#define QC_PULSE_COUNT_STATUS_7_BIT BIT(7)
464#define QC_PULSE_COUNT_STATUS_6_BIT BIT(6)
465#define QC_PULSE_COUNT_MASK GENMASK(5, 0)
466
467#define TYPE_C_STATUS_1_REG (USBIN_BASE + 0x0B)
468#define UFP_TYPEC_MASK GENMASK(7, 5)
469#define UFP_TYPEC_RDSTD_BIT BIT(7)
470#define UFP_TYPEC_RD1P5_BIT BIT(6)
471#define UFP_TYPEC_RD3P0_BIT BIT(5)
472#define UFP_TYPEC_FMB_255K_BIT BIT(4)
473#define UFP_TYPEC_FMB_301K_BIT BIT(3)
474#define UFP_TYPEC_FMB_523K_BIT BIT(2)
475#define UFP_TYPEC_FMB_619K_BIT BIT(1)
476#define UFP_TYPEC_OPEN_OPEN_BIT BIT(0)
477
478#define TYPE_C_STATUS_2_REG (USBIN_BASE + 0x0C)
Nicholas Troast96886052016-02-25 15:42:17 -0800479#define DFP_TYPEC_MASK 0x8F
480#define DFP_RA_OPEN_BIT BIT(7)
Nicholas Troast34db5032016-03-28 12:26:44 -0700481#define TIMER_STAGE_BIT BIT(6)
482#define EXIT_UFP_MODE_BIT BIT(5)
483#define EXIT_DFP_MODE_BIT BIT(4)
Nicholas Troast34db5032016-03-28 12:26:44 -0700484#define DFP_RD_OPEN_BIT BIT(3)
485#define DFP_RD_RA_VCONN_BIT BIT(2)
486#define DFP_RD_RD_BIT BIT(1)
487#define DFP_RA_RA_BIT BIT(0)
488
489#define TYPE_C_STATUS_3_REG (USBIN_BASE + 0x0D)
490#define ENABLE_BANDGAP_BIT BIT(7)
491#define U_USB_GROUND_NOVBUS_BIT BIT(6)
492#define U_USB_FLOAT_NOVBUS_BIT BIT(5)
493#define U_USB_GROUND_BIT BIT(4)
494#define U_USB_FMB1_BIT BIT(3)
495#define U_USB_FLOAT1_BIT BIT(2)
496#define U_USB_FMB2_BIT BIT(1)
497#define U_USB_FLOAT2_BIT BIT(0)
498
499#define TYPE_C_STATUS_4_REG (USBIN_BASE + 0x0E)
500#define UFP_DFP_MODE_STATUS_BIT BIT(7)
501#define TYPEC_VBUS_STATUS_BIT BIT(6)
502#define TYPEC_VBUS_ERROR_STATUS_BIT BIT(5)
503#define TYPEC_DEBOUNCE_DONE_STATUS_BIT BIT(4)
504#define TYPEC_UFP_AUDIO_ADAPT_STATUS_BIT BIT(3)
505#define TYPEC_VCONN_OVERCURR_STATUS_BIT BIT(2)
506#define CC_ORIENTATION_BIT BIT(1)
507#define CC_ATTACHED_BIT BIT(0)
508
Abhijeet Dharmapurikara8075d72016-10-06 12:59:04 -0700509#define TYPE_C_STATUS_5_REG (USBIN_BASE + 0x0F)
510#define TRY_SOURCE_FAILED_BIT BIT(6)
511#define TRY_SINK_FAILED_BIT BIT(5)
512#define TIMER_STAGE_2_BIT BIT(4)
513#define TYPEC_LEGACY_CABLE_STATUS_BIT BIT(3)
514#define TYPEC_NONCOMP_LEGACY_CABLE_STATUS_BIT BIT(2)
515#define TYPEC_TRYSOURCE_DETECT_STATUS_BIT BIT(1)
516#define TYPEC_TRYSINK_DETECT_STATUS_BIT BIT(0)
517
Nicholas Troast34db5032016-03-28 12:26:44 -0700518/* USBIN Interrupt Bits */
519#define TYPE_C_CHANGE_RT_STS_BIT BIT(7)
520#define USBIN_ICL_CHANGE_RT_STS_BIT BIT(6)
521#define USBIN_SOURCE_CHANGE_RT_STS_BIT BIT(5)
522#define USBIN_PLUGIN_RT_STS_BIT BIT(4)
523#define USBIN_OV_RT_STS_BIT BIT(3)
524#define USBIN_UV_RT_STS_BIT BIT(2)
525#define USBIN_LT_3P6V_RT_STS_BIT BIT(1)
526#define USBIN_COLLAPSE_RT_STS_BIT BIT(0)
527
528#define USBIN_CMD_IL_REG (USBIN_BASE + 0x40)
529#define BAT_2_SYS_FET_DIS_BIT BIT(1)
530#define USBIN_SUSPEND_BIT BIT(0)
531
532#define CMD_APSD_REG (USBIN_BASE + 0x41)
533#define ICL_OVERRIDE_BIT BIT(1)
534#define APSD_RERUN_BIT BIT(0)
535
536#define CMD_HVDCP_2_REG (USBIN_BASE + 0x43)
537#define TRIGGER_AICL_BIT BIT(6)
538#define FORCE_12V_BIT BIT(5)
539#define FORCE_9V_BIT BIT(4)
540#define FORCE_5V_BIT BIT(3)
541#define IDLE_BIT BIT(2)
542#define SINGLE_DECREMENT_BIT BIT(1)
543#define SINGLE_INCREMENT_BIT BIT(0)
544
545#define USB_MISC2_REG (USBIN_BASE + 0x57)
546#define USB_MISC2_MASK GENMASK(1, 0)
547
548#define TYPE_C_CFG_REG (USBIN_BASE + 0x58)
549#define APSD_START_ON_CC_BIT BIT(7)
550#define WAIT_FOR_APSD_BIT BIT(6)
551#define FACTORY_MODE_DETECTION_EN_BIT BIT(5)
552#define FACTORY_MODE_ICL_3A_4A_BIT BIT(4)
553#define FACTORY_MODE_DIS_CHGING_CFG_BIT BIT(3)
554#define SUSPEND_NON_COMPLIANT_CFG_BIT BIT(2)
555#define VCONN_OC_CFG_BIT BIT(1)
556#define TYPE_C_OR_U_USB_BIT BIT(0)
557
558#define TYPE_C_CFG_2_REG (USBIN_BASE + 0x59)
559#define TYPE_C_DFP_CURRSRC_MODE_BIT BIT(7)
560#define VCONN_ILIM500MA_CFG_BIT BIT(6)
561#define VCONN_SOFTSTART_CFG_MASK GENMASK(5, 4)
562#define EN_TRY_SOURCE_MODE_BIT BIT(3)
563#define USB_FACTORY_MODE_ENABLE_BIT BIT(2)
564#define TYPE_C_UFP_MODE_BIT BIT(1)
565#define EN_80UA_180UA_CUR_SOURCE_BIT BIT(0)
566
Abhijeet Dharmapurikara8075d72016-10-06 12:59:04 -0700567#define TYPE_C_CFG_3_REG (USBIN_BASE + 0x5A)
568#define TVBUS_DEBOUNCE_BIT BIT(7)
569#define TYPEC_LEGACY_CABLE_INT_EN_BIT BIT(6)
570#define TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN_BIT BIT(5)
571#define TYPEC_TRYSOURCE_DETECT_INT_EN_BIT BIT(4)
572#define TYPEC_TRYSINK_DETECT_INT_EN_BIT BIT(3)
573#define EN_TRYSINK_MODE_BIT BIT(2)
574#define EN_LEGACY_CABLE_DETECTION_BIT BIT(1)
575#define ALLOW_PD_DRING_UFP_TCCDB_BIT BIT(0)
576
Nicholas Troast34db5032016-03-28 12:26:44 -0700577#define USBIN_ADAPTER_ALLOW_CFG_REG (USBIN_BASE + 0x60)
578#define USBIN_ADAPTER_ALLOW_MASK GENMASK(3, 0)
579enum {
580 USBIN_ADAPTER_ALLOW_5V = 0,
581 USBIN_ADAPTER_ALLOW_9V = 2,
582 USBIN_ADAPTER_ALLOW_5V_OR_9V = 3,
583 USBIN_ADAPTER_ALLOW_12V = 4,
584 USBIN_ADAPTER_ALLOW_5V_OR_12V = 5,
585 USBIN_ADAPTER_ALLOW_9V_TO_12V = 6,
586 USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V = 7,
587 USBIN_ADAPTER_ALLOW_5V_TO_9V = 8,
588 USBIN_ADAPTER_ALLOW_5V_TO_12V = 12,
589};
590
591#define USBIN_OPTIONS_1_CFG_REG (USBIN_BASE + 0x62)
592#define CABLE_R_SEL_BIT BIT(7)
593#define HVDCP_AUTH_ALG_EN_CFG_BIT BIT(6)
594#define HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT BIT(5)
595#define INPUT_PRIORITY_BIT BIT(4)
596#define AUTO_SRC_DETECT_BIT BIT(3)
597#define HVDCP_EN_BIT BIT(2)
598#define VADP_INCREMENT_VOLTAGE_LIMIT_BIT BIT(1)
599#define VADP_TAPER_TIMER_EN_BIT BIT(0)
600
601#define USBIN_OPTIONS_2_CFG_REG (USBIN_BASE + 0x63)
602#define WIPWR_RST_EUD_CFG_BIT BIT(7)
603#define SWITCHER_START_CFG_BIT BIT(6)
604#define DCD_TIMEOUT_SEL_BIT BIT(5)
605#define OCD_CURRENT_SEL_BIT BIT(4)
606#define SLOW_PLUGIN_TIMER_EN_CFG_BIT BIT(3)
Nicholas Troast597acfe2016-07-20 16:03:15 -0700607#define FLOAT_OPTIONS_MASK GENMASK(2, 0)
Nicholas Troast34db5032016-03-28 12:26:44 -0700608#define FLOAT_DIS_CHGING_CFG_BIT BIT(2)
609#define SUSPEND_FLOAT_CFG_BIT BIT(1)
610#define FORCE_FLOAT_SDP_CFG_BIT BIT(0)
611
612#define TAPER_TIMER_SEL_CFG_REG (USBIN_BASE + 0x64)
Harry Yang88acff42016-09-21 14:56:06 -0700613#define TYPEC_SPARE_CFG_BIT BIT(7)
Nicholas Troast34db5032016-03-28 12:26:44 -0700614#define TAPER_TIMER_SEL_MASK GENMASK(1, 0)
615
616#define USBIN_LOAD_CFG_REG (USBIN_BASE + 0x65)
617#define USBIN_OV_CH_LOAD_OPTION_BIT BIT(7)
618
619#define USBIN_ICL_OPTIONS_REG (USBIN_BASE + 0x66)
620#define CFG_USB3P0_SEL_BIT BIT(2)
621#define USB51_MODE_BIT BIT(1)
622#define USBIN_MODE_CHG_BIT BIT(0)
623
624#define TYPE_C_INTRPT_ENB_REG (USBIN_BASE + 0x67)
625#define TYPEC_CCOUT_DETACH_INT_EN_BIT BIT(7)
626#define TYPEC_CCOUT_ATTACH_INT_EN_BIT BIT(6)
627#define TYPEC_VBUS_ERROR_INT_EN_BIT BIT(5)
628#define TYPEC_UFP_AUDIOADAPT_INT_EN_BIT BIT(4)
629#define TYPEC_DEBOUNCE_DONE_INT_EN_BIT BIT(3)
630#define TYPEC_CCSTATE_CHANGE_INT_EN_BIT BIT(2)
631#define TYPEC_VBUS_DEASSERT_INT_EN_BIT BIT(1)
632#define TYPEC_VBUS_ASSERT_INT_EN_BIT BIT(0)
633
634#define TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG (USBIN_BASE + 0x68)
Abhijeet Dharmapurikarf8a7a4a2016-10-07 18:46:45 -0700635#define EXIT_SNK_BASED_ON_CC_BIT BIT(7)
Harry Yang88acff42016-09-21 14:56:06 -0700636#define VCONN_EN_ORIENTATION_BIT BIT(6)
Nicholas Troast34db5032016-03-28 12:26:44 -0700637#define TYPEC_VCONN_OVERCURR_INT_EN_BIT BIT(5)
638#define VCONN_EN_SRC_BIT BIT(4)
639#define VCONN_EN_VALUE_BIT BIT(3)
640#define TYPEC_POWER_ROLE_CMD_MASK GENMASK(2, 0)
641#define UFP_EN_CMD_BIT BIT(2)
642#define DFP_EN_CMD_BIT BIT(1)
643#define TYPEC_DISABLE_CMD_BIT BIT(0)
644
645#define USBIN_SOURCE_CHANGE_INTRPT_ENB_REG (USBIN_BASE + 0x69)
646#define SLOW_IRQ_EN_CFG_BIT BIT(5)
647#define ENUMERATION_IRQ_EN_CFG_BIT BIT(4)
648#define VADP_IRQ_EN_CFG_BIT BIT(3)
649#define AUTH_IRQ_EN_CFG_BIT BIT(2)
650#define HVDCP_IRQ_EN_CFG_BIT BIT(1)
651#define APSD_IRQ_EN_CFG_BIT BIT(0)
652
653#define USBIN_CURRENT_LIMIT_CFG_REG (USBIN_BASE + 0x70)
654#define USBIN_CURRENT_LIMIT_MASK GENMASK(7, 0)
655
656#define USBIN_AICL_OPTIONS_CFG_REG (USBIN_BASE + 0x80)
657#define SUSPEND_ON_COLLAPSE_USBIN_BIT BIT(7)
658#define USBIN_AICL_HDC_EN_BIT BIT(6)
659#define USBIN_AICL_START_AT_MAX_BIT BIT(5)
660#define USBIN_AICL_RERUN_EN_BIT BIT(4)
661#define USBIN_AICL_ADC_EN_BIT BIT(3)
662#define USBIN_AICL_EN_BIT BIT(2)
663#define USBIN_HV_COLLAPSE_RESPONSE_BIT BIT(1)
664#define USBIN_LV_COLLAPSE_RESPONSE_BIT BIT(0)
665
666#define USBIN_5V_AICL_THRESHOLD_CFG_REG (USBIN_BASE + 0x81)
667#define USBIN_5V_AICL_THRESHOLD_CFG_MASK GENMASK(2, 0)
668
669#define USBIN_9V_AICL_THRESHOLD_CFG_REG (USBIN_BASE + 0x82)
670#define USBIN_9V_AICL_THRESHOLD_CFG_MASK GENMASK(2, 0)
671
672#define USBIN_12V_AICL_THRESHOLD_CFG_REG (USBIN_BASE + 0x83)
673#define USBIN_12V_AICL_THRESHOLD_CFG_MASK GENMASK(2, 0)
674
675#define USBIN_CONT_AICL_THRESHOLD_CFG_REG (USBIN_BASE + 0x84)
676#define USBIN_CONT_AICL_THRESHOLD_CFG_MASK GENMASK(5, 0)
677
678/* DCIN Peripheral Registers */
679#define DCIN_INPUT_STATUS_REG (DCIN_BASE + 0x06)
680#define DCIN_INPUT_STATUS_7_BIT BIT(7)
681#define DCIN_INPUT_STATUS_6_BIT BIT(6)
682#define DCIN_12V_BIT BIT(5)
683#define DCIN_9V_TO_12V_BIT BIT(4)
684#define DCIN_9V_BIT BIT(3)
685#define DCIN_5V_TO_12V_BIT BIT(2)
686#define DCIN_5V_TO_9V_BIT BIT(1)
687#define DCIN_5V_BIT BIT(0)
688
689#define WIPWR_STATUS_REG (DCIN_BASE + 0x07)
690#define WIPWR_STATUS_7_BIT BIT(7)
691#define WIPWR_STATUS_6_BIT BIT(6)
692#define WIPWR_STATUS_5_BIT BIT(5)
693#define DCIN_WIPWR_OV_DG_BIT BIT(4)
694#define DIV2_EN_DG_BIT BIT(3)
695#define SHUTDOWN_N_LATCH_BIT BIT(2)
696#define CHG_OK_PIN_BIT BIT(1)
697#define WIPWR_CHARGING_ENABLED_BIT BIT(0)
698
699#define WIPWR_RANGE_STATUS_REG (DCIN_BASE + 0x08)
700#define WIPWR_RANGE_STATUS_MASK GENMASK(4, 0)
701
Harry Yangf3023592016-07-20 14:56:41 -0700702#define DC_INT_RT_STS_REG (DCIN_BASE + 0x10)
703#define DCIN_PLUGIN_RT_STS_BIT BIT(4)
704
Nicholas Troast34db5032016-03-28 12:26:44 -0700705/* DCIN Interrupt Bits */
706#define WIPWR_VOLTAGE_RANGE_RT_STS_BIT BIT(7)
707#define DCIN_ICL_CHANGE_RT_STS_BIT BIT(6)
708#define DIV2_EN_DG_RT_STS_BIT BIT(5)
709#define DCIN_PLUGIN_RT_STS_BIT BIT(4)
710#define DCIN_OV_RT_STS_BIT BIT(3)
711#define DCIN_UV_RT_STS_BIT BIT(2)
712#define DCIN_LT_3P6V_RT_STS_BIT BIT(1)
713#define DCIN_COLLAPSE_RT_STS_BIT BIT(0)
714
715#define DCIN_CMD_IL_REG (DCIN_BASE + 0x40)
716#define WIRELESS_CHG_DIS_BIT BIT(3)
717#define SHDN_N_CLEAR_CMD_BIT BIT(2)
718#define SHDN_N_SET_CMD_BIT BIT(1)
719#define DCIN_SUSPEND_BIT BIT(0)
720
721#define DC_SPARE_REG (DCIN_BASE + 0x58)
722#define DC_SPARE_MASK GENMASK(3, 0)
723
724#define DCIN_ADAPTER_ALLOW_CFG_REG (DCIN_BASE + 0x60)
725#define DCIN_ADAPTER_ALLOW_MASK GENMASK(3, 0)
726
727#define DCIN_LOAD_CFG_REG (DCIN_BASE + 0x65)
728#define DCIN_OV_CH_LOAD_OPTION_BIT BIT(7)
729
730#define DCIN_CURRENT_LIMIT_CFG_REG (DCIN_BASE + 0x70)
731#define DCIN_CURRENT_LIMIT_MASK GENMASK(7, 0)
732
733#define DCIN_AICL_OPTIONS_CFG_REG (DCIN_BASE + 0x80)
734#define SUSPEND_ON_COLLAPSE_DCIN_BIT BIT(7)
735#define DCIN_AICL_HDC_EN_BIT BIT(6)
736#define DCIN_AICL_START_AT_MAX_BIT BIT(5)
737#define DCIN_AICL_RERUN_EN_BIT BIT(4)
738#define DCIN_AICL_ADC_EN_BIT BIT(3)
739#define DCIN_AICL_EN_BIT BIT(2)
740#define DCIN_HV_COLLAPSE_RESPONSE_BIT BIT(1)
741#define DCIN_LV_COLLAPSE_RESPONSE_BIT BIT(0)
742
743#define DCIN_AICL_REF_SEL_CFG_REG (DCIN_BASE + 0x81)
744#define DCIN_CONT_AICL_THRESHOLD_CFG_MASK GENMASK(5, 0)
745
746#define DCIN_ICL_START_CFG_REG (DCIN_BASE + 0x82)
747#define DCIN_ICL_START_CFG_BIT BIT(0)
748
749#define DIV2_EN_GF_TIME_CFG_REG (DCIN_BASE + 0x90)
750#define DIV2_EN_GF_TIME_CFG_MASK GENMASK(1, 0)
751
752#define WIPWR_IRQ_TMR_CFG_REG (DCIN_BASE + 0x91)
753#define WIPWR_IRQ_TMR_MASK GENMASK(2, 0)
754
755#define ZIN_ICL_PT_REG (DCIN_BASE + 0x92)
756#define ZIN_ICL_PT_MASK GENMASK(7, 0)
757
758#define ZIN_ICL_LV_REG (DCIN_BASE + 0x93)
759#define ZIN_ICL_LV_MASK GENMASK(7, 0)
760
761#define ZIN_ICL_HV_REG (DCIN_BASE + 0x94)
762#define ZIN_ICL_HV_MASK GENMASK(7, 0)
763
764#define WI_PWR_OPTIONS_REG (DCIN_BASE + 0x95)
765#define CHG_OK_BIT BIT(7)
766#define WIPWR_UVLO_IRQ_OPT_BIT BIT(6)
767#define BUCK_HOLDOFF_ENABLE_BIT BIT(5)
768#define CHG_OK_HW_SW_SELECT_BIT BIT(4)
769#define WIPWR_RST_ENABLE_BIT BIT(3)
770#define DCIN_WIPWR_IRQ_SELECT_BIT BIT(2)
771#define AICL_SWITCH_ENABLE_BIT BIT(1)
772#define ZIN_ICL_ENABLE_BIT BIT(0)
773
774#define ZIN_ICL_PT_HV_REG (DCIN_BASE + 0x96)
775#define ZIN_ICL_PT_HV_MASK GENMASK(7, 0)
776
777#define ZIN_ICL_MID_LV_REG (DCIN_BASE + 0x97)
778#define ZIN_ICL_MID_LV_MASK GENMASK(7, 0)
779
780#define ZIN_ICL_MID_HV_REG (DCIN_BASE + 0x98)
781#define ZIN_ICL_MID_HV_MASK GENMASK(7, 0)
782
Abhijeet Dharmapurikar5cf5faf2016-06-21 14:20:24 -0700783enum {
784 ZIN_ICL_PT_MAX_MV = 8000,
785 ZIN_ICL_PT_HV_MAX_MV = 9000,
786 ZIN_ICL_LV_MAX_MV = 5500,
787 ZIN_ICL_MID_LV_MAX_MV = 6500,
788 ZIN_ICL_MID_HV_MAX_MV = 8000,
789 ZIN_ICL_HV_MAX_MV = 11000,
790};
791
Harry Yang360bd532016-09-26 11:03:22 -0700792#define DC_ENG_SSUPPLY_CFG3_REG (DCIN_BASE + 0xC2)
793#define ENG_SSUPPLY_HI_CAP_BIT BIT(6)
794#define ENG_SSUPPLY_HI_RES_BIT BIT(5)
795#define ENG_SSUPPLY_CFG_SKIP_TH_V0P2_BIT BIT(3)
796#define ENG_SSUPPLY_CFG_SYSOV_TH_4P8_BIT BIT(2)
797#define ENG_SSUPPLY_5V_OV_OPT_BIT BIT(0)
798
Nicholas Troast34db5032016-03-28 12:26:44 -0700799/* MISC Peripheral Registers */
800#define REVISION1_REG (MISC_BASE + 0x00)
801#define DIG_MINOR_MASK GENMASK(7, 0)
802
803#define REVISION2_REG (MISC_BASE + 0x01)
804#define DIG_MAJOR_MASK GENMASK(7, 0)
805
806#define REVISION3_REG (MISC_BASE + 0x02)
807#define ANA_MINOR_MASK GENMASK(7, 0)
808
809#define REVISION4_REG (MISC_BASE + 0x03)
810#define ANA_MAJOR_MASK GENMASK(7, 0)
811
812#define TEMP_RANGE_STATUS_REG (MISC_BASE + 0x06)
813#define TEMP_RANGE_STATUS_7_BIT BIT(7)
814#define THERM_REG_ACTIVE_BIT BIT(6)
815#define TLIM_BIT BIT(5)
816#define ALERT_LEVEL_BIT BIT(4)
817#define TEMP_ABOVE_RANGE_BIT BIT(3)
818#define TEMP_WITHIN_RANGE_BIT BIT(2)
819#define TEMP_BELOW_RANGE_BIT BIT(1)
820#define THERMREG_DISABLED_BIT BIT(0)
821
822#define ICL_STATUS_REG (MISC_BASE + 0x07)
823#define INPUT_CURRENT_LIMIT_MASK GENMASK(7, 0)
824
825#define ADAPTER_5V_ICL_STATUS_REG (MISC_BASE + 0x08)
826#define ADAPTER_5V_ICL_MASK GENMASK(7, 0)
827
828#define ADAPTER_9V_ICL_STATUS_REG (MISC_BASE + 0x09)
829#define ADAPTER_9V_ICL_MASK GENMASK(7, 0)
830
831#define AICL_STATUS_REG (MISC_BASE + 0x0A)
832#define AICL_STATUS_7_BIT BIT(7)
833#define SOFT_ILIMIT_BIT BIT(6)
834#define HIGHEST_DC_BIT BIT(5)
835#define USBIN_CH_COLLAPSE_BIT BIT(4)
836#define DCIN_CH_COLLAPSE_BIT BIT(3)
837#define ICL_IMIN_BIT BIT(2)
838#define AICL_FAIL_BIT BIT(1)
839#define AICL_DONE_BIT BIT(0)
840
841#define POWER_PATH_STATUS_REG (MISC_BASE + 0x0B)
842#define INPUT_SS_DONE_BIT BIT(7)
843#define USBIN_SUSPEND_STS_BIT BIT(6)
844#define DCIN_SUSPEND_STS_BIT BIT(5)
845#define USE_USBIN_BIT BIT(4)
846#define USE_DCIN_BIT BIT(3)
847#define POWER_PATH_MASK GENMASK(2, 1)
848#define VALID_INPUT_POWER_SOURCE_STS_BIT BIT(0)
849
850#define WDOG_STATUS_REG (MISC_BASE + 0x0C)
851#define WDOG_STATUS_7_BIT BIT(7)
852#define WDOG_STATUS_6_BIT BIT(6)
853#define WDOG_STATUS_5_BIT BIT(5)
854#define WDOG_STATUS_4_BIT BIT(4)
855#define WDOG_STATUS_3_BIT BIT(3)
856#define WDOG_STATUS_2_BIT BIT(2)
857#define WDOG_STATUS_1_BIT BIT(1)
858#define BARK_BITE_STATUS_BIT BIT(0)
859
860/* MISC Interrupt Bits */
861#define SWITCHER_POWER_OK_RT_STS_BIT BIT(7)
862#define TEMPERATURE_CHANGE_RT_STS_BIT BIT(6)
863#define INPUT_CURRENT_LIMITING_RT_STS_BIT BIT(5)
864#define HIGH_DUTY_CYCLE_RT_STS_BIT BIT(4)
865#define AICL_DONE_RT_STS_BIT BIT(3)
866#define AICL_FAIL_RT_STS_BIT BIT(2)
867#define WDOG_BARK_RT_STS_BIT BIT(1)
868#define WDOG_SNARL_RT_STS_BIT BIT(0)
869
870#define WDOG_RST_REG (MISC_BASE + 0x40)
871#define WDOG_RST_BIT BIT(0)
872
873#define AFP_MODE_REG (MISC_BASE + 0x41)
874#define AFP_MODE_EN_BIT BIT(0)
875
876#define GSM_PA_ON_ADJ_EN_REG (MISC_BASE + 0x42)
877#define GSM_PA_ON_ADJ_EN_BIT BIT(0)
878
879#define BARK_BITE_WDOG_PET_REG (MISC_BASE + 0x43)
880#define BARK_BITE_WDOG_PET_BIT BIT(0)
881
882#define PHYON_CMD_REG (MISC_BASE + 0x44)
883#define PHYON_CMD_BIT BIT(0)
884
885#define SHDN_CMD_REG (MISC_BASE + 0x45)
886#define SHDN_CMD_BIT BIT(0)
887
888#define FINISH_COPY_COMMAND_REG (MISC_BASE + 0x4F)
889#define START_COPY_BIT BIT(0)
890
891#define WD_CFG_REG (MISC_BASE + 0x51)
892#define WATCHDOG_TRIGGER_AFP_EN_BIT BIT(7)
893#define BARK_WDOG_INT_EN_BIT BIT(6)
894#define BITE_WDOG_INT_EN_BIT BIT(5)
895#define SFT_AFTER_WDOG_IRQ_MASK GENMASK(4, 3)
896#define WDOG_IRQ_SFT_BIT BIT(2)
897#define WDOG_OPTION_BIT BIT(1)
898#define WDOG_TIMER_EN_BIT BIT(0)
899
900#define MISC_CFG_REG (MISC_BASE + 0x52)
901#define GSM_PA_ON_ADJ_SEL_BIT BIT(0)
902
903#define SNARL_BARK_BITE_WD_CFG_REG (MISC_BASE + 0x53)
904#define BITE_WDOG_DISABLE_CHARGING_CFG_BIT BIT(7)
905#define SNARL_WDOG_TIMEOUT_MASK GENMASK(6, 4)
906#define BARK_WDOG_TIMEOUT_MASK GENMASK(3, 2)
907#define BITE_WDOG_TIMEOUT_MASK GENMASK(1, 0)
908
909#define PHYON_CFG_REG (MISC_BASE + 0x54)
910#define USBPHYON_PUSHPULL_CFG_BIT BIT(1)
911#define PHYON_SW_SEL_BIT BIT(0)
912
913#define CHGR_TRIM_OPTIONS_7_0_REG (MISC_BASE + 0x55)
914#define TLIM_DIS_TBIT_BIT BIT(0)
915
916#define CH_OV_OPTION_CFG_REG (MISC_BASE + 0x56)
917#define OV_OPTION_TBIT_BIT BIT(0)
918
919#define AICL_CFG_REG (MISC_BASE + 0x60)
920#define TREG_ALLOW_DECREASE_BIT BIT(1)
921#define AICL_HIGH_DC_INC_BIT BIT(0)
922
923#define AICL_RERUN_TIME_CFG_REG (MISC_BASE + 0x61)
924#define AICL_RERUN_TIME_MASK GENMASK(1, 0)
925
926#define AICL_RERUN_TEMP_TIME_CFG_REG (MISC_BASE + 0x62)
927#define AICL_RERUN_TEMP_TIME_MASK GENMASK(1, 0)
928
929#define THERMREG_SRC_CFG_REG (MISC_BASE + 0x70)
930#define SKIN_ADC_CFG_BIT BIT(3)
931#define THERMREG_SKIN_ADC_SRC_EN_BIT BIT(2)
932#define THERMREG_DIE_ADC_SRC_EN_BIT BIT(1)
933#define THERMREG_DIE_CMP_SRC_EN_BIT BIT(0)
934
935#define TREG_DIE_CMP_INC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x71)
936#define TREG_DIE_CMP_INC_CYCLE_TIME_MASK GENMASK(1, 0)
937
938#define TREG_DIE_CMP_DEC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x72)
939#define TREG_DIE_CMP_DEC_CYCLE_TIME_MASK GENMASK(1, 0)
940
941#define TREG_DIE_ADC_INC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x73)
942#define TREG_DIE_ADC_INC_CYCLE_TIME_MASK GENMASK(1, 0)
943
944#define TREG_DIE_ADC_DEC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x74)
945#define TREG_DIE_ADC_DEC_CYCLE_TIME_MASK GENMASK(1, 0)
946
947#define TREG_SKIN_ADC_INC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x75)
948#define TREG_SKIN_ADC_INC_CYCLE_TIME_MASK GENMASK(1, 0)
949
950#define TREG_SKIN_ADC_DEC_CYCLE_TIME_CFG_REG (MISC_BASE + 0x76)
951#define TREG_SKIN_ADC_DEC_CYCLE_TIME_MASK GENMASK(1, 0)
952
953#define BUCK_OPTIONS_CFG_REG (MISC_BASE + 0x80)
954#define CHG_EN_PIN_SUSPEND_CFG_BIT BIT(6)
955#define HICCUP_OPTIONS_MASK GENMASK(5, 4)
956#define INPUT_CURRENT_LIMIT_SOFTSTART_EN_BIT BIT(3)
957#define HV_HIGH_DUTY_CYCLE_PROTECT_EN_BIT BIT(2)
958#define BUCK_OC_PROTECT_EN_BIT BIT(1)
959#define INPUT_MISS_POLL_EN_BIT BIT(0)
960
961#define ICL_SOFTSTART_RATE_CFG_REG (MISC_BASE + 0x81)
962#define ICL_SOFTSTART_RATE_MASK GENMASK(1, 0)
963
964#define ICL_SOFTSTOP_RATE_CFG_REG (MISC_BASE + 0x82)
965#define ICL_SOFTSTOP_RATE_MASK GENMASK(1, 0)
966
967#define VSYS_MIN_SEL_CFG_REG (MISC_BASE + 0x83)
968#define VSYS_MIN_SEL_MASK GENMASK(1, 0)
969
970#define TRACKING_VOLTAGE_SEL_CFG_REG (MISC_BASE + 0x84)
971#define TRACKING_VOLTAGE_SEL_BIT BIT(0)
972
973#define STAT_CFG_REG (MISC_BASE + 0x90)
974#define STAT_SW_OVERRIDE_VALUE_BIT BIT(7)
975#define STAT_SW_OVERRIDE_CFG_BIT BIT(6)
976#define STAT_PARALLEL_OFF_DG_CFG_MASK GENMASK(5, 4)
977#define STAT_POLARITY_CFG_BIT BIT(3)
978#define STAT_PARALLEL_CFG_BIT BIT(2)
979#define STAT_FUNCTION_CFG_BIT BIT(1)
980#define STAT_IRQ_PULSING_EN_BIT BIT(0)
981
982#define LBC_EN_CFG_REG (MISC_BASE + 0x91)
983#define LBC_DURING_CHARGING_CFG_BIT BIT(1)
984#define LBC_EN_BIT BIT(0)
985
986#define LBC_PERIOD_CFG_REG (MISC_BASE + 0x92)
987#define LBC_PERIOD_MASK GENMASK(2, 0)
988
989#define LBC_DUTY_CYCLE_CFG_REG (MISC_BASE + 0x93)
990#define LBC_DUTY_CYCLE_MASK GENMASK(2, 0)
991
992#define SYSOK_CFG_REG (MISC_BASE + 0x94)
993#define SYSOK_PUSHPULL_CFG_BIT BIT(5)
994#define SYSOK_B_OR_C_SEL_BIT BIT(4)
995#define SYSOK_POL_BIT BIT(3)
996#define SYSOK_OPTIONS_MASK GENMASK(2, 0)
997
998#endif /* __SMB2_CHARGER_REG_H */