Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1412589pxk; Fri, 4 Sep 2020 08:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXjW7JNAMfqlmvCb1rYXYbfHquLVoMgpH4JW83f46rEO1vxKrobQZSlV1X1WEpb0DjHjW0 X-Received: by 2002:a05:6402:1ad1:: with SMTP id ba17mr2649769edb.19.1599234399597; Fri, 04 Sep 2020 08:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599234399; cv=none; d=google.com; s=arc-20160816; b=gvg+uzVPry3kJsYvQPcEBzpkS9EvERONRE/Caabpiz0Mr3ApXcasMIVnvBvHkyPFPu 2UbYe6V0jQhwSn8dKohAb7D+XRM8KSiwYEIXjmzTzjch+3ldFKvrcZTMzJj+//9DWK2I vACuRkYwenptR+OjSM4M3TBJVZSFzIfDSvZyKZpkpxeOpgmYvfIlhu29+2cwtzmY6EoE 5vr0cl7tQo5we/EO/ku+7N/k1CCop8MLf12qXAtqEbGAqbNko5td6Vqo2VAaxpGKUjNd tCGH1Bx5SOatzPMWFdcdAeRp7dsBh/+yssRLP8Zek7NPabX3E6ETFLMV1IHQSfo6YZgw v82w== 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=DN5rr6d01dWFLX5pXEFWh1W2U20IcGKOQTbPplXW+Uw=; b=eeFd8PuEZdorlfgOaF/emRJKfCIXDAazv53IO4/sL9DgdgXQzbVSALEoiisX0YHGF4 f7kBe3dltNkVRdKXy5f2Y4bZ+uuQY7YFfh3v6V7Sfa+NKfkPCBlVdjJp+FRBPqFjhOfJ Liy5suehAEihX2vlZZhZpUJnogJuNUcon2RwJIxhiBpoNA+JPN4/RVgHDv7TcdpJaHL2 jxxcZnjETr3TAn1BbwOOFLhveUycz0ault1mZzBU+IQx7LvxWCauFhjLRUIHiUW8kvtP byck6cHwuDHHRAm+Rn0BzzHfsgIGSO3FLalvmFCCVa1KMfPpkmA/9ERWc+MVHjtrxt8n cRfg== 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 k8si4310244ejc.211.2020.09.04.08.46.16; Fri, 04 Sep 2020 08:46:39 -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 S1726361AbgIDPpZ (ORCPT + 99 others); Fri, 4 Sep 2020 11:45:25 -0400 Received: from netrider.rowland.org ([192.131.102.5]:59155 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726047AbgIDPpS (ORCPT ); Fri, 4 Sep 2020 11:45:18 -0400 Received: (qmail 694637 invoked by uid 1000); 4 Sep 2020 11:45:17 -0400 Date: Fri, 4 Sep 2020 11:45:17 -0400 From: Alan Stern To: Hamish Martin Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] usb: ohci: Add per-port overcurrent quirk Message-ID: <20200904154517.GB694058@rowland.harvard.edu> References: <20200904032247.11345-1-hamish.martin@alliedtelesis.co.nz> <20200904032247.11345-2-hamish.martin@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200904032247.11345-2-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 04, 2020 at 03:22:46PM +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 overcurrent 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 "ganged" > overcurrent protection mode. This leads to the spurious overcurrent > events affecting all ports in the hub. > > Allow this to be rectified by specifying per-port overcurrent protection > mode via the device tree. > > Signed-off-by: Hamish Martin > --- > drivers/usb/host/ohci-hcd.c | 4 ++++ > drivers/usb/host/ohci-platform.c | 3 +++ > drivers/usb/host/ohci.h | 1 + > 3 files changed, 8 insertions(+) > > diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c > index dd37e77dae00..01e3d75e29d9 100644 > --- a/drivers/usb/host/ohci-hcd.c > +++ b/drivers/usb/host/ohci-hcd.c > @@ -687,6 +687,10 @@ static int ohci_run (struct ohci_hcd *ohci) > val |= RH_A_NPS; > ohci_writel (ohci, val, &ohci->regs->roothub.a); > } > + if (ohci->flags & OHCI_QUIRK_PER_PORT_OC) { > + val |= RH_A_OCPM; > + ohci_writel(ohci, val, &ohci->regs->roothub.a); > + } I don't think this is right, for two reasons. First, isn't per-port overcurrent protection the default? Second, RH_A_OCPM doesn't do anything unless RH_A_NOCP is clear. Alan Stern > 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); > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > index 4a8456f12a73..45e69ce4ef86 100644 > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -137,6 +137,9 @@ static int ohci_platform_probe(struct platform_device *dev) > if (of_property_read_bool(dev->dev.of_node, "no-big-frame-no")) > ohci->flags |= OHCI_QUIRK_FRAME_NO; > > + if (of_property_read_bool(dev->dev.of_node, "per-port-overcurrent")) > + ohci->flags |= OHCI_QUIRK_PER_PORT_OC; > + > if (of_property_read_bool(dev->dev.of_node, > "remote-wakeup-connected")) > ohci->hc_control = OHCI_CTRL_RWC; > diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h > index aac6285b37f8..9c2bc816246c 100644 > --- a/drivers/usb/host/ohci.h > +++ b/drivers/usb/host/ohci.h > @@ -422,6 +422,7 @@ struct ohci_hcd { > #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ > #define OHCI_QUIRK_GLOBAL_SUSPEND 0x800 /* must suspend ports */ > #define OHCI_QUIRK_QEMU 0x1000 /* relax timing expectations */ > +#define OHCI_QUIRK_PER_PORT_OC 0x2000 /* per-port overcurrent protection */ > > // there are also chip quirks/bugs in init logic > > -- > 2.28.0 >