public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] rk3036: enable the vbus regulator when borad_init
Date: Mon, 14 Nov 2016 18:07:17 +0800	[thread overview]
Message-ID: <58298CD5.8000608@rock-chips.com> (raw)
In-Reply-To: <CAPnjgZ0QfOW8F95MJFT1fvDz-ZfG7RHJtNL=3PpF0t-FBir5Hg@mail.gmail.com>

Hi Simon,

On 11/12/2016 12:17 AM, Simon Glass wrote:
> Hi Kever,
>
> On 8 November 2016 at 03:13, Kever Yang <kever.yang@rock-chips.com> wrote:
>> enable the vbus for usb host in board_init().
> Note 'borad_init' typo in subject.

Will fix in next version.
>
>> Signed-off-by: Kever Yang <kever.yang@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 dwc2 controller, there do have a bit for host power to control a signal
named HOST_DRV_VBUS and init at dwc_otg_core_host_init(), but we do not
using that controller signal, and using a GPIO instead, which may be 
different
in different board, so we usually enable it in board file.

Let me have a try if we can move it to USB driver.

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

We are not using board_usb_init() for usb host now, this function is 
only used
for usb gadget/udc.

Thanks,
- Kever
>
>
>> +       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
>>
>
>

  reply	other threads:[~2016-11-14 10:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 10:13 [U-Boot] [PATCH 0/4] enable the host controller for rk3036 Kever Yang
2016-11-08 10:13 ` [U-Boot] [PATCH 1/4] config: rk3036: enable configs for USB HOST Kever Yang
2016-11-11 16:16   ` Simon Glass
2016-11-25 19:38     ` Simon Glass
2016-11-08 10:13 ` [U-Boot] [PATCH 2/4] config: rk3036: enable fix regulator Kever Yang
2016-11-11 16:17   ` Simon Glass
2016-11-25 19:38     ` Simon Glass
2016-11-08 10:13 ` [U-Boot] [PATCH 3/4] dts: arm: rk3036: add usb vbus node Kever Yang
2016-11-11 16:17   ` Simon Glass
2016-11-25 19:38     ` Simon Glass
2016-11-08 10:13 ` [U-Boot] [PATCH 4/4] rk3036: enable the vbus regulator when borad_init Kever Yang
2016-11-11 16:17   ` Simon Glass
2016-11-14 10:07     ` Kever Yang [this message]
2016-11-14 20:44       ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58298CD5.8000608@rock-chips.com \
    --to=kever.yang@rock-chips.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox