mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: 周琰杰 <zhouyanjie@wanyeetech.com>
Cc: hminas@synopsys.com, paul@crapouillou.net,
	linux-mips@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, dongsheng.qiu@ingenic.com,
	aric.pzqi@ingenic.com, sernia.zhou@foxmail.com,
	"Dragan Čečavac" <dragancecavac@yahoo.com>
Subject: Re: [PATCH] USB: DWC2: Add VBUS overcurrent detection control.
Date: Tue, 15 Jun 2021 11:46:59 +0200	[thread overview]
Message-ID: <YMh3Ezr86NLPH+Aj@kroah.com> (raw)
In-Reply-To: <20210615161456.2dd501a1@zhouyanjie-virtual-machine>

On Tue, Jun 15, 2021 at 04:16:39PM +0800, 周琰杰 wrote:
> Hi Greg,
> 
> Sorry for taking so long to reply.
> 
> 于 Tue, 23 Mar 2021 16:31:29 +0100
> Greg KH <gregkh@linuxfoundation.org> 写道:
> 
> > On Tue, Mar 23, 2021 at 11:24:26PM +0800, 周琰杰 (Zhou Yanjie) wrote:
> > > Introduce configurable option for enabling GOTGCTL register
> > > bits VbvalidOvEn and VbvalidOvVal. Once selected it disables
> > > VBUS overcurrent detection.
> > > 
> > > This patch is derived from Dragan Čečavac (in the kernel 3.18
> > > tree of CI20). It is very useful for the MIPS Creator CI20(r1).
> > > Without this patch, CI20's OTG port has a great probability to
> > > face overcurrent warning, which breaks the OTG functionality.
> > > 
> > > Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
> > > Signed-off-by: Dragan Čečavac <dragancecavac@yahoo.com>
> > > ---
> > >  drivers/usb/dwc2/Kconfig | 6 ++++++
> > >  drivers/usb/dwc2/core.c  | 9 +++++++++
> > >  2 files changed, 15 insertions(+)
> > > 
> > > diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> > > index c131719..e40d187 100644
> > > --- a/drivers/usb/dwc2/Kconfig
> > > +++ b/drivers/usb/dwc2/Kconfig
> > > @@ -94,4 +94,10 @@ config USB_DWC2_DEBUG_PERIODIC
> > >  	  non-periodic transfers, but of course the debug logs
> > > will be incomplete. Note that this also disables some debug messages
> > >  	  for which the transfer type cannot be deduced.
> > > +
> > > +config USB_DWC2_DISABLE_VOD
> > > +	bool "Disable VBUS overcurrent detection"
> > > +	help
> > > +	  Say Y here to switch off VBUS overcurrent detection. It
> > > enables USB
> > > +	  functionality blocked by overcurrent detection.  
> > 
> > Why would this be a configuration option?  Shouldn't this be dynamic
> > and just work properly automatically?
> > 
> > You should not have to do this on a build-time basis, it should be
> > able to be detected and handled properly at run-time for all devices.
> > 
> 
> I consulted the original author Dragan Čečavac, he think since this is
> a feature which disables overcurrent detection, so we are not sure if
> it could be harmful for some devices. Therefore he advise against
> enabling it in runtime, and in favor that user explicitely has to
> enable it.

That will not work AT ALL for systems that build a generic kernel for
multiple devices (i.e. Android kernels), so please make this a runtime
determination based on the hardware capabilities.

> > If you know this is needed for a specific type of device, detect it
> > and make the change then, otherwise this could break working systems,
> > right?
> 
> According to the information provided by Dragan Čečavac, this function
> (select whether to enable over-current detection through the otgctl
> register) don't seem to be available for all dwc2 controllers, so it
> might make sense to add MACH_INGENIC dependency to
> USB_DWC2_DISABLE_VOD, which could provide additional protection from
> unwanted usage.

Again, make this dynamic and only happen for devices that know it will
work on, based on some hardware information (device type of DT value).
Do not make this happen based on a Kconfig option.

thanks,

greg k-h

      parent reply	other threads:[~2021-06-15  9:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 15:24 周琰杰 (Zhou Yanjie)
2021-03-23 15:31 ` Greg KH
2021-06-15  8:16   ` 周琰杰
2021-06-15  8:52     ` Paul Cercueil
2021-06-15  9:14       ` 周琰杰
2021-06-15  9:48       ` Greg KH
2021-06-15 10:06         ` Paul Cercueil
2021-06-15  9:46     ` Greg KH [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=YMh3Ezr86NLPH+Aj@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=aric.pzqi@ingenic.com \
    --cc=dongsheng.qiu@ingenic.com \
    --cc=dragancecavac@yahoo.com \
    --cc=hminas@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=sernia.zhou@foxmail.com \
    --cc=zhouyanjie@wanyeetech.com \
    /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

all inboxes | Powered by JetHome®