Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3541079pxj; Tue, 15 Jun 2021 03:16:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOwUpU1F1/tyY9WHGEqpa2VzvpzzP07rN7ZSieFUgSekuTHjrpEtEkuCoUPydJMDZqVGen X-Received: by 2002:a6b:7004:: with SMTP id l4mr18155255ioc.68.1623752214867; Tue, 15 Jun 2021 03:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623752214; cv=none; d=google.com; s=arc-20160816; b=u99cjFt3Q3r93SQ0QOSnCrPwHo7qAvbOAe2BKZfDkKdY6/aw2GME2sUdM6gB7MwSRu YsPlIUoLI/QX5aTZO9VWT6+x79KcJ3A12nOqueOdTjmUCLIVWqLgB2we0iRw2To5WCc0 MQyAKoVeqwAgCNuN7Vo+LwvM85ZEVTfkOB+XYD0PWf486OAbBDSvlY64rQdw81eR0g8V UeaJRAckvZs+Nl2OhjTiNuNoq8CzD056RLnaCNhOS30iauIepsckcevt1qcRtc5Al9MY jwkNBwcQvC3sz5rgOiqjcyHzypoIEfI6rG+cWICKtor9VCzWYb+EXdEAIUrh8ZCEUsll s76g== 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=XuVVJBxzTq/nezMzQHmQ1iVQtTJi09b38NBbn1HjEvw=; b=alOkqK3AnLYmLid9d9uXFkNKKF7jicWHZ7p71I3YjBa5WYkP7GojT3pqHgvEolRROE W78vPARptqUPPVC4I6zqaNOT7nxE8bFsj2NFpTXZWs03uiJPNM/8NirAd9e7V97yOK5q cBzByVuey1C6MNbnWQEutbTdycWmc3/IINFht7jckjo9gU7x0Ou8fNctC3OrZMF042Is 6NCvS9e+RNlsHYHQQ34nAJOs8VH2fw5aV5Rj/nHZnNuYu+xVcsPYSCZRm+D7kS6q/El5 jodvWEQE7Frx9U7vs6o/5tsvqVAuL65Qak6Js/BtLMJQ6R3+PgUdjClttEY7gSIfAvEN gibQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opendingux.net header.s=gm1 header.b=JHYLsSG9; 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 y5si21063738ioq.102.2021.06.15.03.16.42; Tue, 15 Jun 2021 03:16:54 -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=JHYLsSG9; 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 S231518AbhFOKRu (ORCPT + 99 others); Tue, 15 Jun 2021 06:17:50 -0400 Received: from mslow1.mail.gandi.net ([217.70.178.240]:46883 "EHLO mslow1.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbhFOKRt (ORCPT ); Tue, 15 Jun 2021 06:17:49 -0400 Received: from relay6-d.mail.gandi.net (unknown [217.70.183.198]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 7B9CECC5B1; Tue, 15 Jun 2021 10:06:54 +0000 (UTC) Received: (Authenticated sender: paul@opendingux.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id ABEC0C0010; Tue, 15 Jun 2021 10:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opendingux.net; s=gm1; t=1623751590; 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=XuVVJBxzTq/nezMzQHmQ1iVQtTJi09b38NBbn1HjEvw=; b=JHYLsSG9c/DxPug2+3SS07gd9NSKQdIOHICPsS6HGrJIp5dhUaBO4zub1qz10DE6zncynR MAot7LCUhW/EFVNxL0XBzz51PoBF6avWqVYnPEkGmRRfgViAKEg79y9sFwxNhftod0dWIU Uby73qZbDhZZC2Q0XIHgTBadil6EHZEBEWQO2q16MYtxJCQHyg4yYiYmKNZ7V+80Dm5uZK KM/s42LdGBMV8JceVMNeTMfX3Y530BiykAx/xqHcVU/Z6BiO5/262Gab7IZXWJNoKqZQba x+OYathox+vQMl54ravzHVrSAUfD6zrJzz1g/qBNA0U/GB7DPey2ecs24cSt2g== Date: Tue, 15 Jun 2021 11:06:17 +0100 From: Paul Cercueil Subject: Re: [PATCH] USB: DWC2: Add VBUS overcurrent detection control. To: Greg KH 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 =?iso-8859-2?b?yGXoYXZhYw==?= Message-Id: In-Reply-To: References: <1616513066-62025-1-git-send-email-zhouyanjie@wanyeetech.com> <20210615161456.2dd501a1@zhouyanjie-virtual-machine> <8BJQUQ.QJOE5WOSWVBU@opendingux.net> 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 Greg, Le mar., juin 15 2021 at 11:48:30 +0200, Greg KH=20 a =C3=A9crit : > On Tue, Jun 15, 2021 at 09:52:20AM +0100, Paul Cercueil wrote: >> Hi Zhou, >>=20 >> 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, >> > >> > Sorry for taking so long to reply. >> > >> > =E4=BA=8E Tue, 23 Mar 2021 16:31:29 +0100 >> > Greg KH =E5=86=99=E9=81=93: >> > >> > > On Tue, Mar 23, 2021 at 11:24:26PM +0800, =E5=91=A8=E7=90=B0=E6=9D= =B0 (Zhou=20 >> 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 =C4=8Ce=C4=8Davac (in the kern= el=20 >> 3.18 >> > > > tree of CI20). It is very useful for the MIPS Creator=20 >> CI20(r1). >> > > > Without this patch, CI20's OTG port has a great probability=20 >> to >> > > > face overcurrent warning, which breaks the OTG functionality. >> > > > >> > > > Signed-off-by: =E5=91=A8=E7=90=B0=E6=9D=B0 (Zhou Yanjie)=20 >> >> > > > 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=20 >> 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=20 >> dynamic >> > > and just work properly automatically? >> > > >> > > You should not have to do this on a build-time basis, it=20 >> should be >> > > able to be detected and handled properly at run-time for all >> > > devices. >> > > >> > >> > I consulted the original author Dragan =C4=8Ce=C4=8Davac, he think si= nce=20 >> this is >> > a feature which disables overcurrent detection, so we are not=20 >> 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. >>=20 >> This could still be enabled at runtime, though, via a module=20 >> parameter. >> Leave it enabled by default, and those who want to disable it can=20 >> do it. >=20 > This is not the 1990's, please NEVER add new module parameters, First time I hear this. > especially ones that are somehow supposed to be device-specific. >=20 > Remember, module options are code-wide, not device-specific. Right. I thought "just make the option available on devices that=20 support it" but that's not how it works. -Paul > Just do this based on the device type, or something else dynamic, do=20 > NOT > make this be forced to be selected by a kernel configuration option=20 > or a > random module option at runtime. >=20 > thanks, >=20 > greg k-h