[U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver
Ley Foon Tan
lftan.linux at gmail.com
Wed Aug 15 10:22:02 UTC 2018
On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex at denx.de> wrote:
> On 08/15/2018 08:01 PM, 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>
>> ---
>> drivers/usb/host/dwc2.c | 17 +++++++++++++++++
>> 1 file changed, 17 insertions(+)
>>
>> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>> index cbe065b..b77e0c6 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"
>>
>> @@ -1124,12 +1125,28 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
>> }
>> }
>>
>> +static void dwc2_reset(struct udevice *dev)
>> +{
>> + struct reset_ctl_bulk reset_bulk;
>> + int ret;
>> +
>> + ret = reset_get_bulk(dev, &reset_bulk);
>> + if (ret) {
>> + dev_warn(dev, "Can't get reset: %d\n", ret);
>> + return;
>> + }
>> +
>> + reset_deassert_bulk(&reset_bulk);
>> +}
>> +
>> static int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
>> {
>> struct dwc2_core_regs *regs = priv->regs;
>> uint32_t snpsid;
>> int i, j;
>>
>> + dwc2_reset(dev);
>> +
>> snpsid = readl(®s->gsnpsid);
>> dev_info(dev, "Core Release: %x.%03x\n",
>> snpsid >> 12 & 0xf, snpsid & 0xfff);
>>
>
> .remove() should assert the reset again.
Okay. Will add it.
Regards
Ley Foon
More information about the U-Boot
mailing list