Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp390153pxk; Fri, 11 Sep 2020 09:37:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyNQ8Un44IwamMEhpp0K21DrLbZOAmLWDSYxQCEZMb09n9hr0l2mcriAKonjlgCzHSiWWD X-Received: by 2002:a17:907:70cb:: with SMTP id yk11mr2842232ejb.312.1599842222740; Fri, 11 Sep 2020 09:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599842222; cv=none; d=google.com; s=arc-20160816; b=SUFgzc+gip7fjKgdxzYwMSNwNPRWh88uU1gT0ZIBd0+sJieC1S+uqr5UOHtj6BJqmV tR0lsAzg4EgJkEnojxa7Yp11tSSq1Ds7a6agSedW5impczf8JRNbkWzJNUVICz8DSDp8 D1hPLfS6tUoK4emtgDicz2min4i4mFxkmNYcx2ZJnmGltTkRh4Gd6bzuiEOCOOVckoNe HYxPSIYl3q/1uZp4fgtgO2la0Wlde1mxmsJiK8qEX898s/N+CXLodsVSaxjwsCJ93GGm VKZPe0lM+C4DOqb/HHjCapxY3tN1l3uVQlgfiFhxUWvxWbOY2qxJiue2nDCazKKwfFKC zqVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7gdXx7MDlI1j0jXU4fZABAaZoBxLvSskxGfk8JKLiEY=; b=jcO7YW7f7A9dYeRX8ZHjTCLAw2z56vDku/DBs+4LVRMxyF/1esEtvm7ASK5CEwCrAK +RL+c+UZJD7YBnBDAdPo7yamaFIVszXwQ/JR0ihFnrZcybVEohsd5nz2NWHrgFRG1qnq EEAnlhqnNiFylUPZ1x9kZgOnOOneRuDqLt4DT1ajNb7EuUP6dmSg94bIHdcqqmFsORzC a67TZtb8DFXUzRMVCGXLVHd02p3n5ax9P62AdvY5/T0JbTDejTZrXjsUR+ct4WphQOjZ 35hWRjI7DdkXHxZnnmpT+LwHKyiCVz1F3DOysIlDPirl30IRM1h+CCdv83ti6uiNW3cz f88A== ARC-Authentication-Results: i=1; mx.google.com; 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 b14si1601884ejj.36.2020.09.11.09.36.39; Fri, 11 Sep 2020 09:37:02 -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; 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 S1726409AbgIKQdq (ORCPT + 99 others); Fri, 11 Sep 2020 12:33:46 -0400 Received: from netrider.rowland.org ([192.131.102.5]:42909 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726402AbgIKPRi (ORCPT ); Fri, 11 Sep 2020 11:17:38 -0400 Received: (qmail 884616 invoked by uid 1000); 11 Sep 2020 11:17:23 -0400 Date: Fri, 11 Sep 2020 11:17:23 -0400 From: Alan Stern To: Hamish Martin Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] usb: ohci: Default to per-port over-current protection Message-ID: <20200911151723.GA884518@rowland.harvard.edu> References: <20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 11, 2020 at 09:25:11AM +1200, Hamish Martin wrote: > Some integrated OHCI controller hubs do not expose all ports of the hub > to pins on the SoC. In some cases the unconnected ports generate > spurious over-current events. For example the Broadcom 56060/Ranger 2 SoC > contains a nominally 3 port hub but only the first port is wired. > > Default behaviour for ohci-platform driver is to use global over-current > protection mode (AKA "ganged"). This leads to the spurious over-current > events affecting all ports in the hub. > > We now alter the default to use per-port over-current protection. > > This patch results in the following configuration changes depending > on quirks: > - For quirk OHCI_QUIRK_SUPERIO no changes. These systems remain set up > for ganged power switching and no over-current protection. > - For quirk OHCI_QUIRK_AMD756 or OHCI_QUIRK_HUB_POWER power switching > remains at none, while over-current protection is now guaranteed to be > set to per-port rather than the previous behaviour where it was either > none or global over-current protection depending on the value at > function entry. > > Suggested-by: Alan Stern > Signed-off-by: Hamish Martin > --- > > Notes: > Changes in v2: > - remove clearing of RH_A_PSM in OHCI_QUIRK_HUB_POWER block. > > drivers/usb/host/ohci-hcd.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c > index dd37e77dae00..2845ea328a06 100644 > --- a/drivers/usb/host/ohci-hcd.c > +++ b/drivers/usb/host/ohci-hcd.c > @@ -673,20 +673,24 @@ static int ohci_run (struct ohci_hcd *ohci) > > /* handle root hub init quirks ... */ > val = roothub_a (ohci); > - val &= ~(RH_A_PSM | RH_A_OCPM); > + /* Configure for per-port over-current protection by default */ > + val &= ~RH_A_NOCP; > + val |= RH_A_OCPM; > if (ohci->flags & OHCI_QUIRK_SUPERIO) { > - /* NSC 87560 and maybe others */ > + /* NSC 87560 and maybe others. > + * Ganged power switching, no over-current protection. > + */ > val |= RH_A_NOCP; > - val &= ~(RH_A_POTPGT | RH_A_NPS); > - ohci_writel (ohci, val, &ohci->regs->roothub.a); > + val &= ~(RH_A_POTPGT | RH_A_NPS | RH_A_PSM | RH_A_OCPM); > } else if ((ohci->flags & OHCI_QUIRK_AMD756) || > (ohci->flags & OHCI_QUIRK_HUB_POWER)) { > /* hub power always on; required for AMD-756 and some > - * Mac platforms. ganged overcurrent reporting, if any. > + * Mac platforms. > */ > val |= RH_A_NPS; > - ohci_writel (ohci, val, &ohci->regs->roothub.a); > } > + ohci_writel(ohci, val, &ohci->regs->roothub.a); > + > ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status); > ohci_writel (ohci, (val & RH_A_NPS) ? 0 : RH_B_PPCM, > &ohci->regs->roothub.b); > -- > 2.28.0 Acked-by: Alan Stern