From patchwork Tue Nov 21 17:18:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 840118 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="Wiw88TPY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="hZTn6K+p"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yhC3Z1hkyz9s8J for ; Wed, 22 Nov 2017 04:18:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750794AbdKURSa (ORCPT ); Tue, 21 Nov 2017 12:18:30 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:43416 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbdKURSX (ORCPT ); Tue, 21 Nov 2017 12:18:23 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0D1B3607F5; Tue, 21 Nov 2017 17:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511284703; bh=Boe23vUETjE05MmqqZLEEpqW4aUPFrm3UMzraNEA2/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wiw88TPYFvfZoxC6RKYcapGy+zbLsAd6THFkEAGlBNC/RnDBfBizzxGB2CVO3K28S xzieI+mMWXoMxTR9JKAebv9pktTHmsOCiik6LyJJFKpgY8QQoqRMQK7BEOShM3Ufrk 5+Cxd0BfVqJvybyKp7mkCOhoiLIo6aZhmVtEiJgo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from chromaggus.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: awallis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9864260584; Tue, 21 Nov 2017 17:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511284702; bh=Boe23vUETjE05MmqqZLEEpqW4aUPFrm3UMzraNEA2/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZTn6K+pkz4lu/VbFEQiVLw+9sPopUEOWedJVu2Vg7aSrxnCjRzdiHo8wz2fKBsTG UMApczwZXndhG3FMtbVuH2Js4CDLcyETMnZ4/u5HKFa5YOh6l2u4Jc8ZmOH8XztGl/ kf8M7ds+7E0Zx51w2Phmk2Zq5W6KrBpsIKiLeqmA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9864260584 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=awallis@codeaurora.org From: Adam Wallis To: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Rob Herring , Mathias Nyman , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, Mark Rutland Cc: timur@codeaurora.org Subject: [PATCH 1/2] usb: xhci: add relaxed timing quirk bit Date: Tue, 21 Nov 2017 12:18:09 -0500 Message-Id: <1511284690-3878-2-git-send-email-awallis@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511284690-3878-1-git-send-email-awallis@codeaurora.org> References: <1511284690-3878-1-git-send-email-awallis@codeaurora.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Certain systems may run with CPUs at a very slow frequency. This patch adds a quirk bit that can be used to relax certain timings, etc. This quirk might be needed for other fields in the future, but initially, it will be used only on the IRQ control register to allow firmare to control the value of the register. This can prevent an "interrupt storm" effect on certain systems. Signed-off-by: Adam Wallis --- Documentation/devicetree/bindings/usb/usb-xhci.txt | 1 + drivers/usb/host/xhci.c | 25 +++++++++++++++------- drivers/usb/host/xhci.h | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt index ae6e484..af2faa24 100644 --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt @@ -29,6 +29,7 @@ Optional properties: - usb2-lpm-disable: indicate if we don't want to enable USB2 HW LPM - usb3-lpm-capable: determines if platform is USB3 LPM capable - quirk-broken-port-ped: set if the controller has broken port disable mechanism + - quirk-relaxed-timing: allows firmware to relax timing on certain registers Example: usb@f0931000 { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 327ba8b..e14a204 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -582,16 +582,25 @@ int xhci_run(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, "ERST deq = 64'h%0lx", (long unsigned int) temp_64); - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "// Set the interrupt modulation register"); - temp = readl(&xhci->ir_set->irq_control); - temp &= ~ER_IRQ_INTERVAL_MASK; /* - * the increment interval is 8 times as much as that defined - * in xHCI spec on MTK's controller + * Systems with slow CPUs may not be able to tolerate + * agressive interrupt timing that silicon can tolerate. The + * XHCI_RELAXED_TIMING will allow firmware to set the IRQ + * Control field. */ - temp |= (u32) ((xhci->quirks & XHCI_MTK_HOST) ? 20 : 160); - writel(temp, &xhci->ir_set->irq_control); + if (!(xhci->quirks & XHCI_RELAXED_TIMING_QUIRK)) { + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "// Set the interrupt modulation register"); + temp = readl(&xhci->ir_set->irq_control); + temp &= ~ER_IRQ_INTERVAL_MASK; + + /* + * the increment interval is 8 times as much as that defined + * in xHCI spec on MTK's controller + */ + temp |= (u32) ((xhci->quirks & XHCI_MTK_HOST) ? 20 : 160); + writel(temp, &xhci->ir_set->irq_control); + } /* Set the HCD state before we enable the irqs */ temp = readl(&xhci->op_regs->command); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 99a014a..6d451be 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1823,6 +1823,7 @@ struct xhci_hcd { /* Reserved. It was XHCI_U2_DISABLE_WAKE */ #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28) #define XHCI_HW_LPM_DISABLE (1 << 29) +#define XHCI_RELAXED_TIMING_QUIRK (1 << 30) unsigned int num_active_eps; unsigned int limit_active_eps;