From patchwork Wed Aug 27 21:38:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 36141 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB5F12054F for ; Wed, 27 Aug 2014 21:38:25 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf6746320pac.3 for ; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=079y6gIY3VfgZUTllb8SdqbQ0ZV9dnPyf9Oxhx/qiSk=; b=K63/R/ZnpJ8KeYv7wbtgfNZvRZ2P3WVIfIg871gYpl6OqnHcz+/jb98rXHU4nreTGM XiIk4CwzcaKl/UoDKhywoCkm/cSNHK7kjXCSlmCZH8iL4TG4ulN3xblwt2qrUMFlQEkb RMlvUJpH8X7PQwChn6TgaXNTJa4vnCs855LYx0MpcPpCdLng6OOJ/6jqIl4TYjcQ6+Xf KghLtkKp5UrslmLrGw1lRo/j/Yek8Aw4iHdRiuOx4BHgST4MxIKHsscEskif/GxAAp2c WAysCosG2fnlV12Gxv6d4NEImeus/YyC58BhNcfxsW0nATbdBoV9YHXvjVay3HLFYvZq iJmg== X-Gm-Message-State: ALoCoQmZHZOoeB71MrDYarq7ltsATYCy7vb4OaOcGWCCbZMsaj3qtUoZvP3aj7JkEoAt4jFnNr/K X-Received: by 10.66.141.165 with SMTP id rp5mr2084148pab.47.1409175502931; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls322555qgt.60.gmail; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-Received: by 10.52.243.229 with SMTP id xb5mr659825vdc.87.1409175502720; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ty1si2041382vcb.101.2014.08.27.14.38.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 14:38:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so312962vcb.39 for ; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-Received: by 10.52.3.40 with SMTP id 8mr26761389vdz.24.1409175502466; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp142571vcb; Wed, 27 Aug 2014 14:38:22 -0700 (PDT) X-Received: by 10.68.250.3 with SMTP id yy3mr50290876pbc.56.1409175501672; Wed, 27 Aug 2014 14:38:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yj2si2796094pbb.108.2014.08.27.14.38.21 for ; Wed, 27 Aug 2014 14:38:21 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965009AbaH0ViU (ORCPT + 1 other); Wed, 27 Aug 2014 17:38:20 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:50015 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964979AbaH0ViT (ORCPT ); Wed, 27 Aug 2014 17:38:19 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s7RLcIwj030722; Wed, 27 Aug 2014 16:38:18 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7RLcIde026658; Wed, 27 Aug 2014 16:38:18 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 27 Aug 2014 16:38:17 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7RLcHUa007523; Wed, 27 Aug 2014 16:38:17 -0500 From: Felipe Balbi To: Mathias Nyman CC: Linux USB Mailing List , Felipe Balbi , "Alexis R. Cortes" , Subject: [PATCH] usb: host: xhci: fix compliance mode workaround Date: Wed, 27 Aug 2014 16:38:04 -0500 Message-ID: <1409175484-9145-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.0.1.563.g66f467c MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit 71c731a (usb: host: xhci: Fix Compliance Mode on SN65LVP3502CP Hardware) implemented a workaround for a known issue with Texas Instruments' USB 3.0 redriver IC but it left a condition where any xHCI host would be taken out of reset if port was placed in compliance mode and there was no device connected to the port. That condition would trigger a fake connection to a non-existent device so that usbcore would trigger a warm reset of the port, thus taking the link out of reset. This has the side-effect of preventing any xHCI host connected to a Linux machine from starting and running the USB 3.0 Electrical Compliance Suite because the port will mysteriously taken out of compliance mode and, thus, xHCI won't step through the necessary compliance patterns for link validation. This patch fixes the issue by just adding a missing check for XHCI_COMP_MODE_QUIRK inside xhci_hub_report_usb3_link_state() when PORT_CAS isn't set. This patch should be backported to all kernels containing commit 71c731a. Fixes: 71c731a (usb: host: xhci: Fix Compliance Mode on SN65LVP3502CP Hardware) Cc: Alexis R. Cortes Cc: # v3.2+ Signed-off-by: Felipe Balbi Acked-by: Mathias Nyman --- This has been tested on a certification setup with LeCroy Voyager M3i and a really expensive oscilloscope :-) Without this patch we cannot keep the host in compliance. drivers/usb/host/xhci-hub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa79e87..69aece3 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -468,7 +468,8 @@ static void xhci_hub_report_usb2_link_state(u32 *status, u32 status_reg) } /* Updates Link Status for super Speed port */ -static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) +static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, + u32 *status, u32 status_reg) { u32 pls = status_reg & PORT_PLS_MASK; @@ -507,7 +508,8 @@ static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) * in which sometimes the port enters compliance mode * caused by a delay on the host-device negotiation. */ - if (pls == USB_SS_PORT_LS_COMP_MOD) + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && + (pls == USB_SS_PORT_LS_COMP_MOD)) pls |= USB_PORT_STAT_CONNECTION; } @@ -666,7 +668,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, } /* Update Port Link State */ if (hcd->speed == HCD_USB3) { - xhci_hub_report_usb3_link_state(&status, raw_port_status); + xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status); /* * Verify if all USB3 Ports Have entered U0 already. * Delete Compliance Mode Timer if so.