summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2015-02-21 22:01:09 -0500
committerTom Rini <trini@ti.com>2015-02-21 22:01:09 -0500
commitded4bc3a8ba6e96811f761b358b4c628ec927ade (patch)
treec20e768fb197b86dfdff5dad53c5530217fafdae /drivers/usb
parent46414296953410706e917cef9238926084e83a4b (diff)
parent77ef136950b4649ff4844c3b72dab107a9c565a0 (diff)
downloadu-boot-imx-ded4bc3a8ba6e96811f761b358b4c628ec927ade.zip
u-boot-imx-ded4bc3a8ba6e96811f761b358b4c628ec927ade.tar.gz
u-boot-imx-ded4bc3a8ba6e96811f761b358b4c628ec927ade.tar.bz2
Merge git://git.denx.de/u-boot-sunxi
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb-new/sunxi.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 4646a3d..fe45db1 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -22,7 +22,9 @@
*/
#include <common.h>
#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
#include <asm/arch/usbc.h>
+#include <asm-generic/gpio.h>
#include "linux-compat.h"
#include "musb_core.h"
@@ -224,6 +226,33 @@ static int sunxi_musb_init(struct musb *musb)
pr_debug("%s():\n", __func__);
+ if (is_host_enabled(musb)) {
+ int vbus_det = sunxi_name_to_gpio(CONFIG_USB0_VBUS_DET);
+ if (vbus_det == -1) {
+ eprintf("Error invalid Vusb-det pin\n");
+ return -EINVAL;
+ }
+
+ err = gpio_request(vbus_det, "vbus0_det");
+ if (err)
+ return err;
+
+ err = gpio_direction_input(vbus_det);
+ if (err) {
+ gpio_free(vbus_det);
+ return err;
+ }
+
+ err = gpio_get_value(vbus_det);
+ if (err) {
+ eprintf("Error: A charger is plugged into the OTG\n");
+ gpio_free(vbus_det);
+ return -EIO;
+ }
+
+ gpio_free(vbus_det);
+ }
+
err = sunxi_usbc_request_resources(0);
if (err)
return err;