Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3522507pxj; Tue, 15 Jun 2021 02:49:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzetKsbMj+/vLYw7KLlsXLtWAcKAgbE3qxpgjbuVdZ46qjb2819e7F5IOABTiryqFeDobqf X-Received: by 2002:a92:dd89:: with SMTP id g9mr17386374iln.209.1623750569941; Tue, 15 Jun 2021 02:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623750569; cv=none; d=google.com; s=arc-20160816; b=04KijDNNzeFSKQe8exnV5I2Cgpnyq2TqKG/reUy4gtial0ipLUSS+RLjH6TYqr5nH5 ydYqNfU0K1LwKkM8ATlU2JOMUnsqsbPyCCp2A/tiSkNnb+gDbO8hchJVGQ2/NGe3l7VM 4ti+eGw753bpuGDk+qiK34HhxQQiPDPz4VqLUYi+jMEimNTykgWjTPmTY4Xow2m0+C5u KmIPmAJJzXHROoejbZfegl8Guvq9/ogA9BIyt1t1ipFv6uYN3/RDFyKi4NbMddPGZd9j NbSZl4WWX2g+Zqh1Ge3GXnPZrywlKtLuwxiojnCKyDSHyi6F5zbSnwBF4hASHkZAzhCb 4kCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VCxWWaB4LXcrRsZdNmU7VoLcp8uZpmXFfHS2YUFDIjc=; b=OiPRRu5mYk5hvq3T8dblFXxko+pQOcaOek0ffcpp5aTuwwzOIvLoDmjzOabgZ/tRBx r1rHx0kj+G2LJj7pvve/B/oZ9xWkUMtv52gKX/0pW84NpqoDlo13o+datWd93hh+Lm9f HcI8MpGBhTd/knXapLTtCj6sGv7zyYwTmFoX58QViEmDexCkjPZRpMdfFWVSIOq8DuAA MncZGzE0JRkkV8x6EKtanGxV+fmqTxB3TT0+vR3C/uTxH9rLVFjwiWONcAebHyQwaRZW lbsQYEfKLJYeW2oi+vT2LjIN/pQRy4/r1G9bN8aKyCeGn1BNxWv1RvxOFC0eRd0MCtCY p4pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRZnTxTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si19088354jat.51.2021.06.15.02.49.18; Tue, 15 Jun 2021 02:49:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRZnTxTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbhFOJuj (ORCPT + 99 others); Tue, 15 Jun 2021 05:50:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:58936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231288AbhFOJuh (ORCPT ); Tue, 15 Jun 2021 05:50:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F04E60FEA; Tue, 15 Jun 2021 09:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623750512; bh=BHOqM+Yiul7dkQgHlYqkUtja30szDgou1/4wsvKxQqw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YRZnTxTlaMoEL+P95vx6QPW55SN99t+27Xon72wh+kWEJ6DM2mjDPWGCRmmHy66xJ vvz8yU3Gha+pgE3VLLE6S+XNGeMUpbNuN851wX2/BhEBL0I0wdosCVvymMyNJm0HHR CbZ35O5q29Podq/G65aBcR3jCY0faqAFzG474iIo= Date: Tue, 15 Jun 2021 11:48:30 +0200 From: Greg KH To: Paul Cercueil Cc: =?utf-8?B?5ZGo55Cw5p2w?= , 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 =?utf-8?B?xIxlxI1hdmFj?= Subject: Re: [PATCH] USB: DWC2: Add VBUS overcurrent detection control. Message-ID: References: <1616513066-62025-1-git-send-email-zhouyanjie@wanyeetech.com> <20210615161456.2dd501a1@zhouyanjie-virtual-machine> <8BJQUQ.QJOE5WOSWVBU@opendingux.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8BJQUQ.QJOE5WOSWVBU@opendingux.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 15, 2021 at 09:52:20AM +0100, Paul Cercueil wrote: > Hi Zhou, > > Le mar., juin 15 2021 at 16:16:39 +0800, 周琰杰 > a écrit : > > Hi Greg, > > > > Sorry for taking so long to reply. > > > > 于 Tue, 23 Mar 2021 16:31:29 +0100 > > Greg KH 写道: > > > > > 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) > > > > Signed-off-by: Dragan Čečavac > > > > --- > > > > 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. > > This could still be enabled at runtime, though, via a module parameter. > Leave it enabled by default, and those who want to disable it can do it. This is not the 1990's, please NEVER add new module parameters, especially ones that are somehow supposed to be device-specific. Remember, module options are code-wide, not device-specific. Just do this based on the device type, or something else dynamic, do NOT make this be forced to be selected by a kernel configuration option or a random module option at runtime. thanks, greg k-h