public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v2 5/6] am33xx: init OTG hardware and new musb gadget driver
Date: Sat, 22 Sep 2012 02:49:10 +0200	[thread overview]
Message-ID: <201209220249.10672.marex@denx.de> (raw)
In-Reply-To: <1347837274-17864-6-git-send-email-ilya.yanok@cogentembedded.com>

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@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() ?

[...]

  reply	other threads:[~2012-09-22  0:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 23:14 [U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux Ilya Yanok
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 1/6] linux/usb/ch9.h: update with the version from Linux tree Ilya Yanok
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 2/6] usb: use linux/usb/ch9.h instead of usbdescriptors.h Ilya Yanok
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 3/6] musb-new: port of Linux musb driver Ilya Yanok
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 4/6] musb-new: dsps backend driver Ilya Yanok
2012-09-22  0:48   ` Marek Vasut
2012-09-22  7:59     ` Ilya Yanok
2012-09-22 13:34       ` Marek Vasut
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 5/6] am33xx: init OTG hardware and new musb gadget driver Ilya Yanok
2012-09-22  0:49   ` Marek Vasut [this message]
2012-09-22  7:55     ` Ilya Yanok
2012-09-16 23:14 ` [U-Boot] [RFC PATCH v2 6/6] am335x_evm: enable both musb gadget and host Ilya Yanok
2012-09-22  0:55 ` [U-Boot] [RFC PATCH v2 0/6] Port of MUSB driver from Linux Marek Vasut
2012-09-22  7:53   ` Ilya Yanok
2012-09-22 17:44   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201209220249.10672.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox