summaryrefslogtreecommitdiff
path: root/drivers/usb/musb-new
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2016-09-07 06:25:21 (GMT)
committerHans de Goede <hdegoede@redhat.com>2016-09-17 12:37:40 (GMT)
commit57075a472a5c2b9a7c498a9dc2f2cfcc1e898ec2 (patch)
treef917bb4118112422e50f699a5ff121e612c39881 /drivers/usb/musb-new
parent253e62bf4b118d38a9e4a396b68fac61dcae7bbc (diff)
downloadu-boot-fsl-qoriq-57075a472a5c2b9a7c498a9dc2f2cfcc1e898ec2.tar.xz
sunxi: musb: Power off OTG port VBUS when disabled
The Linux kernel musb driver expects VBUS to be off while initializing musb. Having it on results in a repeating string of warnings, followed by an unusable peripheral. The peripheral is only usable after physically removing the OTG adapter, letting musb reset its state. This partially reverts commit c9f8947e6604 ("sunxi: usb-phy: Never power off the usb ports") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/usb/musb-new')
-rw-r--r--drivers/usb/musb-new/sunxi.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index c016a0b..dece781 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -205,6 +205,8 @@ static struct musb *sunxi_musb;
static int sunxi_musb_enable(struct musb *musb)
{
+ int ret;
+
pr_debug("%s():\n", __func__);
musb_ep_select(musb->mregs, 0);
@@ -217,26 +219,17 @@ static int sunxi_musb_enable(struct musb *musb)
musb_writeb(musb->mregs, USBC_REG_o_VEND0, 0);
if (is_host_enabled(musb)) {
- int id = sunxi_usb_phy_id_detect(0);
-
- if (id == 1 && sunxi_usb_phy_power_is_on(0))
- sunxi_usb_phy_power_off(0);
-
- if (!sunxi_usb_phy_power_is_on(0)) {
- int vbus = sunxi_usb_phy_vbus_detect(0);
- if (vbus == 1) {
- printf("A charger is plugged into the OTG: ");
- return -ENODEV;
- }
+ ret = sunxi_usb_phy_vbus_detect(0);
+ if (ret == 1) {
+ printf("A charger is plugged into the OTG: ");
+ return -ENODEV;
}
-
- if (id == 1) {
+ ret = sunxi_usb_phy_id_detect(0);
+ if (ret == 1) {
printf("No host cable detected: ");
return -ENODEV;
}
-
- if (!sunxi_usb_phy_power_is_on(0))
- sunxi_usb_phy_power_on(0);
+ sunxi_usb_phy_power_on(0); /* port power on */
}
USBC_ForceVbusValidToHigh(musb->mregs);
@@ -252,6 +245,9 @@ static void sunxi_musb_disable(struct musb *musb)
if (!enabled)
return;
+ if (is_host_enabled(musb))
+ sunxi_usb_phy_power_off(0); /* port power off */
+
USBC_ForceVbusValidToLow(musb->mregs);
mdelay(200); /* Wait for the current session to timeout */