From patchwork Wed May 13 07:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1191 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0C2263F066 for ; Wed, 13 May 2020 09:17:20 +0200 (CEST) Received: by mail-pg1-f198.google.com with SMTP id y4sf13007290pgo.6 for ; Wed, 13 May 2020 00:17:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354239; cv=pass; d=google.com; s=arc-20160816; b=sRK240ug9eeZpQZfwecCITYWgQ6URm/fZYUfyJjaCZl98fvc/tKHDbNqsddubuv5Fb tU2w28olzRYZTa8S1yo7Wq+YMxfrmNX3fkiANMcK3hXbhsgn79+pNr0EI7DudI1jDRcA 3wokAVNwdYTJ26pQJuQa/t3dobLIBRGP494+JhYvwhOFzxgNU5IRmRTSPefMlZa/1F7g G7tEdqSFbAuHEPhcHtRQfuf/Xvbhw3L9I1nTxPiC65cJDwyC1vejHLhAyKxETs0rGxUa NB0uoWwc+MTvWy6vTETkrvzr+/ncoKx6+f5lnIqtxYxLLZATcIuTYwPkzXdwmZ1FzhSc ujtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=IHQfD4jUZu+xhU3fyNritFaziareuHO9sI+UM4U+wk9oBEyrmCRC8wfUu2N1Auvyi7 4Yn4k13/0IkGwG3THPMrsmAHiC3NIT79iO03wjfyivFEN+WMrMavsB00Rk5ooVh/Nk/P g2c25B0jOhKwoEU/I7la3yhavzkyhjEZqy988s5m3KIjcHiG65klDRchcmceUaPfC21Z A4Q04VnwOkPNOZBDHXyYeUY57+IHW6LYbArjbLNT11hw3VajyMB1MmZTS66tQjW4NO+N oQz59P2AITlkVR/JLy/LcNfRYuFZ6Evk+3+QKYLfpS+U6iPKiMOs280x9BldUitSWUm2 kj5w== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=Cpm9MIgdiOIkZgutL34k1gCUso9Jp0IgjhLW7J5+05oSVGfq+UV5Lshg+B3HYgbaQ+ Hrr+JvSDX79cF1WLVOoHdQBWAIF5/dZLA4f+Ch47arP4H61y+OI8oN1t7uo6QS+IXr4y ScxH4Yu/izA2AWNE6rQTQRVlXbmHGZpXsPGV4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=jf/HvZhGyZDHp0ctagoeaCAnQDTHLVTzNXqafVL19trQe+AEQOUHOpqiJAZyTjAezE CjkRJ3VQy8isUMTVSwdtZo+GrMcsGHOcWA91ZVvnkVkPAJ8GZ65el8/nQ74qCIaV139u NzziSJUC5/yyK1tfjZucPj8CFEMmIgEeVLsjknJNtuVvpz2nWUKx0tMFF27MTv1RJe1s 3TC2X1wxQ86S0mfQNnaFidDdyq+Q1WBmRZ7Xmcgsi5PXEkWxbQ6OdVRidyCqVzN5josp 5bNPp1Ut9Bk4zg/C9ZdseODO/PJOBBL1rvDlbC5BrlcxRNaWE94IAbkW2bP9FLPrskUY H9lw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYnvxTWngn2ZjV2lSpMnkB2r0dP3S2Klf0VDFxr3EK1gpTB54PT esYSvLORg6W/dGegB0nwtppg9KIk X-Google-Smtp-Source: APiQypIGwlJDRd2FQGhi9LQyO0vRnoUvJyjJwQ3gCW91jcv60+Vg+5vR8169fOYRVPSHzvmWVIt9FA== X-Received: by 2002:a62:e803:: with SMTP id c3mr24272567pfi.228.1589354238819; Wed, 13 May 2020 00:17:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:fe52:: with SMTP id x18ls383866pgj.6.gmail; Wed, 13 May 2020 00:17:18 -0700 (PDT) X-Received: by 2002:a62:19d5:: with SMTP id 204mr6167686pfz.189.1589354238133; Wed, 13 May 2020 00:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354238; cv=none; d=google.com; s=arc-20160816; b=csa6m1czlIwJ3ZtF0/gQHrK/1oqkP5jx4sgfcng5Pmats8fsPudhqpWpXySEwEpa3D FIHKoCO11OzbdvKUgIbgeWPB2VM36y1EcUgm8S3gSoWkp/vNmc+LPxA1VPl2gF7JhnOY dc+relwaXf7ylBy4Lqyjx3uj2nVgYHxAxqULW0cNjPU4BbrEyQ59MiKuUy0FpkgHaYI2 +SOpnRZj74QaHTfYkYHdGwYHhJ2qFnPGasO6jHqDe8YWw92ideFelkQ9wvU+xElpeX+H gNwX3cciqn8AbZ4iWMnGUwN6XliX5mEHV/UNQSn7SH1XcBNw2/hCczUCOXuP4/cjjrUU TtvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=IqRG4xhsD1aVTUBhCfrrb0VlWbUZWEKZJAMcYROTSGo=; b=Q4Bg461WEMbFuC8zr6ozO0MNnPi+0NokCyVot0CyEgKsOqKinlgc2bFAGhNLqnrdOz y1kTJ4AV5kQwJeooOO5oxn1aocWkp1L1PK/NbWdz/FkzmaV+LCftKCnLVOB6uvPE2CUc LDrw/05biPx7VXJ517Ze72JAbF19ZUeLBdAyLnTO3N5sGZaTY+8vgBFMFgE66tjTkZMx HLgvquAG8C9KCtoyms/W5uRDizsUypJbDKiMaWBjhM8yIbhXW3ue5Wtzs/VBAGS1+PY1 2OrlM9Jcobh4Fedvj4Ac8o2JrtNwmuMQ0lnmBNfnUglypdUm3cmAik7V7u4gweFIDqmR 6tUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.135]) by mx.google.com with ESMTPS id m129si11990066pfb.56.2020.05.13.00.17.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) client-ip=211.157.147.135; Received: from localhost (unknown [192.168.167.13]) by lucky1.263xmail.com (Postfix) with ESMTP id D133282755; Wed, 13 May 2020 15:17:15 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:16 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <1432dadebfece3d9d163dcc4f149b5af> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v5 10/16] usb: dwc3: Enable AutoRetry feature in the controller Date: Wed, 13 May 2020 15:17:04 +0800 Message-Id: <20200513071710.5651-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki By default when core sees any transaction error (CRC or overflow) it replies with terminating retry ACK (Retry=1 and Nump == 0). Enabling this Auto Retry feature in controller will make the core send a non-terminanting ACK upon such transaction errors. That is, ACK TP with Retry=1 and Nump != 0. Doing so will give controller a chance to recover from transient error conditions. Reference from below Linux commit, commit ("usb: dwc3: core: Enable AutoRetry feature in the controller") Cc: Marek Vasut Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/usb/dwc3/core.c | 9 +++++++++ drivers/usb/dwc3/core.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index dc92f471c1..aab6c34c2d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -995,6 +995,15 @@ int dwc3_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); } + if (dwc->dr_mode == USB_DR_MODE_HOST || + dwc->dr_mode == USB_DR_MODE_OTG) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL); + + reg |= DWC3_GUCTL_HSTINAUTORETRY; + + dwc3_writel(dwc->regs, DWC3_GUCTL, reg); + } + ret = dwc3_core_init_mode(dwc); if (ret) goto mode_fail; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index b510d8a983..2adcaf0029 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -160,6 +160,9 @@ #define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1) #define DWC3_GCTL_DSBLCLKGTNG (1 << 0) +/* Global User Control Register */ +#define DWC3_GUCTL_HSTINAUTORETRY BIT(14) + /* Global User Control 1 Register */ #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)