All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Zhang <chris@seamicro.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] ppc440epx(sequoia) USB ehci fix.
Date: Tue, 5 Jan 2010 14:04:35 -0800 (PST)	[thread overview]
Message-ID: <004d01ca8e52$fd973c90$f8c5b5b0$@com> (raw)

Hi,
This patch makes sequoia board USB ehci working.

The problem seems to be when doing port reset (see ehci-hcd.c), the reset
is not terminated. EHCI spec says "A host controller must terminate the
reset and stabilize the state of the port within 2 milliseconds".

This is only tested on Sequoia board (with USB mass storage devices).

cheers,
Chris Zhang

diff --git a/drivers/usb/host/ehci-ppc4xx.c
b/drivers/usb/host/ehci-ppc4xx.c
new file mode 100644
index 0000000..9a23509
--- /dev/null
+++ b/drivers/usb/host/ehci-ppc4xx.c
@@ -0,0 +1,29 @@
+/* Code derived from ehci-fsl.c */
+
+#include <common.h>
+#include <usb.h>
+
+#include "ehci.h"
+#include "ehci-core.h"
+
+/*
+ * Create the appropriate control structures to manage
+ * a new EHCI host controller.
+ */
+int ehci_hcd_init(void)
+{
+       hccr = (struct ehci_hccr *)(0xe0000300);
+       hcor = (struct ehci_hcor *)((uint32_t) hccr +
+               HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+       usb_dev_init();
+       return 0;
+}
+
+/*
+ * Destroy the appropriate control structures corresponding
+ * the the EHCI host controller.
+ */
+int ehci_hcd_stop(void)
+{
+       return 0;
+}
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 940d4a8..255679a 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -36,6 +36,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 # echi
 COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
 COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
+COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
 COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
 COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index ba85991..fabd68a 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -708,6 +708,9 @@ ehci_submit_root(struct usb_device *dev, unsigned long
pipe,
 void *buffer,
                                 * root
                                 */
                                wait_ms(50);
+                               /* clear port reset */
+                               ehci_writel(status_reg, reg &
~EHCI_PS_PR);
+                               wait_ms(2);
                                portreset |= 1 << le16_to_cpu(req->index);
                        }
                        break;
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index 5788d58..e31e3f3 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -282,8 +282,8 @@

 /* USB */
 #ifdef CONFIG_440EPX
+#if 0  /* Enable this for OHCI */
 #define CONFIG_USB_OHCI_NEW
-#define CONFIG_USB_STORAGE
 #define CONFIG_SYS_OHCI_BE_CONTROLLER

 #undef CONFIG_SYS_USB_OHCI_BOARD_INIT
@@ -291,7 +291,16 @@
 #define CONFIG_SYS_USB_OHCI_REGS_BASE  CONFIG_SYS_USB_HOST
 #define CONFIG_SYS_USB_OHCI_SLOT_NAME  "ppc440"
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
+#else  /* EHCI */
+
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_PPC4XX
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_EHCI_MMIO_BIG_ENDIAN
+#define CONFIG_EHCI_DESC_BIG_ENDIAN
+#endif

+#define CONFIG_USB_STORAGE
 /* Comment this out to enable USB 1.1 device */
 #define USB_2_0_DEVICE

@@ -500,4 +509,10 @@
 #define CONFIG_CMD_BMP
 #endif

+/*
+ * Enable this only when you want EHCI.
+ */
+#if 1
+#endif
+
 #endif /* __CONFIG_H */

             reply	other threads:[~2010-01-05 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 22:04 Chris Zhang [this message]
2010-01-06  5:44 ` [U-Boot] ppc440epx(sequoia) USB ehci fix Stefan Roese

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='004d01ca8e52$fd973c90$f8c5b5b0$@com' \
    --to=chris@seamicro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.