From patchwork Mon May 21 13:39:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 10415325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 09D9C60365 for ; Mon, 21 May 2018 13:38:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE1DD288FA for ; Mon, 21 May 2018 13:38:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E32F828900; Mon, 21 May 2018 13:38:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15102288F6 for ; Mon, 21 May 2018 13:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751738AbeEUNh5 (ORCPT ); Mon, 21 May 2018 09:37:57 -0400 Received: from mga05.intel.com ([192.55.52.43]:64081 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbeEUNhz (ORCPT ); Mon, 21 May 2018 09:37:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 06:37:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="40976848" Received: from mattu-haswell.fi.intel.com ([10.237.72.164]) by fmsmga007.fm.intel.com with ESMTP; 21 May 2018 06:37:54 -0700 From: Mathias Nyman To: Cc: , Mathias Nyman Subject: [PATCH 08/18] xhci: xhci-hub: use new port structures for cas and wake mask functions. Date: Mon, 21 May 2018 16:39:56 +0300 Message-Id: <1526910006-26104-9-git-send-email-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526910006-26104-1-git-send-email-mathias.nyman@linux.intel.com> References: <1526910006-26104-1-git-send-email-mathias.nyman@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 0796f08..372b448 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -691,11 +691,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) @@ -713,7 +713,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", @@ -1568,12 +1568,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)) @@ -1586,9 +1585,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; } @@ -1638,7 +1637,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;