[U-Boot] [RFC PATCH v2 5/6] am33xx: init OTG hardware and new musb gadget driver

Marek Vasut marex at denx.de
Sat Sep 22 02:49:10 CEST 2012


Dear Ilya Yanok,

> AM33xx has support for dual port MUSB OTG controller. This patch
> adds initialization for the controller using new MUSB gadget
> driver and ether gadget.
> 
> Signed-off-by: Ilya Yanok <ilya.yanok at cogentembedded.com>
> ---
> Changes in v2:
>  - init both musb IPs (conditionally) from arch_init not
>    from eth_initialize
> 
>  arch/arm/cpu/armv7/am33xx/board.c           |  107
> ++++++++++++++++++++++++++- arch/arm/cpu/armv7/am33xx/clock.c           | 
>   8 ++
>  arch/arm/include/asm/arch-am33xx/cpu.h      |   11 ++-
>  arch/arm/include/asm/arch-am33xx/hardware.h |    4 +
>  4 files changed, 126 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/am33xx/board.c
> b/arch/arm/cpu/armv7/am33xx/board.c index b387ac2..9007356 100644
> --- a/arch/arm/cpu/armv7/am33xx/board.c
> +++ b/arch/arm/cpu/armv7/am33xx/board.c
> @@ -33,6 +33,11 @@
>  #include <i2c.h>
>  #include <miiphy.h>
>  #include <cpsw.h>
> +#include <asm/errno.h>
> +#include <linux/usb/ch9.h>
> +#include <linux/usb/gadget.h>
> +#include <linux/usb/musb.h>
> +#include <asm/omap_musb.h>
> 
>  DECLARE_GLOBAL_DATA_PTR;
> 
> @@ -227,6 +232,88 @@ void setup_clocks_for_console(void)
>  	return;
>  }
> 
> +/* AM33XX has two MUSB controllers which can be host or gadget */
> +#if (defined(CONFIG_MUSB_GADGET) || defined(CONFIG_MUSB_HOST)) && \
> +	(defined(CONFIG_AM335X_USB0) || defined(CONFIG_AM335X_USB1))
> +/* USB 2.0 PHY Control */
> +#define CM_PHY_PWRDN			(1 << 0)
> +#define CM_PHY_OTG_PWRDN		(1 << 1)
> +#define OTGVDET_EN			(1 << 19)
> +#define OTGSESSENDEN			(1 << 20)
> +
> +static void am33xx_usb_set_phy_power(u8 on, u32 *reg_addr)
> +{
> +	u32 usb_ctrl_reg;
> +
> +	usb_ctrl_reg = readl(reg_addr);
> +	if (on) {
> +		usb_ctrl_reg &= ~(CM_PHY_PWRDN | CM_PHY_OTG_PWRDN);
> +		usb_ctrl_reg |= (OTGVDET_EN | OTGSESSENDEN);
> +	} else {
> +		usb_ctrl_reg |= (CM_PHY_PWRDN | CM_PHY_OTG_PWRDN);
> +	}
> +	writel(usb_ctrl_reg, reg_addr);

clrsetbits_le32() ?

[...]



More information about the U-Boot mailing list