From patchwork Mon May 11 07:57:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1175 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B4E3B3F08B for ; Mon, 11 May 2020 09:57:32 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id c3sf6782758plz.13 for ; Mon, 11 May 2020 00:57:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183851; cv=pass; d=google.com; s=arc-20160816; b=bmXvk7j2krrC6Tct4Y0EeO+muuqJMdUNd0N5QbYAdpCAO1JiH5rEWxudERFmMMRQbe SsPQmATZHhwDiV0l9jO/OMUqvt6+KavDHH4UgOLR6ICTcGs+jATXSraRib4Rx6M4Mfaf E+eN6KKxT1RMCDGLa4V221Nb+tjmfzMxeLk10h8xhW5Qygo6hKD5QiOy4DO2OAGRaMfu XVuj021wU5+WYJVq+B0QTyH1H2AJz9dPS2P0mfSwo3NYYUjERmcUYR0LLokEz+Nch3Sp ilfzuTWcT21ueG5F8LqkgbOq6Mz3erlNlTdmbt9kC7VS3Wx8cEJioCX82qv4NlasXMLQ corA== 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=MpHc5jLmxnzVqYrOIYusxbFEjAHc7mNIDtatWxu+wtgRGfpNLgG4tfHSBvzAXHQnOD cgA7cAdJmEobg8IQuWCc6h+z5ALo0xAPQWN06v9znL6Zuq9mKqof4az80EEL/kIGZtfk GuIor4/H1gioHbSShmWVp6fjuBqrCm5HYmNXpSXc1Tnt4pTTY58PlIotqwUDEGwQyitX rIEtIGv5KRsznoOoCbAGhsdyoZlGxqKAe6Ha9m02dqCeFYR79Wa4dZRA+jup00L1zXZ2 XfZgoHgrMQqxie6Cg1FgBVKW+bNkbKa8g3jUh2PT1YYYxl+f+DkB7CnC6aOtU1xDsB7R xZQg== 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=iyRZaPKDpQ3ufwkjTdp0dOyf5LQ+UuWPAVvyCN2WNe0MGGwPhiWkHpqKBdz0uS0npy EXYfeoSBnJKkMNm8ruC85zOj5ZXcTCfoDGz5KHXTrfmJnBV/yzbqDpqcz94SG628K56C Nq3VHVSfLz523amEzmiZgW+qW5yV1vwZrGS90= 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=gVDr9h5SIt2mc/ZLLcKWzqK93T+uwlQ2x9C1/FADNDL6HBCDzd49wrFD1EjKSe1dfN /RfeBdtN89ZT87sPHE7VEtz781z6jzsjIAFVluSIvwhpJj/aPkviqoRUWbob2+G6QMUP h47bhgCt1iKPQwHKkD1xQ+/21dvMGkgVEkkgr+SZbPx/NgvEunRwifa1dVYIIZllVbjP V0pa3FLrOxrtxadeeOooiGHMUJkZ2YqcA7WFlqViRFnJcmGOTyK+xGA/pwy3xg0l2MXX jPDoXVOIDhpW/uLVTPcuTRSIv/n+juGYnkUw1+h8WKehP8iOEjoB6i0nE3IvzKeCxszT XBxQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZ8wOUJS9eKB5ab+rkr4y3Q5a4AeEAd7BxqENuNECtIeuk4eZak /jLjjRMmZMQdUWf3mxJFx7Ijy5Ih X-Google-Smtp-Source: APiQypJlXOG56K1/dNH3fCc5EljEMW9OFY7CcQ/lOzudsSPjyRy6dtIzLULAgg86KQnxwcCf1nNOew== X-Received: by 2002:a62:1a53:: with SMTP id a80mr15401937pfa.157.1589183851499; Mon, 11 May 2020 00:57:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a98:: with SMTP id x24ls16186857pjn.0.gmail; Mon, 11 May 2020 00:57:31 -0700 (PDT) X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr18963044pja.80.1589183850864; Mon, 11 May 2020 00:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183850; cv=none; d=google.com; s=arc-20160816; b=II95MjwxOk8HnJaFH1xfYoxUdKJ7WSGpg7yf8BOH5QgraXW2nHw3KgeBO7gnKOxWZQ /ULUg5L+BEQSz4xZpTUooIFE2vLJbGNlCeqzZADpqSHKQwB5rULSXEZRHMT3+QJhzbIf o9NKMPcmXmvbpWMeparOocmpe0096BoyHlLewFKmkVEUx/89LopfHljzf1dFqswxFiI7 4T7ZZ6Ox9GkTO2oPWtlektteuZKHGHztSYJUGOx/3D6xKFVByvlmOPMphZ/M347rgN1m WU9cQYM3J8qGHpybJJ9P18R3DmP9i24UlKs3FUQeXNKPzMB69OtaLMdlpNiQxlF2l45d D+Pg== 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=wG/EqwXl8InXqpoPH0VzfsL2WPlOqxNAlT6PKooG0SXpkjp9SI5kJhKOe/nHjZFvAD wL+1epF6lMACKRy7mGxobbQxI4rW2I+Jsv77bYc7rEfT0V8gfDnii0tvbdUYe72PUJb8 P2ig5W+ycDkQ4WyOFfT/WiwwDAzYsPY3x7O3Iylkg7uZhXTJkB3g/mRvOgPAuG5/uyeB R9uz2gSxLvI4tOK/N9TJvhiDNFy5rh8us3qqznZ7XZpE5x+VzoeKSe0672A0ry945zhK 8g8lVOzNRHSXAP0R99vdcpnN9n2gh8u7FagMUKQ3G6pbNUZDmpzxURzeVIkDT65Ugr+j XTYA== 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 m12si7330088pfd.125.2020.05.11.00.57.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:30 -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.209]) by lucky1.263xmail.com (Postfix) with ESMTP id D604882477; Mon, 11 May 2020 15:57:28 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:29 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: 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 v4 10/16] usb: dwc3: Enable AutoRetry feature in the controller Date: Mon, 11 May 2020 15:57:19 +0800 Message-Id: <20200511075725.26665-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-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 --- 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)