aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-am335x-control.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/phy/phy-am335x-control.c')
-rw-r--r--drivers/usb/phy/phy-am335x-control.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c
index 7b3035ff9434..42a1afe36a90 100644
--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -4,7 +4,8 @@
#include <linux/of.h>
#include <linux/io.h>
#include <linux/delay.h>
-#include "am35x-phy-control.h"
+#include <linux/usb/otg.h>
+#include "phy-am335x-control.h"
struct am335x_control_usb {
struct device *dev;
@@ -58,7 +59,8 @@ static void am335x_phy_wkup(struct phy_control *phy_ctrl, u32 id, bool on)
spin_unlock(&usb_ctrl->lock);
}
-static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on)
+static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id,
+ enum usb_dr_mode dr_mode, bool on)
{
struct am335x_control_usb *usb_ctrl;
u32 val;
@@ -80,8 +82,14 @@ static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on)
val = readl(usb_ctrl->phy_reg + reg);
if (on) {
- val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
- val |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+ if (dr_mode == USB_DR_MODE_HOST) {
+ val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN |
+ USBPHY_OTGVDET_EN);
+ val |= USBPHY_OTGSESSEND_EN;
+ } else {
+ val &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+ val |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+ }
} else {
val |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}