diff mbox

[v7,4/5] usb: dwc3: omap: Pass VBUS and ID events transparently

Message ID 1462873919-20532-5-git-send-email-rogerq@ti.com
State Superseded
Headers show

Commit Message

Roger Quadros May 10, 2016, 9:51 a.m. UTC
Don't make any decisions regarding VBUS session based on ID
status. That is best left to the OTG core.

Pass ID and VBUS events independent of each other so that OTG
core knows exactly what to do.

This makes dual-role with extcon work with OTG irq on OMAP platforms.

Signed-off-by: Roger Quadros <rogerq@ti.com>

---
 drivers/usb/dwc3/dwc3-omap.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

-- 
2.7.4

Comments

Roger Quadros May 10, 2016, 10 a.m. UTC | #1
On 10/05/16 12:55, Felipe Balbi wrote:
> 

> Hi,

> 

> Roger Quadros <rogerq@ti.com> writes:

>> Don't make any decisions regarding VBUS session based on ID

>> status. That is best left to the OTG core.

>>

>> Pass ID and VBUS events independent of each other so that OTG

>> core knows exactly what to do.

>>

>> This makes dual-role with extcon work with OTG irq on OMAP platforms.

>>

>> Signed-off-by: Roger Quadros <rogerq@ti.com>

> 

> I have a feeling this will regress OMAP5432 uEVM. Did you test with that

> board ?

> 


Yes. Any specific test case you would like me to test?
For now I'm just doing enumeration with g_zero.

cheers,
-roger
Roger Quadros May 10, 2016, 10:13 a.m. UTC | #2
On 10/05/16 13:05, Felipe Balbi wrote:
> 

> Hi,

> 

> Roger Quadros <rogerq@ti.com> writes:

>> On 10/05/16 12:55, Felipe Balbi wrote:

>>>

>>> Hi,

>>>

>>> Roger Quadros <rogerq@ti.com> writes:

>>>> Don't make any decisions regarding VBUS session based on ID

>>>> status. That is best left to the OTG core.

>>>>

>>>> Pass ID and VBUS events independent of each other so that OTG

>>>> core knows exactly what to do.

>>>>

>>>> This makes dual-role with extcon work with OTG irq on OMAP platforms.

>>>>

>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>

>>>

>>> I have a feeling this will regress OMAP5432 uEVM. Did you test with that

>>> board ?

>>>

>>

>> Yes. Any specific test case you would like me to test?

>> For now I'm just doing enumeration with g_zero.

> 

> IIRC OMAP5 uEVM didn't have separate VBUS and ID GPIOs. How are you

> handling that case ?

> 

It comes from the PMIC, extcon-palmas.c.

cheers,
-roger
diff mbox

Patch

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 1f7259d..c40d301 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -231,18 +231,14 @@  static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
 		}
 
 		val = dwc3_omap_read_utmi_ctrl(omap);
-		val &= ~(USBOTGSS_UTMI_OTG_CTRL_IDDIG
-				| USBOTGSS_UTMI_OTG_CTRL_VBUSVALID
-				| USBOTGSS_UTMI_OTG_CTRL_SESSEND);
-		val |= USBOTGSS_UTMI_OTG_CTRL_SESSVALID;
+		val &= ~USBOTGSS_UTMI_OTG_CTRL_IDDIG;
 		dwc3_omap_write_utmi_ctrl(omap, val);
 		break;
 
 	case OMAP_DWC3_VBUS_VALID:
 		val = dwc3_omap_read_utmi_ctrl(omap);
 		val &= ~USBOTGSS_UTMI_OTG_CTRL_SESSEND;
-		val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG
-				| USBOTGSS_UTMI_OTG_CTRL_VBUSVALID
+		val |= USBOTGSS_UTMI_OTG_CTRL_VBUSVALID
 				| USBOTGSS_UTMI_OTG_CTRL_SESSVALID;
 		dwc3_omap_write_utmi_ctrl(omap, val);
 		break;
@@ -250,13 +246,15 @@  static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
 	case OMAP_DWC3_ID_FLOAT:
 		if (omap->vbus_reg)
 			regulator_disable(omap->vbus_reg);
+		val = dwc3_omap_read_utmi_ctrl(omap);
+		val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG;
+		dwc3_omap_write_utmi_ctrl(omap, val);
 
 	case OMAP_DWC3_VBUS_OFF:
 		val = dwc3_omap_read_utmi_ctrl(omap);
 		val &= ~(USBOTGSS_UTMI_OTG_CTRL_SESSVALID
 				| USBOTGSS_UTMI_OTG_CTRL_VBUSVALID);
-		val |= USBOTGSS_UTMI_OTG_CTRL_SESSEND
-				| USBOTGSS_UTMI_OTG_CTRL_IDDIG;
+		val |= USBOTGSS_UTMI_OTG_CTRL_SESSEND;
 		dwc3_omap_write_utmi_ctrl(omap, val);
 		break;