Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp388909pxx; Wed, 28 Oct 2020 07:16:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX0dAIKmRfWRuEUBw8UyXdG81zd1SMrWVjRNz4bI4N4TXSSpLzxN3GQ+nlf3xCNpDpf12r X-Received: by 2002:a05:6402:13cc:: with SMTP id a12mr8039609edx.73.1603894605871; Wed, 28 Oct 2020 07:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603894605; cv=none; d=google.com; s=arc-20160816; b=C3nRJmcWRM2NX0T1j2cz4OwlcMW/81XiKAwI08gmCP77L6M+nEy4m1hIyWkrjY0iok Fyq2HEnve7v1ueEWQrmhHdfJQUzx9SYBLVfbmHX6Sht4YDwFHoiKM17Zw0QzKC5E513i d59JgmOxmddTFW3JWyel6bHkQyRXOGX2TfvgMKLAKVND0umn+pNkV56Zc2JlHBX7iT5i YYMki5M+Ta1g657NsUXxgnzZwbUeLKS/6XSCv38CabxDWFcswC7WIrxe7u4W6U/1JXLG 2FxhP50I9zBK/FRGcEZbZVs0PwtRpvfzjma4eE0sDodHmgMbviSzuJMLX5mGk+R8ICSM QR/g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/leu1vwx1mAQ9ZfeLPx167dch0+5fymuSqlkfkwjvZI=; b=Bmt19003i/YUsOLmMjnGmF/7YxcYG3PC6L2x9GtEgsD2nbYQAzdH6URsPQ0kq99qhS 0l93D8gWBSvy5HQl90PC/6QfBgTwd56JTPr/DDf2MupjirauhYD4oOW0QvPcGOBNApuL TAphIwDUq9Y4Xj30xCgn9sObkD+y/maKHZJw8byvLfTaLpRibHN/5HHJSdPbyXdlmOqj flFfqOiCh/lACC1ztfVCxBqQ5IkVOD3/8zv7XevFOeDxpCcT4xxk0AumDZD4dOtFYH0t lVH/5cuWOB3/LzPEHf8l359A8SBj40KLS6/6mDOJWX/Ul6z/nB9T9+R5FomOJM8JKz1R GKSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UGyzsSZ7; 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=fail (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 o10si2705925ejr.482.2020.10.28.07.16.23; Wed, 28 Oct 2020 07:16:45 -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=@kernel.org header.s=default header.b=UGyzsSZ7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1804939AbgJ0QAE (ORCPT + 99 others); Tue, 27 Oct 2020 12:00:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794202AbgJ0PQj (ORCPT ); Tue, 27 Oct 2020 11:16:39 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54DDB22281; Tue, 27 Oct 2020 15:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811799; bh=dy7ftH6y5kVPYuS6ZtwHYPyI9K3wQUX2VPiC+MhEtEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGyzsSZ7HkWmzv5JWhPZJWE0M/pM6dvCW1bGUqKRKV1l/SqFyIjrDwtHonqhkzChA 8b8f0sJY8pzAtbVb+VaFFoxHp3swD5nQcobrhZQ9iiNZ3o98L0lNxm/MYxYrSjGp2s DkoAQu4U+LukJdpqHOwEocUhxjUcXXIGmKHYO+tQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Hamish Martin , Sasha Levin Subject: [PATCH 5.8 589/633] usb: ohci: Default to per-port over-current protection Date: Tue, 27 Oct 2020 14:55:32 +0100 Message-Id: <20201027135550.444685790@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hamish Martin [ Upstream commit b77d2a0a223bc139ee8904991b2922d215d02636 ] 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 Acked-by: Alan Stern Signed-off-by: Hamish Martin Link: https://lore.kernel.org/r/20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 4de91653a2c7b..5eb62240c7f87 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.25.1