[U-Boot] [PATCH v3 7/7] usb: ulpi: Add omap-ulpi-view port support

Igor Grinberg grinberg at compulab.co.il
Mon Feb 6 10:10:20 CET 2012


On 02/03/12 15:38, Govindraj.R wrote:
> From: "Govindraj.R" <govindraj.raja at ti.com>
> 
> Based on discussion from this thread [1].
> Adding omap-view port that helps us in using the generic ulpi
> framework for any ulpi phy ops using the INSNREG05_ULPI viewport
> reg available on omap platform.
> 
> Currently ehci ports are available on omap3/4 platforms so enable the same
> for beagle and panda, patch is tested on the same boards.
> 
> Thanks to Igor Grinberg <grinberg at compulab.co.il> for reviewing the
> omap-ehci patches and suggesting this approach.
> 
> [1]: http://www.mail-archive.com/u-boot@lists.denx.de/msg76076.html
> 
> Tested-by: Stefano Babic <sbabic at denx.de>
> Signed-off-by: Govindraj.R <govindraj.raja at ti.com>

After fixing several neats below,

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

> ---
>  doc/README.omap-ulpi-viewport         |   27 +++++++++
>  drivers/usb/ulpi/Makefile             |    1 +
>  drivers/usb/ulpi/omap-ulpi-viewport.c |  105 +++++++++++++++++++++++++++++++++
>  include/configs/omap3_beagle.h        |    3 +
>  include/configs/omap4_panda.h         |    2 +
>  5 files changed, 138 insertions(+), 0 deletions(-)
>  create mode 100644 doc/README.omap-ulpi-viewport
>  create mode 100644 drivers/usb/ulpi/omap-ulpi-viewport.c
> 
> diff --git a/doc/README.omap-ulpi-viewport b/doc/README.omap-ulpi-viewport
> new file mode 100644
> index 0000000..19feecd
> --- /dev/null
> +++ b/doc/README.omap-ulpi-viewport
> @@ -0,0 +1,27 @@
> +Reference code ""drivers/usb/ulpi/omap-ulpi-viewport.c"
> +
> +Contains the ulpi read write api's to perform
> +any ulpi phy port access on omap platform.
> +
> +On omap ehci reg map contains INSNREG05_ULPI
> +register which offers the ulpi phy access so
> +any ulpi phy commands can be passsed using this

should be passed                  ^^^

> +register.
> +
> +omap-ulpi-viewport.c is a low level function
> +implementation of "drivers/usb/ulpi/ulpi.c"
> +
> +To enable and use omap-ulpi-viewport.c
> +we requires CONFIG_USB_ULPI_VIEWPORT_OMAP and

s/requires/require/

> +CONFIG_USB_ULPI be enabled from config file.

s/from/in/

> +
> +Any ulpi ops request can be done with ulpi.c
> +and soc specific binding and usage is done with
> +omap-ulpi-viewport implementation.
> +
> +Ex: scenario:
> +omap-ehci driver code requests for ulpi phy reset if
> +ehci is used in phy mode, which will call ulpi phy reset
> +the ulpi phy reset does ulpi_read/write from viewport
> +implementation which will do ulpi reset using the
> +INSNREG05_ULPI register.

[...]

> diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
> new file mode 100644
> index 0000000..66b1795
> --- /dev/null
> +++ b/drivers/usb/ulpi/omap-ulpi-viewport.c

[...]

> +int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
> +{
> +	u32 val = ((ulpi_vp->port_num & 0x7) << 24) |
> +			OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff);

On OMAP, port_num is 4 bits wide, therefore:
ulpi_vp->port_num & 0xf

> +
> +	return ulpi_request(ulpi_vp, val);
> +}
> +
> +u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
> +{
> +	int err;
> +	u32 val = ((ulpi_vp->port_num & 0x7) << 24) |
> +			 OMAP_ULPI_WR_OPSEL | ((u32)reg << 16);

same here:
ulpi_vp->port_num & 0xf

> +
> +	err = ulpi_request(ulpi_vp, val);
> +	if (err)
> +		return err;
> +
> +	return readl(ulpi_vp->viewport_addr) & 0xff;
> +}

[...]


-- 
Regards,
Igor.


More information about the U-Boot mailing list