public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergei Ianovich <ynvich@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/5] arm: pxa: fix LP-8x4x USB support
Date: Tue, 17 Dec 2013 05:03:41 +0400	[thread overview]
Message-ID: <1387242224-22495-3-git-send-email-ynvich@gmail.com> (raw)
In-Reply-To: <1387242224-22495-1-git-send-email-ynvich@gmail.com>

USB was broken initially. Power polarity should be direct.

Signed-off-by: Sergei Ianovich <ynvich@gmail.com>
CC: Marek Vasut <marex@denx.de>
---
 Changes v1..v2
 * new patch

 board/icpdas/lp8x4x/lp8x4x.c | 22 +++++++++++++---------
 include/configs/lp8x4x.h     |  3 +--
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/board/icpdas/lp8x4x/lp8x4x.c b/board/icpdas/lp8x4x/lp8x4x.c
index 1b68ef3..0888960 100644
--- a/board/icpdas/lp8x4x/lp8x4x.c
+++ b/board/icpdas/lp8x4x/lp8x4x.c
@@ -60,15 +60,21 @@ int board_mmc_init(bd_t *bis)
 #ifdef	CONFIG_CMD_USB
 int usb_board_init(void)
 {
-	writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
-		~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
-		UHCHR);
+	writel(readl(CKEN) | CKEN10_USBHOST, CKEN);
+
+	writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
+	udelay(11);
+	writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
 
 	writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
 
 	while (readl(UHCHR) & UHCHR_FSBIR)
 		continue; /* required by checkpath.pl */
 
+	writel(readl(UHCHR) & ~UHCHR_SSEP0, UHCHR);
+	writel(readl(UHCRHDA) & ~(0x1000), UHCRHDA);
+	writel(readl(UHCRHDA) | 0x800, UHCRHDA);
+
 	writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
 	writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
 
@@ -82,10 +88,6 @@ int usb_board_init(void)
 	/* Set port power control mask bits, only 3 ports. */
 	writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
 
-	/* enable port 2 */
-	writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
-		UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR);
-
 	return 0;
 }
 
@@ -94,7 +96,7 @@ void usb_board_init_fail(void)
 	return;
 }
 
-void usb_board_stop(void)
+int usb_board_stop(void)
 {
 	writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
 	udelay(11);
@@ -103,9 +105,11 @@ void usb_board_stop(void)
 	writel(readl(UHCCOMS) | 1, UHCCOMS);
 	udelay(10);
 
+	writel(readl(UHCHR) | UHCHR_SSEP0 | UHCHR_SSE, UHCHR);
+
 	writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
 
-	return;
+	return 0;
 }
 #endif
 
diff --git a/include/configs/lp8x4x.h b/include/configs/lp8x4x.h
index 6df6f2b..2c03425 100644
--- a/include/configs/lp8x4x.h
+++ b/include/configs/lp8x4x.h
@@ -190,7 +190,7 @@
 #define	CONFIG_SYS_GAFR1_L_VAL	0x999a955a
 #define	CONFIG_SYS_GAFR1_U_VAL	0xaaa5a00a
 #define	CONFIG_SYS_GAFR2_L_VAL	0xaaaaaaaa
-#define	CONFIG_SYS_GAFR2_U_VAL	0x55f0a402
+#define	CONFIG_SYS_GAFR2_U_VAL	0x55f9a402
 #define	CONFIG_SYS_GAFR3_L_VAL	0x540a950c
 #define	CONFIG_SYS_GAFR3_U_VAL	0x00001599
 
@@ -238,7 +238,6 @@
  */
 #ifdef	CONFIG_CMD_USB
 #define	CONFIG_USB_OHCI_NEW
-#define	CONFIG_SYS_USB_OHCI_CPU_INIT
 #define	CONFIG_SYS_USB_OHCI_BOARD_INIT
 #define	CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
 #define	CONFIG_SYS_USB_OHCI_REGS_BASE	0x4C000000
-- 
1.8.5.1

  parent reply	other threads:[~2013-12-17  1:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-14  5:41 [U-Boot] [PATCH 0/4] fix and update LP-8x4x to boot DTS kernel Sergei Ianovich
2013-12-14  5:41 ` [U-Boot] [PATCH 1/4] ARM: pxa: prevent PXA270 occasional reboot freezes Sergei Ianovich
2013-12-14 12:29   ` Marek Vasut
2013-12-14 15:31     ` Sergei Ianovich
2013-12-14 17:14       ` Marek Vasut
2013-12-14 23:51         ` Sergei Ianovich
2013-12-15  5:17           ` Marek Vasut
2013-12-15  9:48             ` Sergei Ianovich
2013-12-15 15:04               ` Marek Vasut
2013-12-14  5:41 ` [U-Boot] [PATCH 2/4] arm: pxa: always init ethaddr for LP-8x4x Sergei Ianovich
2013-12-14 12:30   ` Marek Vasut
2013-12-14 15:39     ` Sergei Ianovich
2013-12-14 17:12       ` Marek Vasut
2013-12-14 20:53         ` Sergei Ianovich
2013-12-14 20:57           ` Marek Vasut
2013-12-14 23:53             ` Sergei Ianovich
2013-12-15  5:17               ` Marek Vasut
2013-12-15  9:44                 ` Sergei Ianovich
2013-12-15 15:05                   ` Marek Vasut
2013-12-15 18:43                     ` Sergei Ianovich
2013-12-14  5:41 ` [U-Boot] [PATCH 3/4] arm: pxa: fix 2nd flash chip address on LP-8x4x Sergei Ianovich
2013-12-14  5:42 ` [U-Boot] [PATCH 4/4] arm: pxa: update LP-8x4x to boot DTS kernel Sergei Ianovich
2013-12-14 12:32   ` Marek Vasut
2013-12-14 15:41     ` Sergei Ianovich
2013-12-14 17:05       ` Marek Vasut
2013-12-15  9:57         ` Sergei Ianovich
2013-12-15 15:06           ` Marek Vasut
2013-12-15 18:56             ` Sergei Ianovich
2013-12-15 19:22               ` Marek Vasut
2013-12-17  1:07                 ` Sergei Ianovich
2013-12-17  1:03 ` [U-Boot] [PATCH v2 0/5] fix and update LP-8x4x to boot DT kernel Sergei Ianovich
2013-12-17  1:03   ` [U-Boot] [PATCH v2 1/5] ARM: pxa: prevent PXA270 occasional reboot freezes Sergei Ianovich
2013-12-17  1:03   ` Sergei Ianovich [this message]
2013-12-18 15:01     ` [U-Boot] [PATCH v2 2/5] arm: pxa: fix LP-8x4x USB support Marek Vasut
2013-12-18 16:19     ` [U-Boot] [PATCH v3] " Sergei Ianovich
2013-12-18 17:15       ` Marek Vasut
2013-12-17  1:03   ` [U-Boot] [PATCH v2 3/5] arm: pxa: fix 2nd flash chip address on LP-8x4x Sergei Ianovich
2013-12-17  1:03   ` [U-Boot] [PATCH v2 4/5] arm: pxa: update LP-8x4x to boot DT kernel Sergei Ianovich
2013-12-17  1:03   ` [U-Boot] [PATCH v2 5/5] arm: pxa: init ethaddr for LP-8x4x using DT Sergei Ianovich
2013-12-18 15:01   ` [U-Boot] [PATCH v2 0/5] fix and update LP-8x4x to boot DT kernel Marek Vasut
2013-12-18 16:21     ` Sergei Ianovich

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=1387242224-22495-3-git-send-email-ynvich@gmail.com \
    --to=ynvich@gmail.com \
    --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