board: evb-rk3399: enable usb 2.0 host vbus power on board_init
authorKever Yang <kever.yang@rock-chips.com>
Wed, 24 Aug 2016 04:02:22 +0000 (12:02 +0800)
committerSimon Glass <sjg@chromium.org>
Thu, 22 Sep 2016 13:56:51 +0000 (07:56 -0600)
rk3399 using one gpio control signal for two usb 2.0 host port,
it's better to enable the power in board file instead of in usb driver.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>
board/rockchip/evb_rk3399/evb-rk3399.c

index d39427671ce4e423b045a874ed696926ba21f856..2580b389ac595f7fe72a61b1e7770f64da38b62e 100644 (file)
@@ -7,12 +7,13 @@
 #include <dm.h>
 #include <dm/pinctrl.h>
 #include <asm/arch/periph.h>
+#include <power/regulator.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-       struct udevice *pinctrl;
+       struct udevice *pinctrl, *regulator;
        int ret;
 
        /*
@@ -38,6 +39,18 @@ int board_init(void)
                goto out;
        }
 
+       ret = regulator_get_by_platname("vcc5v0_host", &regulator);
+       if (ret) {
+               debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
+               goto out;
+       }
+
+       ret = regulator_set_enable(regulator, true);
+       if (ret) {
+               debug("%s vcc5v0-host-en set fail!\n", __func__);
+               goto out;
+       }
+
 out:
        return 0;
 }