Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp175690pxx; Wed, 28 Oct 2020 01:39:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF1SbdlBDkl3UqQ9tydgfd8nBsnolTZCMupH7RUHzo6L2fOBOSr0EX8uUIBe0o8417tRmz X-Received: by 2002:a17:907:212d:: with SMTP id qo13mr6394025ejb.288.1603874388873; Wed, 28 Oct 2020 01:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874388; cv=none; d=google.com; s=arc-20160816; b=epiJwDnHBoFnE7y/MJQZ2s8W5MJgMVlGxmpGUR3ilI6M1GrK0gO/g5kmJqdz+UH2HR nkdwpuCPSkUYsTo/5XETd0Rj8Uj/mzlOC6wmFjkdoFI9JWNXcyF/B1qSah7h/O2nfdtz NQ0O0pVnuCdrkxcephPIlpl+BRkmKesFndCm2KPLH6/cc/XeyMTyWT80v4OUUEPN6rKZ AtgWuwvmWPosCelQV6WLNMCJ5MeUAxH46gJzfCUUU9wamfepyDJ/NFuekjgCuZM91v7Z RMf8k+XnuukMbUI0WC3SFAe6Iy9preMS9BT06dxm+EV8xxHvt0TTtDmK5Jng3kEv4R9B GEVw== 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=+xehcIRX4sCFiT9E+xDX1IwambiosPHERx7Q2fwRnWU=; b=Rwd1ntrJcVraD4nkJfQy+XwN/ipBkDA8EjRcvMeRVzEThgEN2tS/XLbr5uYO5t8FDf hjgwF7FrBuq+YYejKhSHBv+Gj0c5GMf1iE07h9Vev2ZY23zKlHhl+jjeWOymA0lCISLS 3R0gGZs1/6WOo5G74n/RluHJWBwbGUO8PufmYVikasxvnaLhrRtZICH/kgyMIB6in+TE 2dFvIPV4iQ3TUtikUyzh1QSxWxGRx/y/1v99LHSErwOve9vW7wAAhFMg/xlfh+3GaTIR EGEil7uk0yRl9xjw1UXggbbkq5SSPjtpgjh2t1lN6OtFfM8ElX3izCv/i0eLiudC2bK7 YdjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vxFLboAy; 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 bs17si3022913ejb.543.2020.10.28.01.39.26; Wed, 28 Oct 2020 01:39:48 -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=vxFLboAy; 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 S1754921AbgJ0OHk (ORCPT + 99 others); Tue, 27 Oct 2020 10:07:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754812AbgJ0OHM (ORCPT ); Tue, 27 Oct 2020 10:07:12 -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 2838122258; Tue, 27 Oct 2020 14:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807631; bh=vQEZlh5DBhW8+rEwZtPANDiaf0BBE3N52baorycmLnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vxFLboAyS4B4i6tq7SpVRnR4u4QN1zQzvMMPZG/9UncSrBY/2E92rFfETyA+Myqzg VZCcEze5NRa9eDvHkFVnecrXZrpp86Io+CphX4NKKDmBDof7R9WDFfFsvJRu96L8ts r7RlKGrBhYsj1bEcVqpbOgjm77OTSSIkHWKrVd5k= 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 4.9 123/139] usb: ohci: Default to per-port over-current protection Date: Tue, 27 Oct 2020 14:50:17 +0100 Message-Id: <20201027134907.985226449@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 17f1cf02ce342..2a14c71739d7d 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -665,20 +665,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