[U-Boot] [RESEND PATCH v4] usb: dwc2: add support for external vbus supply
Marek Vasut
marex at denx.de
Fri Mar 10 04:50:10 UTC 2017
On 03/10/2017 05:02 AM, Kever Yang wrote:
> Hi Marek,
>
> On 03/10/2017 10:16 AM, Marek Vasut wrote:
>> On 03/07/2017 07:50 AM, Kever Yang wrote:
>>> Hi Marek,
>>>
>>> On 03/07/2017 10:55 AM, Marek Vasut wrote:
>>>> On 03/06/2017 01:54 PM, Kever Yang wrote:
>>>>> Some board do not use the dwc2 internal VBUS_DRV signal, but
>>>>> use a gpio pin to enable the 5.0V VBUS power, add interface to
>>>>> enable the power in dwc2 driver.
>>>>>
>>>>> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
>>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>>> ---
>>>>>
>>>>> Changes in v4:
>>>>> - Drop no use code comment by Marek.
>>>>>
>>>>> Changes in v3:
>>>>> - Drop use of static variable
>>>>>
>>>>> drivers/usb/host/dwc2.c | 37 ++++++++++++++++++++++++++++++++-----
>>>>> 1 file changed, 32 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>>>>> index d253b94..5ac602e 100644
>>>>> --- a/drivers/usb/host/dwc2.c
>>>>> +++ b/drivers/usb/host/dwc2.c
>>>>> @@ -15,6 +15,7 @@
>>>>> #include <usbroothubdes.h>
>>>>> #include <wait_bit.h>
>>>>> #include <asm/io.h>
>>>>> +#include <power/regulator.h>
>>>>>
>>>>> #include "dwc2.h"
>>>>>
>>>>> @@ -159,6 +160,27 @@ static void dwc_otg_core_reset(struct
>>>>> dwc2_core_regs *regs)
>>>>> mdelay(100);
>>>>> }
>>>> Nit:
>>>>
>>>> add the ifdef around the function, ie.
>>> I don't understand what to do here, we already have
>>> "#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)"
>>> in the function, do you mean move this out of the function or
>>> do you need add any other MACRO?
>> The example of what you should do is right below
>
> Thanks for your example, I just don't understand why do you think add
> the ifdef
> around the function is better than inside the function? Does this a rule
> in U-Boot?
It's more readable, you can clearly tell that the whole function is
conditionally compiled in. (and it's consistent with the rest of the
codebase)
--
Best regards,
Marek Vasut
More information about the U-Boot
mailing list