From patchwork Tue Feb 25 21:36:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 25321 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A00BC20543 for ; Tue, 25 Feb 2014 21:37:58 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf2062685qac.8 for ; Tue, 25 Feb 2014 13:37:58 -0800 (PST) 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 :in-reply-to:references: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=CRbjvnKWfn+eR4bv1I+tDb/DP83/EmQ9/APjFvLoOMg=; b=XSHrDallZyZgL0WaiyIU0Vb4jTw8/Wek+Tebm0116RbMzP9AIs0k12dD2B22kiD7Zt RWMaVmzfsMH6PaGEQI7VC0cbATCJ+TeGbfw+ZyNE6cg91rMxq3RN19VH07vZIc74LGeO xLdhofrjVxV7Qn14yj0qvDsdQkPO2CnIqbI2iw08kK5eA8HeHhi48iwcf39EFrqSnTTn HtqEGvGvGwKOe/P2Cb2YZvNBDfZgHNmqsResJdEUQT3dHk1saTHlgrRYU8jcJS6aguEX 74XwUxreAkvHTvAAL0ehi84tTI266hIeTjvyXICSfq4jQvvdZ1kRjRu5JOKFpoRG+rqx iLdg== X-Gm-Message-State: ALoCoQnr7R4RODdzWktOrsBiT9qNFFWl83JPCHvxPqFKPvPWAHTIdcTWW5cF2hWBke5zXDl86juQ X-Received: by 10.58.106.80 with SMTP id gs16mr1727711veb.1.1393364278356; Tue, 25 Feb 2014 13:37:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.119 with SMTP id d110ls1747720qga.32.gmail; Tue, 25 Feb 2014 13:37:58 -0800 (PST) X-Received: by 10.220.200.6 with SMTP id eu6mr146486vcb.35.1393364278164; Tue, 25 Feb 2014 13:37:58 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id uw4si7148924vdc.79.2014.02.25.13.37.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 13:37:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id oz11so1191769veb.38 for ; Tue, 25 Feb 2014 13:37:58 -0800 (PST) X-Received: by 10.58.77.204 with SMTP id u12mr2738984vew.29.1393364278083; Tue, 25 Feb 2014 13:37:58 -0800 (PST) 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.220.174.196 with SMTP id u4csp169417vcz; Tue, 25 Feb 2014 13:37:57 -0800 (PST) X-Received: by 10.68.238.201 with SMTP id vm9mr2304611pbc.18.1393364277242; Tue, 25 Feb 2014 13:37:57 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ap6si21700946pad.26.2014.02.25.13.37.56; Tue, 25 Feb 2014 13:37:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753183AbaBYVhz (ORCPT + 3 others); Tue, 25 Feb 2014 16:37:55 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:58594 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752978AbaBYVhx (ORCPT ); Tue, 25 Feb 2014 16:37:53 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s1PLbqUs006654; Tue, 25 Feb 2014 15:37:52 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1PLbq2E012508; Tue, 25 Feb 2014 15:37:52 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Tue, 25 Feb 2014 15:37:51 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s1PLbpw7016639; Tue, 25 Feb 2014 15:37:51 -0600 From: Felipe Balbi To: Linux USB Mailing List CC: Paul Zimmerman , Felipe Balbi Subject: [PATCH 3/3] usb: dwc3: workaround: bogus hibernation events Date: Tue, 25 Feb 2014 15:36:20 -0600 Message-ID: <1393364180-15074-3-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393364180-15074-1-git-send-email-balbi@ti.com> References: <1393364180-15074-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@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=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Revision 2.20a of the core has a known issue which would generate bogus hibernation events _and_ random failures on USB CV TD.9.23 test case. The suggested workaround is to ignore hibernation events which don't match currently connected speed. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index cb0814f..c7ec5e8 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2459,6 +2459,30 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, dev_vdbg(dwc->dev, "%s link %d\n", __func__, dwc->link_state); } +static void dwc3_gadget_hibernation_interrupt(struct dwc3 *dwc, + unsigned int evtinfo) +{ + unsigned int is_ss = evtinfo & BIT(4); + + /** + * WORKAROUND: DWC3 revison 2.20a with hibernation support + * have a known issue which can cause USB CV TD.9.23 to fail + * randomly. + * + * Because of this issue, core could generate bogus hibernation + * events which SW needs to ignore. + * + * Refers to: + * + * STAR#9000546576: Device Mode Hibernation: Issue in USB 2.0 + * Device Fallback from SuperSpeed + */ + if (is_ss ^ (dwc->speed == USB_SPEED_SUPER)) + return; + + /* enter hibernation here */ +} + static void dwc3_gadget_interrupt(struct dwc3 *dwc, const struct dwc3_event_devt *event) { @@ -2475,6 +2499,13 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc, case DWC3_DEVICE_EVENT_WAKEUP: dwc3_gadget_wakeup_interrupt(dwc); break; + case DWC3_DEVICE_EVENT_HIBER_REQ: + if (dev_WARN_ONCE(dwc->dev, !dwc->has_hibernation, + "unexpected hibernation event\n")) + break; + + dwc3_gadget_hibernation_interrupt(dwc, event->event_info); + break; case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE: dwc3_gadget_linksts_change_interrupt(dwc, event->event_info); break;