All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ley Foon Tan <lftan.linux@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver
Date: Wed, 15 Aug 2018 18:22:02 +0800	[thread overview]
Message-ID: <CAFiDJ5_ZNuoL-jv_KPf2TtYNfShdBhV14Ks+cRG=cehyYx4W+Q@mail.gmail.com> (raw)
In-Reply-To: <e90aec31-986e-dbf7-8a88-059343d0848d@denx.de>

On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex@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@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(&regs->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

      reply	other threads:[~2018-08-15 10:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15 18:01 [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top Ley Foon Tan
2018-08-15 10:13 ` Marek Vasut
2018-08-15 10:28   ` Ley Foon Tan
2018-08-15 10:31     ` Marek Vasut
2018-08-15 10:37       ` Ley Foon Tan
2018-08-15 18:01 ` [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver Ley Foon Tan
2018-08-15 10:13   ` Marek Vasut
2018-08-15 10:22     ` Ley Foon Tan [this message]

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='CAFiDJ5_ZNuoL-jv_KPf2TtYNfShdBhV14Ks+cRG=cehyYx4W+Q@mail.gmail.com' \
    --to=lftan.linux@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.