[U-Boot] [PATCH 3/3] omap4_panda: add support for EHCI
Gilles Chanteperdrix
gilles.chanteperdrix at xenomai.org
Mon May 9 23:04:51 CEST 2011
Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix at xenomai.org>
---
board/ti/panda/Makefile | 4 ++-
board/ti/panda/ehci-panda.c | 59 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletions(-)
create mode 100644 board/ti/panda/ehci-panda.c
diff --git a/board/ti/panda/Makefile b/board/ti/panda/Makefile
index 2186403..253567c 100644
--- a/board/ti/panda/Makefile
+++ b/board/ti/panda/Makefile
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).o
-COBJS := panda.o
+COBJS-$(CONFIG_USB_EHCI) += ehci-panda.o
+
+COBJS := $(COBJS-y) panda.o
SRCS := $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
diff --git a/board/ti/panda/ehci-panda.c b/board/ti/panda/ehci-panda.c
new file mode 100644
index 0000000..b1e247c
--- /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 at ti.com>
+ * Author: Anand Gadiyar <gadiyar at ti.com>
+ */
+
+#include <asm/arch/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 = omap_request_gpio(GPIO_HUB_POWER);
+ if (rc < 0) {
+ printf("Could not request gpio %d\n", GPIO_HUB_POWER);
+ return rc;
+ }
+
+ rc = omap_request_gpio(GPIO_HUB_NRESET);
+ if (rc < 0) {
+ printf("Could not request gpio %d\n", GPIO_HUB_NRESET);
+ omap_free_gpio(GPIO_HUB_POWER);
+ return rc;
+ }
+
+ omap_set_gpio_direction(GPIO_HUB_POWER, 0);
+ omap_set_gpio_dataout(GPIO_HUB_POWER, 0);
+ omap_set_gpio_direction(GPIO_HUB_NRESET, 0);
+ omap_set_gpio_dataout(GPIO_HUB_NRESET, 0);
+ omap_set_gpio_dataout(GPIO_HUB_NRESET, 1);
+
+ rc = omap4_ehci_hcd_init();
+
+ if (rc < 0)
+ return rc;
+
+ omap_set_gpio_dataout(GPIO_HUB_POWER, 1);
+
+ return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+ omap4_ehci_hcd_stop();
+
+ omap_set_gpio_dataout(GPIO_HUB_POWER, 0);
+ omap_set_gpio_dataout(GPIO_HUB_NRESET, 0);
+ omap_free_gpio(GPIO_HUB_POWER);
+ omap_free_gpio(GPIO_HUB_NRESET);
+}
--
1.7.2.5
More information about the U-Boot
mailing list