xref: /openbmc/u-boot/include/twl6030.h (revision 62a05573)
1 /*
2  * (C) Copyright 2010
3  * Texas Instruments, <www.ti.com>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 
24 #include <common.h>
25 #include <i2c.h>
26 
27 /* I2C chip addresses */
28 #define TWL6030_CHIP_PM		0x48
29 
30 #define TWL6030_CHIP_USB	0x49
31 #define TWL6030_CHIP_ADC	0x49
32 #define TWL6030_CHIP_CHARGER	0x49
33 #define TWL6030_CHIP_PWM	0x49
34 
35 /* Battery CHARGER REGISTERS */
36 #define CONTROLLER_INT_MASK	0xE0
37 #define CONTROLLER_CTRL1	0xE1
38 #define CONTROLLER_WDG		0xE2
39 #define CONTROLLER_STAT1	0xE3
40 #define CHARGERUSB_INT_STATUS	0xE4
41 #define CHARGERUSB_INT_MASK	0xE5
42 #define CHARGERUSB_STATUS_INT1	0xE6
43 #define CHARGERUSB_STATUS_INT2	0xE7
44 #define CHARGERUSB_CTRL1	0xE8
45 #define CHARGERUSB_CTRL2	0xE9
46 #define CHARGERUSB_CTRL3	0xEA
47 #define CHARGERUSB_STAT1	0xEB
48 #define CHARGERUSB_VOREG	0xEC
49 #define CHARGERUSB_VICHRG	0xED
50 #define CHARGERUSB_CINLIMIT	0xEE
51 #define CHARGERUSB_CTRLLIMIT1	0xEF
52 
53 /* CHARGERUSB_VICHRG */
54 #define CHARGERUSB_VICHRG_500		0x4
55 #define CHARGERUSB_VICHRG_1500		0xE
56 /* CHARGERUSB_CINLIMIT */
57 #define CHARGERUSB_CIN_LIMIT_100	0x1
58 #define CHARGERUSB_CIN_LIMIT_300	0x5
59 #define CHARGERUSB_CIN_LIMIT_500	0x9
60 #define CHARGERUSB_CIN_LIMIT_NONE	0xF
61 /* CONTROLLER_INT_MASK */
62 #define MVAC_FAULT		(1 << 6)
63 #define MAC_EOC			(1 << 5)
64 #define MBAT_REMOVED		(1 << 4)
65 #define MFAULT_WDG		(1 << 3)
66 #define MBAT_TEMP		(1 << 2)
67 #define MVBUS_DET		(1 << 1)
68 #define MVAC_DET		(1 << 0)
69 /* CHARGERUSB_INT_MASK */
70 #define MASK_MCURRENT_TERM		(1 << 3)
71 #define MASK_MCHARGERUSB_STAT		(1 << 2)
72 #define MASK_MCHARGERUSB_THMREG		(1 << 1)
73 #define MASK_MCHARGERUSB_FAULT		(1 << 0)
74 /* CHARGERUSB_VOREG */
75 #define CHARGERUSB_VOREG_3P52		0x01
76 #define CHARGERUSB_VOREG_4P0		0x19
77 #define CHARGERUSB_VOREG_4P2		0x23
78 #define CHARGERUSB_VOREG_4P76		0x3F
79 /* CHARGERUSB_CTRL2 */
80 #define CHARGERUSB_CTRL2_VITERM_50	(0 << 5)
81 #define CHARGERUSB_CTRL2_VITERM_100	(1 << 5)
82 #define CHARGERUSB_CTRL2_VITERM_150	(2 << 5)
83 /* CONTROLLER_CTRL1 */
84 #define CONTROLLER_CTRL1_EN_CHARGER	(1 << 4)
85 #define CONTROLLER_CTRL1_SEL_CHARGER	(1 << 3)
86 
87 #define VUSB_CFG_STATE		0xA2
88 #define MISC2			0xE5
89 
90 void twl6030_init_battery_charging(void);
91 void twl6030_usb_device_settings(void);
92