[U-Boot] [PATCH v2] usb: dwc2: Add reset ctrl to driver

Marek Vasut marex at denx.de
Thu Aug 16 09:51:34 UTC 2018


On 08/16/2018 11:48 AM, Ley Foon Tan wrote:
> On Thu, Aug 16, 2018 at 5:21 PM, Marek Vasut <marex at denx.de> wrote:
>> On 08/16/2018 11:18 AM, Ley Foon Tan wrote:
>>> On Thu, Aug 16, 2018 at 4:26 PM, Marek Vasut <marex at denx.de> wrote:
>>>> On 08/16/2018 07:45 AM, Ley Foon Tan wrote:
>>>>> Add code to reset all reset signals as in usb DT node. A reset property
>>>>> is an optional feature, so only print out a warning and do not fail if a
>>>>> reset property is not present.
>>>>>
>>>>> If a reset property is discovered, then use it to deassert, thus
>>>>> bringing the IP out of reset.
>>>>>
>>>>> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
>>>>>
>>>>> ---
>>>>> v2:
>>>>> - Assert reset when .remove.
>>>>> ---
>>>>>  drivers/usb/host/dwc2.c | 31 +++++++++++++++++++++++++++++++
>>>>>  1 file changed, 31 insertions(+)
>>>>>
>>>>> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>>>>> index cbe065b..bee3b33 100644
>>>>> --- a/drivers/usb/host/dwc2.c
>>>>> +++ b/drivers/usb/host/dwc2.c
>>>>> @@ -15,6 +15,7 @@
>>>>>  #include <wait_bit.h>
>>>>>  #include <asm/io.h>
>>>>>  #include <power/regulator.h>
>>>>> +#include <reset.h>
>>>>>
>>>>>  #include "dwc2.h"
>>>>>
>>>>> @@ -49,6 +50,8 @@ struct dwc2_priv {
>>>>>        */
>>>>>       bool hnp_srp_disable;
>>>>>       bool oc_disable;
>>>>> +
>>>>> +     struct reset_ctl_bulk   resets;
>>>>>  };
>>>>>
>>>>>  #ifndef CONFIG_DM_USB
>>>>> @@ -1124,11 +1127,37 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
>>>>>       }
>>>>>  }
>>>>>
>>>>> +static int dwc2_reset(struct udevice *dev)
>>>>> +{
>>>>> +     int ret;
>>>>> +     struct dwc2_priv *priv = dev_get_priv(dev);
>>>>> +
>>>>> +     ret = reset_get_bulk(dev, &priv->resets);
>>>>> +     if (ret) {
>>>>> +             dev_warn(dev, "Can't get reset: %d\n", ret);
>>>>
>>>> So this now generates a ton of warnings on Gen5 , right ?
>>>> Did you test it on any Gen5 board recently ?
>>>
>>> Will change to "return 0" if can't find reset in dts, so it will not
>>> fail the probe.
>>
>> But that's a valid error. Maybe some ifdef CONFIG_RESET would be more
>> appropriate ? Look at what the other drivers do.
> Platforms that doesn't support reset framework shouldn't treat it as error.
> Other drivers don't have CONFIG_RESET too.

What about platforms that do have reset and fail requesting it ? The
error would be ignored on those ?

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list