mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] arm: ccmx51: Using imx51_add_usbotg() function for register USB
Date: Thu, 14 Mar 2013 14:40:06 +0400	[thread overview]
Message-ID: <1363257606-23877-2-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1363257606-23877-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/ccxmx51/ccxmx51.c |   51 +++---------------------------------
 1 files changed, 5 insertions(+), 46 deletions(-)

diff --git a/arch/arm/boards/ccxmx51/ccxmx51.c b/arch/arm/boards/ccxmx51/ccxmx51.c
index b1c579b..8230f55 100644
--- a/arch/arm/boards/ccxmx51/ccxmx51.c
+++ b/arch/arm/boards/ccxmx51/ccxmx51.c
@@ -195,51 +195,10 @@ static const struct spi_board_info ccxmx51_spi_board_info[] = {
 	},
 };
 
-static void ccxmx51_otghost_init(void)
-{
-#define MX51_USBOTHER_REGS_OFFSET		0x800
-#define MX51_USBCTRL_OFFSET			0x0
-#define MX51_USB_PHY_CTR_FUNC_OFFSET		0x8
-#define MX51_USB_PHY_CTR_FUNC2_OFFSET		0xc
-#define MX51_USB_UTMI_PHYCTRL1_PLLDIV_MASK	0x3
-#define MX51_USB_PLL_DIV_19_2_MHZ		0x00
-#define MX51_USB_PLL_DIV_24_MHZ			0x01
-#define MX51_USB_PLL_DIV_26_MHZ			0x02
-#define MX51_USB_PLL_DIV_27_MHZ			0x03
-#define MX51_OTG_PHYCTRL_OC_DIS_BIT		(1 << 8)
-#define MX51_OTG_UCTRL_OWIE_BIT			(1 << 27)
-#define MX51_OTG_UCTRL_OPM_BIT			(1 << 24)
-
-#define USBOTHER_BASE				(MX51_OTG_BASE_ADDR + MX51_USBOTHER_REGS_OFFSET)
-
-	u32 reg;
-
-	/* Set sysclock to 24 MHz */
-	reg = readl(USBOTHER_BASE + MX51_USB_PHY_CTR_FUNC2_OFFSET);
-	reg &= ~MX51_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
-	reg |= MX51_USB_PLL_DIV_24_MHZ;
-	writel(reg, USBOTHER_BASE + MX51_USB_PHY_CTR_FUNC2_OFFSET);
-
-	/* OC is not used */
-	reg = readl(USBOTHER_BASE + MX51_USB_PHY_CTR_FUNC_OFFSET);
-	reg |= MX51_OTG_PHYCTRL_OC_DIS_BIT;
-	writel(reg, USBOTHER_BASE + MX51_USB_PHY_CTR_FUNC_OFFSET);
-
-	/* Power pins enable */
-	reg = readl(USBOTHER_BASE + MX51_USBCTRL_OFFSET);
-	reg |= MX51_OTG_UCTRL_OWIE_BIT | MX51_OTG_UCTRL_OPM_BIT;
-	writel(reg, USBOTHER_BASE + MX51_USBCTRL_OFFSET);
-
-	/* Setup PORTSC */
-	reg = readl(MX51_OTG_BASE_ADDR + 0x184);
-	reg &= ~(3 << 30);
-	reg |= 1 << 28;
-	writel(reg, MX51_OTG_BASE_ADDR + 0x184);
-
-	mdelay(10);
-
-	add_generic_usb_ehci_device(0, MX51_OTG_BASE_ADDR, NULL);
-}
+static struct imxusb_platformdata ccxmx51_otg_pdata = {
+	.flags	= MXC_EHCI_MODE_UTMI_16_BIT | MXC_EHCI_POWER_PINS_ENABLED,
+	.mode	= IMX_USB_MODE_HOST,
+};
 
 static int ccxmx51_power_init(void)
 {
@@ -453,7 +412,7 @@ static int ccxmx51_devices_init(void)
 		add_generic_device("smc911x", 1, NULL, MX51_CS5_BASE_ADDR, SZ_4K, IORESOURCE_MEM, NULL);
 	}
 
-	ccxmx51_otghost_init();
+	imx51_add_usbotg(&ccxmx51_otg_pdata);
 
 	armlinux_set_bootparams((void *)(MX51_CSD0_BASE_ADDR + 0x100));
 
-- 
1.7.3.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-03-14 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 10:40 [PATCH 1/2] ARM: ccmx51: Migrate to defaultenv-2 Alexander Shiyan
2013-03-14 10:40 ` Alexander Shiyan [this message]
2013-03-15  7:27 ` Sascha Hauer

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=1363257606-23877-2-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.org \
    /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