aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>2011-07-23 21:44:44 -0600
committerJohn Rigby <john.rigby@linaro.org>2011-09-23 07:10:40 -0600
commit6ace48edbd39efe2b4a211cb119996c20f4b7918 (patch)
treea592619ae8710000a22857e23f5b5ab0994a52c6
parent4e85cfe4f6cb3aab0911ff404f196881c7f2f9dd (diff)
downloadu-boot-linaro-stable-6ace48edbd39efe2b4a211cb119996c20f4b7918.tar.gz
omap4_panda: add support for EHCI
Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
-rw-r--r--board/ti/panda/Makefile4
-rw-r--r--board/ti/panda/ehci-panda.c59
2 files changed, 62 insertions, 1 deletions
diff --git a/board/ti/panda/Makefile b/board/ti/panda/Makefile
index 09f88ee86..d48d1a208 100644
--- a/board/ti/panda/Makefile
+++ b/board/ti/panda/Makefile
@@ -25,8 +25,10 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).o
+COBJS-$(CONFIG_USB_EHCI) += ehci-panda.o
+
ifndef CONFIG_SPL_BUILD
-COBJS := panda.o
+COBJS := $(COBJS-y) panda.o
endif
SRCS := $(COBJS:.o=.c)
diff --git a/board/ti/panda/ehci-panda.c b/board/ti/panda/ehci-panda.c
new file mode 100644
index 000000000..0c97bc195
--- /dev/null
+++ b/board/ti/panda/ehci-panda.c
@@ -0,0 +1,59 @@
+/*
+ * OMAP4 EHCI port, copied from linux/drivers/usb/host/ehci-omap.c
+ *
+ * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Author: Vikram Pandita <vikram.pandita@ti.com>
+ * Author: Anand Gadiyar <gadiyar@ti.com>
+ */
+
+#include <asm/omap_gpio.h>
+#include <asm/arch/ehci.h>
+
+#define GPIO_HUB_POWER 1
+#define GPIO_HUB_NRESET 62
+
+int ehci_hcd_init(void)
+{
+ unsigned long base = get_timer(0);
+ unsigned reg = 0, port = 0;
+ int rc;
+
+ /* disable the power to the usb hub prior to init */
+ rc = gpio_request(GPIO_HUB_POWER, "");
+ if (rc < 0) {
+ printf("Could not request gpio %d\n", GPIO_HUB_POWER);
+ return rc;
+ }
+
+ rc = gpio_request(GPIO_HUB_NRESET, "");
+ if (rc < 0) {
+ printf("Could not request gpio %d\n", GPIO_HUB_NRESET);
+ gpio_free(GPIO_HUB_POWER);
+ return rc;
+ }
+
+ gpio_direction_output(GPIO_HUB_POWER);
+ gpio_set_value(GPIO_HUB_POWER, 0);
+ gpio_direction_output(GPIO_HUB_NRESET);
+ gpio_set_value(GPIO_HUB_NRESET, 0);
+ gpio_set_value(GPIO_HUB_NRESET, 1);
+
+ rc = omap4_ehci_hcd_init();
+
+ if (rc < 0)
+ return rc;
+
+ gpio_set_value(GPIO_HUB_POWER, 1);
+
+ return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+ omap4_ehci_hcd_stop();
+
+ gpio_set_value(GPIO_HUB_POWER, 0);
+ gpio_set_value(GPIO_HUB_NRESET, 0);
+ gpio_free(GPIO_HUB_POWER);
+ gpio_free(GPIO_HUB_NRESET);
+}