summaryrefslogtreecommitdiffstats
path: root/board/compulab/common
diff options
context:
space:
mode:
authorIgor Grinberg <grinberg@compulab.co.il>2014-11-03 11:32:19 +0200
committerTom Rini <trini@ti.com>2014-11-06 11:04:40 -0500
commit959bc1d5fa83eab057f12cb5ef79bd37ec98eb83 (patch)
treef8480d45105bb2910684ffb7cb019457e4bd32ec /board/compulab/common
parenta937fd1682625b1f87b555e2af9117fcb2999d7c (diff)
downloadu-boot-959bc1d5fa83eab057f12cb5ef79bd37ec98eb83.tar.gz
u-boot-959bc1d5fa83eab057f12cb5ef79bd37ec98eb83.tar.xz
u-boot-959bc1d5fa83eab057f12cb5ef79bd37ec98eb83.zip
omap3: cm-t35: move the USB hub reset code
Extract the USB hub reset code to a common location where it can be reused by other compulab boards. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'board/compulab/common')
-rw-r--r--board/compulab/common/common.c22
-rw-r--r--board/compulab/common/common.h13
2 files changed, 35 insertions, 0 deletions
diff --git a/board/compulab/common/common.c b/board/compulab/common/common.c
index 6d2d7b0bd0..f2ce522fa6 100644
--- a/board/compulab/common/common.c
+++ b/board/compulab/common/common.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <asm/bootm.h>
+#include <asm/gpio.h>
#include "common.h"
#include "eeprom.h"
@@ -23,3 +24,24 @@ void cl_print_pcb_info(void)
printf("PCB: %u.%u\n", rev_major, rev_minor);
}
+
+#ifdef CONFIG_CMD_USB
+int cl_usb_hub_init(int gpio, const char *label)
+{
+ if (gpio_request(gpio, label)) {
+ printf("Error: can't obtain GPIO%d for %s", gpio, label);
+ return -1;
+ }
+
+ gpio_direction_output(gpio, 0);
+ udelay(10);
+ gpio_set_value(gpio, 1);
+ udelay(1000);
+ return 0;
+}
+
+void cl_usb_hub_deinit(int gpio)
+{
+ gpio_free(gpio);
+}
+#endif
diff --git a/board/compulab/common/common.h b/board/compulab/common/common.h
index 316ee4c6cd..ffe1ef8174 100644
--- a/board/compulab/common/common.h
+++ b/board/compulab/common/common.h
@@ -9,6 +9,19 @@
#ifndef _CL_COMMON_
#define _CL_COMMON_
+#include <asm/errno.h>
+
void cl_print_pcb_info(void);
+#ifdef CONFIG_CMD_USB
+int cl_usb_hub_init(int gpio, const char *label);
+void cl_usb_hub_deinit(int gpio);
+#else /* !CONFIG_CMD_USB */
+static inline int cl_usb_hub_init(int gpio, const char *label)
+{
+ return -ENOSYS;
+}
+static inline void cl_usb_hub_deinit(int gpio) {}
+#endif /* CONFIG_CMD_USB */
+
#endif /* _CL_COMMON_ */