[U-Boot] [PATCH 1/3] musb: Add Phy programming for using external Vbus

Mike Frysinger vapier at gentoo.org
Tue Jun 8 21:15:49 CEST 2010


On Tuesday, June 08, 2010 05:05:54 Ajay Kumar Gupta wrote:
> MUSB PHY on OMAP3EVM Rev >= E uses external Vbus supply to support
> 500mA of power.We need to program MUSB PHY to use external Vbus
> for this purpose.
> 
> Adding 'extvbus' member in musb_config structure which should be set
> by all the boards where MUSB interface is using external Vbus supply.
> Default value of 'extvbus' is being set to '0'.

*sigh* it looks like we're going to start hit the cross-platform build 
warnings/failures in u-boot that we're already hitting under Linux

> --- a/drivers/usb/musb/davinci.c
> +++ b/drivers/usb/musb/davinci.c
> @@ -30,6 +30,7 @@
>  struct musb_config musb_cfg = {
>  	(struct	musb_regs *)MENTOR_USB0_BASE,
>  	DAVINCI_USB_TIMEOUT,
> +	0,
>  	0
>  };

we should probably update the musb_cfg assignment style to used named members 
so that adding new fields doesnt screw up (as much) existing ports.  by using 
unamed initializers, a new field in the struct requires all assignments to be 
updated.  but if we used names here, than new fields are automatically 
assigned a value of 0.

> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
> @@ -34,6 +34,7 @@ void musb_start(void)
>  {
>  #if defined(CONFIG_MUSB_HCD)
>  	u8 devctl;
> +	u8 busctl;
>  #endif
> 
>  	/* disable all interrupts */
> @@ -45,6 +46,12 @@ void musb_start(void)
>  	/* put into basic highspeed mode and start session */
>  	writeb(MUSB_POWER_HSENAB, &musbr->power);
>  #if defined(CONFIG_MUSB_HCD)
> +	/* Program PHY to use EXT VBUS if required */
> +	if (musb_cfg.extvbus == 1) {
> +		busctl = readb(&musbr->ulpi_busctl);
> +		writeb(busctl | ULPI_USE_EXTVBUS, &musbr->ulpi_busctl);
> +	}

not all MUSB users have ulpi support, so this needs to be abstracted out

> --- a/drivers/usb/musb/musb_core.h
> +++ b/drivers/usb/musb/musb_core.h
> @@ -112,7 +112,10 @@ struct musb_regs {
>  	u16	rxfifoadd;
>  	u32	vcontrol;
>  	u16	hwvers;
> -	u16	reserved2[5];
> +	u16	reserved2a[1];
> +	u8	ulpi_busctl;
> +	u8	reserved2b[1];
> +	u16	reserved2[3];
>  	u8	epinfo;
>  	u8	raminfo;
>  	u8	linkinfo;

if you look just above the musb_regs struct, you'll see there is a hook for 
people to declare their own layout.  so the ulpi abstraction should be inside 
of this #ifdef.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100608/286a485f/attachment.pgp 


More information about the U-Boot mailing list