public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Roger Quadros <rogerq@ti.com>, John Youn <John.Youn@synopsys.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	John Stultz <john.stultz@linaro.org>,
	Wesley Cheng <wcheng@codeaurora.org>,
	Ferry Toth <fntoth@gmail.com>, Yu Chen <chenyu56@huawei.com>
Subject: Re: [PATCH] usb: dwc3: core: Do core softreset when switch mode
Date: Thu, 15 Apr 2021 09:53:38 +0200	[thread overview]
Message-ID: <YHfxAnbHNrjSwLE+@kroah.com> (raw)
In-Reply-To: <c125a30b-edde-8fe5-3370-d9e62a24f7e9@synopsys.com>

On Thu, Apr 15, 2021 at 07:10:34AM +0000, Thinh Nguyen wrote:
> Felipe Balbi wrote:
> > 
> > Hi,
> > 
> > Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> >> From: Yu Chen <chenyu56@huawei.com>
> >> From: John Stultz <john.stultz@linaro.org>
> >>
> >> According to the programming guide, to switch mode for DRD controller,
> >> the driver needs to do the following.
> >>
> >> To switch from device to host:
> >> 1. Reset controller with GCTL.CoreSoftReset
> >> 2. Set GCTL.PrtCapDir(host mode)
> >> 3. Reset the host with USBCMD.HCRESET
> >> 4. Then follow up with the initializing host registers sequence
> >>
> >> To switch from host to device:
> >> 1. Reset controller with GCTL.CoreSoftReset
> >> 2. Set GCTL.PrtCapDir(device mode)
> >> 3. Reset the device with DCTL.CSftRst
> >> 4. Then follow up with the initializing registers sequence
> >>
> >> Currently we're missing step 1) to do GCTL.CoreSoftReset and step 3) of
> > 
> > we're not really missing, it was a deliberate choice :-) The only reason
> > why we need the soft reset is because host and gadget registers map to
> > the same physical space within dwc3 core. If we cache and restore the
> > affected registers, we're good ;-)
> 
> It's part of the programming model. I've already discussed with internal
> RTL designers. This is needed, and I've provided the discussion we had
> prior also. We have several different devices in the wild that need
> this. What is the concern?
> 
> > 
> > IMHO, that's a better compromise than doing a full soft reset.
> > 
> >> @@ -40,6 +41,8 @@
> >>  
> >>  #define DWC3_DEFAULT_AUTOSUSPEND_DELAY	5000 /* ms */
> >>  
> >> +static DEFINE_MUTEX(mode_switch_lock);
> > 
> > there are several platforms which more than one DWC3 instance. Sure this
> > won't break on such systems?
> > 
> 
> How? Am I missing something? Please let me know so I can make the change.

All data needs to be per-device, not "global for the codebase" like the
way you declared this lock.

thanks,

greg k-h

  reply	other threads:[~2021-04-15  7:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15  2:23 [PATCH] usb: dwc3: core: Do core softreset when switch mode Thinh Nguyen
2021-04-15  6:23 ` Felipe Balbi
2021-04-15  7:10   ` Thinh Nguyen
2021-04-15  7:53     ` Greg Kroah-Hartman [this message]
2021-04-15  8:04       ` Thinh Nguyen
2021-04-15 10:45     ` Felipe Balbi
2021-04-15 14:57       ` Thinh Nguyen
2021-04-15 22:31         ` Thinh Nguyen
2021-04-15 16:29 ` [PATCH v2] " Thinh Nguyen
2021-04-15 19:54   ` John Stultz
2021-04-15 20:11     ` Thinh Nguyen
2021-04-15 22:20   ` [PATCH v3] " Thinh Nguyen
2021-04-15 22:23     ` Thinh Nguyen
2021-04-16 21:17       ` Ferry Toth
2021-04-17  2:27         ` Thinh Nguyen
2021-04-17 14:22           ` Ferry Toth
2021-04-17 16:32             ` Ferry Toth
2021-04-18 23:03               ` Thinh Nguyen
2021-04-19  8:43                 ` Andy Shevchenko
2021-04-19 20:24                   ` Ferry Toth
2021-04-19  9:47                 ` Felipe Balbi
2021-04-19 20:15                 ` Ferry Toth
2021-04-19 21:23                   ` Thinh Nguyen
2021-04-20 19:55                     ` Ferry Toth
2021-04-21 19:01                       ` Thinh Nguyen
2021-04-21 22:30                         ` Ferry Toth
2021-04-22 20:55                         ` Ferry Toth
2021-04-22 21:58                           ` Thinh Nguyen
2021-04-23  7:18                             ` Ferry Toth
2021-04-16  0:12     ` John Stultz
2021-04-16  3:28       ` John Stultz
2021-04-16  9:10         ` Ferry Toth
2021-04-16 10:47     ` Felipe Balbi
2021-04-16 19:05       ` Wesley Cheng
2021-04-16 19:38       ` John Stultz
2021-04-16 19:49         ` Thinh Nguyen
2021-04-16 21:08           ` John Stultz
2021-04-17  6:25             ` Felipe Balbi
2021-04-19 19:49               ` Thinh Nguyen
2021-04-19 21:26     ` Wesley Cheng

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=YHfxAnbHNrjSwLE+@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=John.Youn@synopsys.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=balbi@kernel.org \
    --cc=chenyu56@huawei.com \
    --cc=fntoth@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rogerq@ti.com \
    --cc=stable@vger.kernel.org \
    --cc=wcheng@codeaurora.org \
    /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