diff options
author | Mike J. Chen <mjchen@google.com> | 2012-03-01 09:20:19 -0800 |
---|---|---|
committer | Mike J. Chen <mjchen@google.com> | 2012-03-03 17:29:38 -0800 |
commit | 4e954a81f4e30c1fc496bd57b49ad14d2206532c (patch) | |
tree | ef61ef190a0cc412b0fe0d103d69cdeea3127243 | |
parent | 1815698e6b1f05f204a49aec6679d23054a53887 (diff) | |
download | uboot-4e954a81f4e30c1fc496bd57b49ad14d2206532c.tar.gz |
ARMV7: OMAP4: USB: Configure the twl603x LDO and USB
Configure the LDO and other USB attributes for USB.
Failed case was that USB was not detected if the unit was powered
up without a usb cable attached. When the USB cable was attached
the device would not enumerate.
Patch originally from Dan Murphy with some modifications
(cleanup ordering of #defines, add i2c_set_bus_num()
in twl6030_usb_device_settings() in case other i2c bus
had been used earlier).
Change-Id: I15b578739ce506219c55b7ba8e4cb5525196aa86
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Mike J. Chen <mjchen@google.com>
-rw-r--r-- | drivers/power/twl6030.c | 21 | ||||
-rw-r--r-- | include/twl6030.h | 12 |
2 files changed, 27 insertions, 6 deletions
diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c index fef57b433..164a4455e 100644 --- a/drivers/power/twl6030.c +++ b/drivers/power/twl6030.c @@ -184,15 +184,24 @@ void twl6030_init_battery_charging(void) void twl6030_usb_device_settings() { - u8 data = 0; + i2c_set_bus_num(0); /* Select APP Group and set state to ON */ - twl6030_i2c_write_u8(TWL6030_CHIP_PM, 0x21, VUSB_CFG_STATE); + twl6030_i2c_write_u8(TWL6030_CHIP_PM, + (VUSB_CFG_STATE_GRP_APP | VUSB_CFG_STATE0), + VUSB_CFG_STATE); - twl6030_i2c_read_u8(TWL6030_CHIP_PM, &data, MISC2); - data |= 0x10; + /* Set to OTG_REV 1.3 and turn on the ID_WAKEUP_COMP */ + twl6030_i2c_write_u8(TWL6030_CHIP_PM, BACKUP_REG_WKUP_COMP, BACKUP_REG); - /* Select the input supply for VBUS regulator */ - twl6030_i2c_write_u8(TWL6030_CHIP_PM, data, MISC2); + /* Program CFG_LDO_PD2 register and set VUSB bit */ + twl6030_i2c_write_u8(TWL6030_CHIP_PM, CFG_LDO_VUSB, CFG_LDO_PD2); + + /* Program MISC2 register and set bit VUSB_IN_VBAT */ + twl6030_i2c_write_u8(TWL6030_CHIP_PM, MISC2_VUSB_IN_VBAT, MISC2); + + /* Program the USB_VBUS_CTRL_SET and set VBUS_ACT_COMP bit */ + twl6030_i2c_write_u8(TWL6030_CHIP_USB, USB_VBUS_CTRL_IADP_SINK, + USB_VBUS_CTRL_SET); } #endif diff --git a/include/twl6030.h b/include/twl6030.h index 6ed68a0e1..4a5d17b41 100644 --- a/include/twl6030.h +++ b/include/twl6030.h @@ -34,6 +34,8 @@ /* Slave Address 0x48 */ #define VUSB_CFG_STATE 0xA2 +#define VUSB_CFG_STATE0 (1 << 0) +#define VUSB_CFG_STATE_GRP_APP (1 << 5) #define MISC1 0xE4 #define VAC_MEAS (1 << 2) @@ -41,6 +43,16 @@ #define BB_MEAS (1 << 0) #define MISC2 0xE5 +#define MISC2_VUSB_IN_VBAT (1 << 4) + +#define CFG_LDO_PD2 0xF5 +#define CFG_LDO_VUSB (1 << 0) + +#define BACKUP_REG 0xFA +#define BACKUP_REG_WKUP_COMP (1 << 0) + +#define USB_VBUS_CTRL_SET 0x04 +#define USB_VBUS_CTRL_IADP_SINK (1 << 3) /* Slave Address 0x49 */ |