aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@google.com>2012-03-26 15:35:28 -0700
committerMike J. Chen <mjchen@google.com>2012-03-26 15:35:28 -0700
commit10e01499cf44ac7291e89719f4cb11a94f944696 (patch)
tree55313bf40da7c266e6b06d30b194e12dd79842a3
parentfc7400093da994e9855cc045f9f8e226f4817e85 (diff)
downloaduboot-10e01499cf44ac7291e89719f4cb11a94f944696.tar.gz
TWL4030: Force power down before powering up the PHY
To address issues with USB not enumerating properly when the cable is connected on a warm reboot, make sure the PHY is powered down before powering it up. This results in proper enumeration on a warm reboot. Change-Id: If52df6386ec7c8bd3c6715b96644e1dad752b9a7
-rw-r--r--drivers/usb/phy/twl4030.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/phy/twl4030.c b/drivers/usb/phy/twl4030.c
index 54d2e615c..6dcf6c92e 100644
--- a/drivers/usb/phy/twl4030.c
+++ b/drivers/usb/phy/twl4030.c
@@ -118,10 +118,22 @@ static void twl4030_phy_power(void)
{
u8 pwr, clk;
- /* Power the PHY */
+ /* First make sure PHY is powered down to
+ * clear any state from a previous reboot and
+ * force unenumeration. Otherwise, sometimes
+ * the device doesn't enumerate properly on
+ * a warm reboot.
+ */
+
+ /* Power down the PHY */
pwr = twl4030_usb_read(TWL4030_USB_PHY_PWR_CTRL);
+ pwr |= PHYPWD;
+ twl4030_usb_write(TWL4030_USB_PHY_PWR_CTRL, pwr);
+
+ /* Power the PHY */
pwr &= ~PHYPWD;
twl4030_usb_write(TWL4030_USB_PHY_PWR_CTRL, pwr);
+
/* Enable clocks */
clk = twl4030_usb_read(TWL4030_USB_PHY_CLK_CTRL);
clk |= CLOCKGATING_EN | CLK32K_EN;
@@ -139,6 +151,8 @@ int twl4030_usb_ulpi_init(void)
long timeout = 1000 * 1000; /* 1 sec */;
u8 clk, sts, pwr;
+ i2c_set_bus_num(0);
+
/* twl4030 ldo init */
twl4030_usb_ldo_init();