[U-Boot] [PATCH 4/4] rk3036: enable the vbus regulator when borad_init

Simon Glass sjg at chromium.org
Fri Nov 11 17:17:06 CET 2016


Hi Kever,

On 8 November 2016 at 03:13, Kever Yang <kever.yang at rock-chips.com> wrote:
> enable the vbus for usb host in board_init().

Note 'borad_init' typo in subject.

>
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> ---
>
>  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
> index bf2b268..90d3d33 100644
> --- a/arch/arm/mach-rockchip/rk3036-board.c
> +++ b/arch/arm/mach-rockchip/rk3036-board.c
> @@ -16,6 +16,7 @@
>  #include <asm/arch/sdram_rk3036.h>
>  #include <asm/gpio.h>
>  #include <dm/pinctrl.h>
> +#include <power/regulator.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -57,7 +58,26 @@ int board_late_init(void)
>
>  int board_init(void)
>  {
> +       int ret;
> +       struct udevice *regulator;
> +
> +       ret = regulator_get_by_platname("vcc5v0_host", &regulator);

Can this be done in the USB driver? Then you might be able to use
device_get_supply_regulator().

In fact it looks like board_usb_init() should move into a driver.


> +       if (ret) {
> +               printf("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
> +               goto out;
> +       }
> +
> +       ret = regulator_set_enable(regulator, true);
> +       if (ret) {
> +               printf("%s vcc5v0-host enable fail!\n", __func__);
> +               goto out;
> +       }
> +
>         return 0;
> +out:
> +       printf("%s board ini error %x\n", __func__, ret);
> +
> +       return ret;
>  }
>
>  int dram_init(void)
> --
> 1.9.1
>


More information about the U-Boot mailing list