summaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-ab8500-usb.c
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2013-05-15 14:03:27 +0200
committerFelipe Balbi <balbi@ti.com>2013-05-28 20:01:01 +0300
commitfb21f37a5249374ed63f763455a0b07b80c1e50c (patch)
treea4a4339cd9cba88cd7521ac3a3a979fd1007e744 /drivers/usb/phy/phy-ab8500-usb.c
parentd0ed0645a5cfb0cccca6baa84b459eb2078e7fb1 (diff)
downloadlinux-fb21f37a5249374ed63f763455a0b07b80c1e50c.tar.gz
linux-fb21f37a5249374ed63f763455a0b07b80c1e50c.tar.bz2
linux-fb21f37a5249374ed63f763455a0b07b80c1e50c.zip
usb: phy: ab8500-usb: restart phy during probe
Add an ab8500_usb_restart_phy() function called during probe to ensure that the AB8500 USB phy is initialized properly even when a cable is connected at probe time. Without this fix subsequent host reconnections are not detected properly. Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy/phy-ab8500-usb.c')
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index bdf7f570b5e4..63bb7cc14a2a 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -668,6 +668,33 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
return 0;
}
+static void ab8500_usb_restart_phy(struct ab8500_usb *ab)
+{
+ abx500_mask_and_set_register_interruptible(ab->dev,
+ AB8500_USB, AB8500_USB_PHY_CTRL_REG,
+ AB8500_BIT_PHY_CTRL_DEVICE_EN,
+ AB8500_BIT_PHY_CTRL_DEVICE_EN);
+
+ udelay(100);
+
+ abx500_mask_and_set_register_interruptible(ab->dev,
+ AB8500_USB, AB8500_USB_PHY_CTRL_REG,
+ AB8500_BIT_PHY_CTRL_DEVICE_EN,
+ 0);
+
+ abx500_mask_and_set_register_interruptible(ab->dev,
+ AB8500_USB, AB8500_USB_PHY_CTRL_REG,
+ AB8500_BIT_PHY_CTRL_HOST_EN,
+ AB8500_BIT_PHY_CTRL_HOST_EN);
+
+ udelay(100);
+
+ abx500_mask_and_set_register_interruptible(ab->dev,
+ AB8500_USB, AB8500_USB_PHY_CTRL_REG,
+ AB8500_BIT_PHY_CTRL_HOST_EN,
+ 0);
+}
+
static int ab8500_usb_regulator_get(struct ab8500_usb *ab)
{
int err;
@@ -887,6 +914,12 @@ static int ab8500_usb_probe(struct platform_device *pdev)
/* Needed to enable ID detection. */
ab8500_usb_wd_workaround(ab);
+ /*
+ * This is required for usb-link-status to work properly when a
+ * cable is connected at boot time.
+ */
+ ab8500_usb_restart_phy(ab);
+
abx500_usb_link_status_update(ab);
dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);