From patchwork Tue Jul 3 07:20:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 938445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41KbBh3ldWz9s29; Tue, 3 Jul 2018 17:21:00 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1faFcK-00047o-AH; Tue, 03 Jul 2018 07:20:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1faFcH-00045V-Ne for kernel-team@lists.ubuntu.com; Tue, 03 Jul 2018 07:20:49 +0000 Received: from [175.41.48.77] (helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1faFcG-0000Ld-Ui for kernel-team@lists.ubuntu.com; Tue, 03 Jul 2018 07:20:49 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 05/16] xhci: xhci-hub: use new port structures for cas and wake mask functions. Date: Tue, 3 Jul 2018 15:20:18 +0800 Message-Id: <20180703072029.14289-6-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180703072029.14289-1-kai.heng.feng@canonical.com> References: <20180703072029.14289-1-kai.heng.feng@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mathias Nyman BugLink: https://bugs.launchpad.net/bugs/1763594 Use port structures instead of mmio port arrays for xhci_port_missing_cas_quirk() and xhci_set_remote_wake_mask() in xhci-hub.c Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman (cherry picked from commit fdcf74ffef640fd30402863877d442c8bada7582) Signed-off-by: Kai-Heng Feng --- drivers/usb/host/xhci-hub.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 557c16b81b58..e0f45be1acea 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -692,11 +692,11 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, } static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, - __le32 __iomem **port_array, int port_id, u16 wake_mask) + struct xhci_port *port, u16 wake_mask) { u32 temp; - temp = readl(port_array[port_id]); + temp = readl(port->addr); temp = xhci_port_state_to_neutral(temp); if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_CONNECT) @@ -714,7 +714,7 @@ static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, else temp &= ~PORT_WKOC_E; - writel(temp, port_array[port_id]); + writel(temp, port->addr); } /* Test and clear port RWC bit */ @@ -1290,8 +1290,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, xhci_dbg(xhci, "set port reset, actual port %d status = 0x%x\n", wIndex, temp); break; case USB_PORT_FEAT_REMOTE_WAKE_MASK: - xhci_set_remote_wake_mask(xhci, port_array, - wIndex, wake_mask); + xhci_set_remote_wake_mask(xhci, ports[wIndex], + wake_mask); temp = readl(ports[wIndex]->addr); xhci_dbg(xhci, "set port remote wake mask, " "actual port %d status = 0x%x\n", @@ -1559,12 +1559,11 @@ int xhci_bus_suspend(struct usb_hcd *hcd) * warm reset a USB3 device stuck in polling or compliance mode after resume. * See Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8 */ -static bool xhci_port_missing_cas_quirk(int port_index, - __le32 __iomem **port_array) +static bool xhci_port_missing_cas_quirk(struct xhci_port *port) { u32 portsc; - portsc = readl(port_array[port_index]); + portsc = readl(port->addr); /* if any of these are set we are not stuck */ if (portsc & (PORT_CONNECT | PORT_CAS)) @@ -1577,9 +1576,9 @@ static bool xhci_port_missing_cas_quirk(int port_index, /* clear wakeup/change bits, and do a warm port reset */ portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); portsc |= PORT_WR; - writel(portsc, port_array[port_index]); + writel(portsc, port->addr); /* flush write */ - readl(port_array[port_index]); + readl(port->addr); return true; } @@ -1629,7 +1628,7 @@ int xhci_bus_resume(struct usb_hcd *hcd) /* warm reset CAS limited ports stuck in polling/compliance */ if ((xhci->quirks & XHCI_MISSING_CAS) && (hcd->speed >= HCD_USB3) && - xhci_port_missing_cas_quirk(port_index, port_array)) { + xhci_port_missing_cas_quirk(ports[port_index])) { xhci_dbg(xhci, "reset stuck port %d\n", port_index); clear_bit(port_index, &bus_state->bus_suspended); continue;