diff mbox series

[V5] roles: Fix USB 3.0 OTG issue on Intel platform

Message ID 1536300918-16173-1-git-send-email-saranya.gopal@intel.com (mailing list archive)
State New, archived
Headers show
Series [V5] roles: Fix USB 3.0 OTG issue on Intel platform | expand

Commit Message

Saranya Gopal Sept. 7, 2018, 6:15 a.m. UTC
From: saranya <saranya.gopal@intel.com>

This patch adds static DRD mode for host/device
mode switch. This fixes the issue where device
mode was not working after DUT switches to host
mode with 3.0 OTG connector.

Signed-off-by: saranya <saranya.gopal@intel.com>
Signed-off-by: M Balaji <m.balaji@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 changes since v4: Removed change-Id
 changes since V3: Added Reviewed-by Sathyanarayanan tag
 changes since V2: Incorporated Heikki's review comments and added Reviewed-by Heikki tag
 changes since V1: none

 drivers/usb/roles/intel-xhci-usb-role-switch.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Greg KH Sept. 7, 2018, 6:55 a.m. UTC | #1
On Fri, Sep 07, 2018 at 11:45:18AM +0530, saranya.gopal@intel.com wrote:
> From: saranya <saranya.gopal@intel.com>

That's not right :(

> 
> This patch adds static DRD mode for host/device
> mode switch. This fixes the issue where device
> mode was not working after DUT switches to host
> mode with 3.0 OTG connector.
> 
> Signed-off-by: saranya <saranya.gopal@intel.com>

Neither is that :(

Why change lines that were correct last time around?

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c
index dad2d19..0d1ea82 100644
--- a/drivers/usb/roles/intel-xhci-usb-role-switch.c
+++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c
@@ -25,6 +25,9 @@ 
 #define SW_VBUS_VALID			BIT(24)
 #define SW_IDPIN_EN			BIT(21)
 #define SW_IDPIN			BIT(20)
+#define SW_SWITCH_EN_CFG0		BIT(16)
+#define SW_DRD_STATIC_HOST_CFG0		1
+#define SW_DRD_STATIC_DEV_CFG0		2
 
 #define DUAL_ROLE_CFG1			0x6c
 #define HOST_MODE			BIT(29)
@@ -83,17 +86,22 @@  static int intel_xhci_usb_set_role(struct device *dev, enum usb_role role)
 	case USB_ROLE_NONE:
 		val |= SW_IDPIN;
 		val &= ~SW_VBUS_VALID;
+		val &= ~(SW_DRD_STATIC_DEV_CFG0 | SW_DRD_STATIC_HOST_CFG0);
 		break;
 	case USB_ROLE_HOST:
 		val &= ~SW_IDPIN;
 		val &= ~SW_VBUS_VALID;
+		val &= ~SW_DRD_STATIC_DEV_CFG0;
+		val |= SW_DRD_STATIC_HOST_CFG0;
 		break;
 	case USB_ROLE_DEVICE:
 		val |= SW_IDPIN;
 		val |= SW_VBUS_VALID;
+		val &= ~SW_DRD_STATIC_HOST_CFG0;
+		val |= SW_DRD_STATIC_DEV_CFG0;
 		break;
 	}
-	val |= SW_IDPIN_EN;
+	val |= SW_IDPIN_EN | SW_SWITCH_EN_CFG0;
 
 	writel(val, data->base + DUAL_ROLE_CFG0);