public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions
@ 2013-06-10 14:23 Michael Trimarchi
  2013-06-10 14:52 ` Lubomir Popov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael Trimarchi @ 2013-06-10 14:23 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
index 2a42033..4db7fa4 100644
--- a/drivers/usb/ulpi/omap-ulpi-viewport.c
+++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
@@ -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);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions
  2013-06-10 14:23 [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions Michael Trimarchi
@ 2013-06-10 14:52 ` Lubomir Popov
  2013-06-10 15:05 ` Lubomir Popov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lubomir Popov @ 2013-06-10 14:52 UTC (permalink / raw)
  To: u-boot

Hi Michael,

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

On 10/06/13 17:23, Michael Trimarchi wrote:
> 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.
>    Add a +1 fix the problem
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
> index 2a42033..4db7fa4 100644
> --- a/drivers/usb/ulpi/omap-ulpi-viewport.c
> +++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
> @@ -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);
> 
As for the patch itself, tested on a custom OMAP5430 board with a TUSB1210
ULPI PHY on USBB1:

Tested-by: Lubomir Popov <lpopov@mm-sol.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions
  2013-06-10 14:23 [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions Michael Trimarchi
  2013-06-10 14:52 ` Lubomir Popov
@ 2013-06-10 15:05 ` Lubomir Popov
  2013-06-10 15:13 ` Igor Grinberg
  2013-07-02 20:06 ` [U-Boot] " Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Lubomir Popov @ 2013-06-10 15:05 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On 10/06/13 17:23, Michael Trimarchi wrote:
> 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
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
> index 2a42033..4db7fa4 100644
> --- a/drivers/usb/ulpi/omap-ulpi-viewport.c
> +++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions
  2013-06-10 14:23 [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions Michael Trimarchi
  2013-06-10 14:52 ` Lubomir Popov
  2013-06-10 15:05 ` Lubomir Popov
@ 2013-06-10 15:13 ` Igor Grinberg
  2013-07-02 20:06 ` [U-Boot] " Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Igor Grinberg @ 2013-06-10 15:13 UTC (permalink / raw)
  To: u-boot

On 06/10/13 17:23, Michael Trimarchi wrote:
> 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
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

> ---
>  drivers/usb/ulpi/omap-ulpi-viewport.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
> index 2a42033..4db7fa4 100644
> --- a/drivers/usb/ulpi/omap-ulpi-viewport.c
> +++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
> @@ -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);
> 

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] usb: omap: ulpi: fix ulpi reading/writing functions
  2013-06-10 14:23 [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions Michael Trimarchi
                   ` (2 preceding siblings ...)
  2013-06-10 15:13 ` Igor Grinberg
@ 2013-07-02 20:06 ` Tom Rini
  3 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2013-07-02 20:06 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 10, 2013 at 04:23:33PM +0200, Michael Trimarchi wrote:

> 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
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Tested-by: Lubomir Popov <lpopov@mm-sol.com>
> Acked-by: Igor Grinberg <grinberg@compulab.co.il>

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

-- 
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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-02 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 14:23 [U-Boot] [PATCH] usb: omap: ulpi: fix ulpi reading/writing functions Michael Trimarchi
2013-06-10 14:52 ` Lubomir Popov
2013-06-10 15:05 ` Lubomir Popov
2013-06-10 15:13 ` Igor Grinberg
2013-07-02 20:06 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox