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 1/2] PCM038: Move USBH2 initialization to PCM970
Date: Mon, 14 May 2012 12:34:11 +0400	[thread overview]
Message-ID: <1336984452-32194-1-git-send-email-shc_work@mail.ru> (raw)

Actually ISP1504 ULPI chip are installed on PCM970 development board.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/pcm038/pcm038.c |   40 -------------------------------
 arch/arm/boards/pcm038/pcm970.c |   49 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 40 deletions(-)

diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index c8a6aac..d247edc 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -37,7 +37,6 @@
 #include <mach/imx-pll.h>
 #include <mach/imxfb.h>
 #include <i2c/i2c.h>
-#include <usb/ulpi.h>
 #include <mach/spi.h>
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
@@ -107,27 +106,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
 	.dmacr	= 0x00020010,
 };
 
-#ifdef CONFIG_USB
-static void pcm038_usbh_init(void)
-{
-	uint32_t temp;
-
-	temp = readl(IMX_OTG_BASE + 0x600);
-	temp &= ~((3 << 21) | 1);
-	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
-	writel(temp, IMX_OTG_BASE + 0x600);
-
-	temp = readl(IMX_OTG_BASE + 0x584);
-	temp &= ~(3 << 30);
-	temp |= 2 << 30;
-	writel(temp, IMX_OTG_BASE + 0x584);
-
-	mdelay(10);
-
-	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
-}
-#endif
-
 /**
  * The spctl0 register is a beast: Seems you can read it
  * only one times without writing it again.
@@ -260,19 +238,6 @@ static int pcm038_devices_init(void)
 		PA29_PF_VSYNC,
 		PA30_PF_CONTRAST,
 		PA31_PF_OE_ACD,
-		/* USB host 2 */
-		PA0_PF_USBH2_CLK,
-		PA1_PF_USBH2_DIR,
-		PA2_PF_USBH2_DATA7,
-		PA3_PF_USBH2_NXT,
-		PA4_PF_USBH2_STP,
-		PD19_AF_USBH2_DATA4,
-		PD20_AF_USBH2_DATA3,
-		PD21_AF_USBH2_DATA6,
-		PD22_AF_USBH2_DATA0,
-		PD23_AF_USBH2_DATA2,
-		PD24_AF_USBH2_DATA1,
-		PD26_AF_USBH2_DATA5,
 		/* I2C1 */
 		PD17_PF_I2C_DATA | GPIO_PUEN,
 		PD18_PF_I2C_CLK,
@@ -310,11 +275,6 @@ static int pcm038_devices_init(void)
 	imx27_add_i2c0(NULL);
 	imx27_add_i2c1(NULL);
 
-#ifdef CONFIG_USB
-	pcm038_usbh_init();
-	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
-#endif
-
 	/* Register the fec device after the PLL re-initialisation
 	 * as the fec depends on the (now higher) ipg clock
 	 */
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index cdd68a3..7405fc1 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -15,15 +15,64 @@
  * MA 02111-1307 USA
  */
 
+#include <common.h>
 #include <io.h>
 #include <init.h>
 #include <mach/imx-regs.h>
+#include <mach/iomux-mx27.h>
+#include <mach/gpio.h>
+#include <usb/ulpi.h>
+
+#ifdef CONFIG_USB
+static void pcm970_usbh2_init(void)
+{
+	int i;
+	uint32_t temp;
+	unsigned int mode[] = {
+		/* USB Host 2 */
+		PA0_PF_USBH2_CLK,
+		PA1_PF_USBH2_DIR,
+		PA2_PF_USBH2_DATA7,
+		PA3_PF_USBH2_NXT,
+		PA4_PF_USBH2_STP,
+		PD19_AF_USBH2_DATA4,
+		PD20_AF_USBH2_DATA3,
+		PD21_AF_USBH2_DATA6,
+		PD22_AF_USBH2_DATA0,
+		PD23_AF_USBH2_DATA2,
+		PD24_AF_USBH2_DATA1,
+		PD26_AF_USBH2_DATA5,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+	temp = readl(IMX_OTG_BASE + 0x600);
+	temp &= ~((3 << 21) | 1);
+	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
+	writel(temp, IMX_OTG_BASE + 0x600);
+
+	temp = readl(IMX_OTG_BASE + 0x584);
+	temp &= ~(3 << 30);
+	temp |= 2 << 30;
+	writel(temp, IMX_OTG_BASE + 0x584);
+
+	mdelay(10);
+
+	if (!ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1))
+		add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
+}
+#endif
 
 static int pcm970_init(void)
 {
 	/* Configure SJA1000 on cs4 */
 	imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
 
+#ifdef CONFIG_USB
+	pcm970_usbh2_init();
+#endif
+
 	return 0;
 }
 
-- 
1.7.3.4


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

             reply	other threads:[~2012-05-14  8:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14  8:34 Alexander Shiyan [this message]
2012-05-14  8:34 ` [PATCH 2/2] Add compressed barebox_default_env to .gitignore Alexander Shiyan
2012-05-14  8:57 ` [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Juergen Beisert
2012-05-14  9:50   ` Alexander Shiyan

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=1336984452-32194-1-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