From patchwork Thu Sep 10 21:25:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hamish Martin X-Patchwork-Id: 297661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41C49C43461 for ; Thu, 10 Sep 2020 21:26:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F13FF221E2 for ; Thu, 10 Sep 2020 21:26:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b="oekX5nSj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727952AbgIJV0D (ORCPT ); Thu, 10 Sep 2020 17:26:03 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:49516 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgIJVZ0 (ORCPT ); Thu, 10 Sep 2020 17:25:26 -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 744F084487; Fri, 11 Sep 2020 09:25:23 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599773123; bh=v6J8elKSG/pZnMDANq/wlrJBwqjPYhwoxacNowboLko=; h=From:To:Cc:Subject:Date; b=oekX5nSj3IDBsfUVB1G9ANL++TLwXsrqfzTT/AUqJXqY9cm1/qmH7ZwAlBhvrhRns tDudCy48H5JTWxTCUl0IE0MDbuZeKwyrsPnzaRlXo1Iiyi69bdB7L3uJ8xHfdNyo2G 8bHxc3PDbFqYTbzVL1rKwzRo/PRzvcBvYIt73ZmDAvss8TcxgR+vhTCFPfbUFGCO/7 vAGob2+gr8oqCz6hHOFGpWOCLEpEYNO46K1qkW+EoCbzT3DFCExoOqSFqMBSXoS72s FSWrJpmQ9A6wQ+zVxGzcBzfBVMK4+t61/HST/LwF2QL/bMfPG3Va67szdLekPOQtoN PZkD2z4EyazZw== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Fri, 11 Sep 2020 09:25:21 +1200 Received: from hamishm-dl.ws.atlnz.lc (hamishm-dl.ws.atlnz.lc [10.33.24.30]) by smtp (Postfix) with ESMTP id DC66813EEB7; Fri, 11 Sep 2020 09:25:21 +1200 (NZST) Received: by hamishm-dl.ws.atlnz.lc (Postfix, from userid 1133) id 37F472A2AB9; Fri, 11 Sep 2020 09:25:23 +1200 (NZST) From: Hamish Martin To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hamish Martin Subject: [PATCH v2 1/2] usb: ohci: Default to per-port over-current protection Date: Fri, 11 Sep 2020 09:25:11 +1200 Message-Id: <20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 x-atlnz-ls: pat Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@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 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); From patchwork Thu Sep 10 21:25:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hamish Martin X-Patchwork-Id: 258579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 273FDC433E2 for ; Thu, 10 Sep 2020 21:26:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B45F21D92 for ; Thu, 10 Sep 2020 21:26:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b="lvCWAmz3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgIJV0A (ORCPT ); Thu, 10 Sep 2020 17:26:00 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:49522 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726301AbgIJVZ3 (ORCPT ); Thu, 10 Sep 2020 17:25:29 -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 8C6AE891B0; Fri, 11 Sep 2020 09:25:26 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599773126; bh=qqHU8t6MUhQ7iFPaaO3/oB5D4eqjg20+i952QRb+1fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lvCWAmz3PLpRblqQoHVR1T6wswyx4Q9rXsLMKwXsg83nOrerMKec3ssfW/nSSr1zP nu4fYf7vlzz3RYsyeTfEzVVowMUbx5BZyP5/6MA2Bz9frbMbyRf6izWQh0w2E0oBLI dtUpV2tfeiyiXV4OUlauQ0+S2lgbe3zW5Bp2KZPAQ82XZoltvoFySRASONt4VGYErT seD2VDn7FMUGSniBA7uN358lO8T0JmokTqtOjhp604x4bByHqZzHmkKkiyQm0Fo3/O DuKbKPuzkcijTlpd4fwflXUjszhXZWcOu3baORvtjulxccNRTwyHi7BVRO8ZgCsl71 kUX6PF2M3nUhQ== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Fri, 11 Sep 2020 09:25:25 +1200 Received: from hamishm-dl.ws.atlnz.lc (hamishm-dl.ws.atlnz.lc [10.33.24.30]) by smtp (Postfix) with ESMTP id 0A44013EEB7; Fri, 11 Sep 2020 09:25:25 +1200 (NZST) Received: by hamishm-dl.ws.atlnz.lc (Postfix, from userid 1133) id 60FB02A2AB9; Fri, 11 Sep 2020 09:25:26 +1200 (NZST) From: Hamish Martin To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hamish Martin Subject: [PATCH v2 2/2] usb: ohci: Make distrust_firmware param default to false Date: Fri, 11 Sep 2020 09:25:12 +1200 Message-Id: <20200910212512.16670-2-hamish.martin@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz> References: <20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz> MIME-Version: 1.0 x-atlnz-ls: pat Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The 'distrust_firmware' module parameter dates from 2004 and the USB subsystem is a lot more mature and reliable now than it was then. Alter the default to false now. Suggested-by: Alan Stern Signed-off-by: Hamish Martin Acked-by: Alan Stern --- drivers/usb/host/ohci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 2845ea328a06..73e13e7c2b46 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -102,7 +102,7 @@ static void io_watchdog_func(struct timer_list *t); /* Some boards misreport power switching/overcurrent */ -static bool distrust_firmware = true; +static bool distrust_firmware; module_param (distrust_firmware, bool, 0); MODULE_PARM_DESC (distrust_firmware, "true to distrust firmware power/overcurrent setup");