Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1018037pxk; Thu, 3 Sep 2020 20:26:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzFnMEbW8ITOyCt5jrFfEgZLB5VB4ip2lbsSvAP3g72VHqsJQmaeYTrNQAOplmRR6NgqIr X-Received: by 2002:aa7:d585:: with SMTP id r5mr6568528edq.278.1599190012586; Thu, 03 Sep 2020 20:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599190012; cv=none; d=google.com; s=arc-20160816; b=wj7ZTTPPEdlwhnKDw/jKYQeq6fB7YXOKY4qmFqfDlwMf8kDnaXztp8Nr6agmEpv0lC EHYucfIm8TXtSqx/2xmN8NdLrOPU5w5lFhr/qaYwg2eARFHF+zeZGmsP0wZDlClCCl6k THVDUKW/+coAJdgmGTtk6WiFRE73wG+2RIPYUrlwKetK5p2QiJO7b7Y05raJWDwDqXB3 +ok4T/N5f191MN9f4wVMl2xwoQeU+9yS2AIr/L7FQXvcECb9jfI8c/K1kEOutPjHPZcF TLZv7x02uDcBj4t5KAvm83TgfDvoadl+rDcenLx63IwMP2mWfy80LtuOkKuGXajWSVxG ZOUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n+fBehIe1ELC+DWrAylntGDT22Q6opsy+sjhUKzMBTQ=; b=DRraptz2FV7N1QOOR1vX7SpXpt/jeQjtifw7XgxMDeyU1Gye9uOWs84M3gcCTmllOD 0KAQpJHpWiwg8XdXBlosA8rsZo8gROjyfPxG/Pgsu2jA8lfGXrAEfNS2Ufd/2Olb1Gf7 StSOWFbXL4otJ3o5lYd/5Mi0aSw09x7bSDbA+UY8o+huxwd0QHMvdBkm2P9wyv6u7wsx wT1u29BMCKXaNh8CdSsg4kGRShcwnCgo6SykA8llWijv0pYlwQd/smzIRAmH13FWUr0D 7A57nwvpbVZbzWTF/US38YFwf7CzWlKhaZoKkqBLFUHeeD1xTSUhLRwzMxhMin1mBzTE raxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=zmR7hY9R; 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=alliedtelesis.co.nz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy26si3338237ejb.319.2020.09.03.20.26.30; Thu, 03 Sep 2020 20:26: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=@alliedtelesis.co.nz header.s=mail181024 header.b=zmR7hY9R; 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=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729764AbgIDDX0 (ORCPT + 99 others); Thu, 3 Sep 2020 23:23:26 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:42875 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729528AbgIDDXF (ORCPT ); Thu, 3 Sep 2020 23:23:05 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id C95FC806B5; Fri, 4 Sep 2020 15:22:59 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599189779; bh=n+fBehIe1ELC+DWrAylntGDT22Q6opsy+sjhUKzMBTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zmR7hY9RAp+EoSGFYTC79ccQLt0bN0Ny7aQUZGaCUAFNpJAcq09sGF0GidoMI+ucD YaFSJC2UWTq+Ldn4FT2R0wNEkE0h8Ch5yhhVSfRKFjjeJuGqyHKSgek9FiyBPVZ1hK 1O/hUp7SJEqFQUsWFpV2yP3pLPqS8VjwXXp5NAD3OTgW4NFVJR1OioyAQrNVxsbFjO R3UuZSLkZIj+7dz0G3vyZa1AgROutI2uNRgn1oNbTzHWCUsIT8sorGc1PXTNQSko5J xZVL+PzGTzT1mculkiM7KT5F+yE6eivWNoHrABIQkcufTiU1oTbGj6KICQY16uGCwf Nv9pwDa1tRxHw== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Fri, 04 Sep 2020 15:22:59 +1200 Received: from hamishm-dl.ws.atlnz.lc (hamishm-dl.ws.atlnz.lc [10.33.24.30]) by smtp (Postfix) with ESMTP id 5B5EF13EF39; Fri, 4 Sep 2020 15:22:59 +1200 (NZST) Received: by hamishm-dl.ws.atlnz.lc (Postfix, from userid 1133) id A1CD22A06EA; Fri, 4 Sep 2020 15:22:59 +1200 (NZST) From: Hamish Martin To: gregkh@linuxfoundation.org, robh+dt@kernel.org, stern@rowland.harvard.edu Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hamish Martin Subject: [PATCH 1/2] usb: ohci: Add per-port overcurrent quirk Date: Fri, 4 Sep 2020 15:22:46 +1200 Message-Id: <20200904032247.11345-2-hamish.martin@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904032247.11345-1-hamish.martin@alliedtelesis.co.nz> References: <20200904032247.11345-1-hamish.martin@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable x-atlnz-ls: pat Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 |=3D RH_A_NPS; ohci_writel (ohci, val, &ohci->regs->roothub.a); } + if (ohci->flags & OHCI_QUIRK_PER_PORT_OC) { + val |=3D RH_A_OCPM; + 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); diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-pla= tform.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 |=3D OHCI_QUIRK_FRAME_NO; =20 + if (of_property_read_bool(dev->dev.of_node, "per-port-overcurrent")) + ohci->flags |=3D OHCI_QUIRK_PER_PORT_OC; + if (of_property_read_bool(dev->dev.of_node, "remote-wakeup-connected")) ohci->hc_control =3D 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 protecti= on */ =20 // there are also chip quirks/bugs in init logic =20 --=20 2.28.0