board: evb-rk3399: enable usb 2.0 host vbus power on board_init
[oweals/u-boot.git] / 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;
 }