Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3488139pxj; Tue, 15 Jun 2021 01:54:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy65Qc9+UD6hSYzXt6I6N6T0N5r7/MYsYHA5Wep5YNW29kAgshDA7B0+0e5MJ7u3j3+vLG/ X-Received: by 2002:a05:6402:40c3:: with SMTP id z3mr21719386edb.187.1623747285931; Tue, 15 Jun 2021 01:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623747285; cv=none; d=google.com; s=arc-20160816; b=Amp0qkkabmp+lsChXl984OJ8gZUxaocU/4r4EC/d8knlieHW3Jqt2RC2oCdFwl/md6 q/LUamtMTD1xq/c70OHoy8geuqMf6XNcWvvhwrYn89aiOk0rf3UoZpLX78bpKRjRKj63 tk3pdOP1blBYt0k+NhYxetZLvhJxskR/oCMySVQdCWuMwf0cqfn5GfjTiCXHZIF4OQ2o QZMeb5KL03POH8h2/cUKQck+LWlymcLJFH+3cbVCm9NV4j6yYZRSLWxKxN/xyg8nLtCW wxSK3+TwMYX+2qB4e9L0D6ckryH6NPTZRRgOLpJjbNFXgf5ej94DDxy3uiYrwEH/F9uH dmTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=y4ciBzdWryCO1TDR+M1h+MZSSZQWKo3h0AKLa2iLwQE=; b=OGIxBHI33wrfo8wdlaDfZdUBrF3xogeCk8E6F7bfomTiWC+RjNzUHXP3BsT/0JKEAz yasKvzit5vTXJ9/byrEk+akw+bzg9i+cBHQlH47KFBcOGCfpDRObHNQvaeYw2hyQqB2i eTE6rdXzR3+NJxwlrrnS7Tca5VX/eAU/YpbIjhKD3UpiOEvXamKBOmGKRSrrwpY1DGgJ zIrt5vLOIByDiCh3p6M/ywRWNkb/0y8e/yFt1qgaI2YE0AdXXZ52sc+i4YwOfflY0Lks G3kjVeTdSZLQeGzYcDkoMmhHNJ0qrI09reVK5OMF3xdkkL2DW0BQvdSENrdacn3TCom8 DQkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opendingux.net header.s=gm1 header.b=Sf3XuG7b; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si15984443ejr.586.2021.06.15.01.54.23; Tue, 15 Jun 2021 01:54:45 -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=@opendingux.net header.s=gm1 header.b=Sf3XuG7b; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbhFOIyy (ORCPT + 99 others); Tue, 15 Jun 2021 04:54:54 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:49379 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbhFOIyi (ORCPT ); Tue, 15 Jun 2021 04:54:38 -0400 Received: (Authenticated sender: paul@opendingux.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id E6FDF240008; Tue, 15 Jun 2021 08:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opendingux.net; s=gm1; t=1623747152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y4ciBzdWryCO1TDR+M1h+MZSSZQWKo3h0AKLa2iLwQE=; b=Sf3XuG7b1H/0obFq5OSYzSFjZYyzlBi0qG+c96CHfJ2GOJdwJMIGsRh1QtvKce5W6K1V2y x79Q53WCIUR0XSLBQFDHkVGnqZzFLXmCrUfxh/cr1fJx8wNw6tj6ZgHin/p498sPkODX2H 2BbnSRGKbxxwXTafjni8WAo3KUapP6+Eo8DbgOTwl3Fj/Qr8cFqzT1swnE+aJVpjuw61J+ NO2mxLERg8D2Ea+mR7cbACYTQ/HhcRwSrp41q7VURKkR33MJwajD66L8KMb1wgx/VC2vRA NzmweCQqGiFQ3zvdJIfubY/47D0GYrfcTLX1bFIMsxLbClXtDpOoe3q05eMUhA== Date: Tue, 15 Jun 2021 09:52:20 +0100 From: Paul Cercueil Subject: Re: [PATCH] USB: DWC2: Add VBUS overcurrent detection control. To: =?UTF-8?b?5ZGo55Cw5p2w?= Cc: Greg KH , 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 =?iso-8859-2?b?yGXoYXZhYw==?= Message-Id: <8BJQUQ.QJOE5WOSWVBU@opendingux.net> In-Reply-To: <20210615161456.2dd501a1@zhouyanjie-virtual-machine> References: <1616513066-62025-1-git-send-email-zhouyanjie@wanyeetech.com> <20210615161456.2dd501a1@zhouyanjie-virtual-machine> X-Mailer: geary/40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zhou, Le mar., juin 15 2021 at 16:16:39 +0800, =E5=91=A8=E7=90=B0=E6=9D=B0=20 a =C3=A9crit : > Hi Greg, >=20 > Sorry for taking so long to reply. >=20 > =E4=BA=8E Tue, 23 Mar 2021 16:31:29 +0100 > Greg KH =E5=86=99=E9=81=93: >=20 >> On Tue, Mar 23, 2021 at 11:24:26PM +0800, =E5=91=A8=E7=90=B0=E6=9D=B0 (= Zhou Yanjie)=20 >> 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 =C4=8Ce=C4=8Davac (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: =E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou Yanjie) >> > Signed-off-by: Dragan =C4=8Ce=C4=8Davac >> > --- >> > 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=20 >> 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. >>=20 >> Why would this be a configuration option? Shouldn't this be dynamic >> and just work properly automatically? >>=20 >> 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=20 >> devices. >>=20 >=20 > I consulted the original author Dragan =C4=8Ce=C4=8Davac, he think since = this=20 > 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.=20 Leave it enabled by default, and those who want to disable it can do it. Also, overcurrent detection is just "detection", so enabling or=20 disabling it won't change the fact that you can get overcurrent=20 conditions, right? -Paul >> If you know this is needed for a specific type of device, detect it >> and make the change then, otherwise this could break working=20 >> systems, >> right? >=20 > According to the information provided by Dragan =C4=8Ce=C4=8Davac, this=20 > 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. >=20 > Thanks and best regards! >=20 >>=20 >> thanks, >>=20 >> greg k-h