Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3522014pxj; Tue, 15 Jun 2021 02:48:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvN8M5EeRVyv/2kbMF+774hpxRKRj64ouogRMbgkiqdM61ZPXnbhdrIjpRGSD/Ku9QkVPG X-Received: by 2002:a05:6402:28a:: with SMTP id l10mr21635913edv.365.1623750532340; Tue, 15 Jun 2021 02:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623750532; cv=none; d=google.com; s=arc-20160816; b=GDfDyQlvVWH35ADVJ+OT4q4DBBdUS4QnLaYx8dN9QQIdT6Ns+S6ToviOarkNqfkdbQ lT6iIcGeLWA3NXVuBpNEAdTC+7hfTZ5ntW1dS/2HIF57XS90SzA6Ivy01go6VqyrJmhc ZgRWJqpkSJMDoAIHejKJq+bNeCBtGCbiMqrNEXSDMN3YLBB/2qohndGm+U3Ivc6RptHx c3HkJ4WRDOPZ388M/IUJD6X7iroEiG9/ouctzn8Uo+HyZjaF3SZStFHsy71JmvKKM1uk GKXVJP5YvjEEx5VCV0DWyw9jt0ofZxvyqfu/B0sQiJiIwA4wJJB+sRQKuanlEXyY16gV PZHQ== 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=BMZdTbOb3QDM51rGX5WSkNU89D/Q7fx4DaEbytvpUg0=; b=lXGrRLwO8UQR02XLDIyaeMFymlEoB2MW7BkQ3xLahk26vNl6/uhf+PeNtRB25jibz/ ffxB37uHHcVlkDPqBLoRFOT+ohz4Y3izFYaa+pQEpT2rlRGpQLEt67b2w6+eBrHNDv3V a8HfXb3tscD7r7o3kGjMC4TpFAHmC9Du4IIDPfvgq0VTO1uyiRr3ZNdaJYqTQxaEb1Vu /qvwbnUieEJhoVkzQecq9HZnTSKJFI0ISVXVSwibMb1pA27UoSdBF+fipcGVT8bVojE5 N1KX4RMoTFp3Npgu2/2wGsj6exco5+55HMw55tAXCVaVNkcDpmkHLrKpckzsLqeyVYQy +FGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="iC/A7xvd"; 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 1si12994479ejm.532.2021.06.15.02.48.28; Tue, 15 Jun 2021 02:48:52 -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="iC/A7xvd"; 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 S231443AbhFOJtM (ORCPT + 99 others); Tue, 15 Jun 2021 05:49:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:58662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbhFOJtG (ORCPT ); Tue, 15 Jun 2021 05:49:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DFE0C60FEA; Tue, 15 Jun 2021 09:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623750422; bh=0NgUrEQmnusO9U4XUcIRjeQHHVusUVV7w7uNhE6McsM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iC/A7xvdit46bvr/3dyO2a+85Yj4BZ5XmJRPud5aXFD0D5gc7AOAqMmydpCXPyOI0 /31zzTRyNq9f0MYmfSsf9LMyFqU5bkZQfPRv3yOJKtiSF9IZQEBAle8Pj8ous7AqzR aOnsGrC/oNyUJjNURCMfpKMtCwn1dxT1mwIBpKbk= Date: Tue, 15 Jun 2021 11:46:59 +0200 From: Greg KH To: =?utf-8?B?5ZGo55Cw5p2w?= 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 =?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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210615161456.2dd501a1@zhouyanjie-virtual-machine> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 写道: > > > 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. 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