Skip to contentSkip to conversation

usb: omap: ulpi: fix ulpi reading/writing functions

PATCH In review Michael Trimarchi 4 participants 5 messages Jun 10, 2013 – Jul 2, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: omap: ulpi: fix ulpi reading/writing functions

Fix ulpi reading and writing function.
* Both functions need to have the bit31 setted.
* Right now uboot use 0 to enumerate port 1 and 1 to
enumerate port 2 and so on. Omap code use 1 for port 1 and 2 for port 2. Add a +1 fix the problem

---
 drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/ulpi/omap-ulpi-viewport.c +2 -2
index 2a42033..4db7fa4 100644
@@ -61,7 +61,7 @@ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
 
 int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 {
-	u32 val = (OMAP_ULPI_START | (ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff);
 
 	return ulpi_request(ulpi_vp, val);
@@ -70,7 +70,7 @@ int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
 {
 	int err;
-	u32 val = ((ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			 OMAP_ULPI_RD_OPSEL | ((u32)reg << 16);
 
 	err = ulpi_request(ulpi_vp, val);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 usb: omap: ulpi: fix ulpi reading/writing functions

Hi Michael,

A minor suggestion to clarify the explanation (its HW that requires +1):

Quoted 4 lines · Michael Trimarchi

Fix ulpi reading and writing function.
* Both functions need to have the bit31 setted.
* Right now uboot use 0 to enumerate port 1 and 1 to
enumerate port 2 and so on. Omap code use 1 for port 1 and 2 for port 2.

---------------------------------^
The OMAP INSNREG05_ULPI register expects a value of 1 for Port 1 and of 2 for Port 2 in the PORTSEL field.

Quoted 22 lines

Add a +1 fix the problem

---
 drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/ulpi/omap-ulpi-viewport.c +1 -1
index 2a42033..4db7fa4 100644
@@ -61,7 +61,7 @@ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
 
 int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 {
-	u32 val = (OMAP_ULPI_START | (ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff);
 
 	return ulpi_request(ulpi_vp, val);

drivers/usb/ulpi/omap-ulpi-viewport.c int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value) · line 76

Quoted 8 lines
drivers/usb/ulpi/omap-ulpi-viewport.c +1 -1
@@ -70,7 +70,7 @@ int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
 {
 	int err;
-	u32 val = ((ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			 OMAP_ULPI_RD_OPSEL | ((u32)reg << 16);
 
 	err = ulpi_request(ulpi_vp, val);

As for the patch itself, tested on a custom OMAP5430 board with a TUSB1210 ULPI PHY on USBB1:

#2 lore raw

PATCH 1/1 usb: omap: ulpi: fix ulpi reading/writing functions

In reply to Michael Trimarchi

Hi Michael,

Quoted 16 lines · Michael Trimarchi

Fix ulpi reading and writing function.
* Both functions need to have the bit31 setted.
* Right now uboot use 0 to enumerate port 1 and 1 to
enumerate port 2 and so on. Omap code use 1 for port 1 and 2 for port 2. Add a +1 fix the problem

---
 drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/ulpi/omap-ulpi-viewport.c +0 -0
index 2a42033..4db7fa4 100644

drivers/usb/ulpi/omap-ulpi-viewport.c static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value) · line 61

Quoted 1 line
drivers/usb/ulpi/omap-ulpi-viewport.c +0 -0
@@ -61,7 +61,7 @@ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
 

I now see that you have not rebased on a clean u-boot-ti/master. This patch is incremental to your older version, but without any notification about this, and without version info in the subject. I guess you shall have to repost.

Best regards,
Lubomir

#3 lore raw

PATCH 1/1 usb: omap: ulpi: fix ulpi reading/writing functions

In reply to Michael Trimarchi
Quoted 7 lines · Michael Trimarchi

Fix ulpi reading and writing function.
* Both functions need to have the bit31 setted.
* Right now uboot use 0 to enumerate port 1 and 1 to
enumerate port 2 and so on. Omap code use 1 for port 1 and 2 for port 2. Add a +1 fix the problem

Quoted 27 lines
---
 drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/ulpi/omap-ulpi-viewport.c +2 -2
index 2a42033..4db7fa4 100644
@@ -61,7 +61,7 @@ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value)
 
 int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 {
-	u32 val = (OMAP_ULPI_START | (ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff);
 
 	return ulpi_request(ulpi_vp, val);
@@ -70,7 +70,7 @@ int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
 u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
 {
 	int err;
-	u32 val = ((ulpi_vp->port_num & 0xf) << 24) |
+	u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) |
 			 OMAP_ULPI_RD_OPSEL | ((u32)reg << 16);
 
 	err = ulpi_request(ulpi_vp, val);
Signature · 2 lines
Regards,
Igor.
#4 lore raw
In reply to Michael Trimarchi
Quoted 9 lines · Michael Trimarchi

Fix ulpi reading and writing function.
* Both functions need to have the bit31 setted.
* Right now uboot use 0 to enumerate port 1 and 1 to
enumerate port 2 and so on. Omap code use 1 for port 1 and 2 for port 2. Add a +1 fix the problem

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130702/4c5038e0/attachment.pgp>