From patchwork Tue May 26 03:34:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1236 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 408583F08B for ; Tue, 26 May 2020 05:34:42 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id r23sf15817686pfc.3 for ; Mon, 25 May 2020 20:34:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590464081; cv=pass; d=google.com; s=arc-20160816; b=oUkZMxxAgPb7Z1Hw2JNUWUkn0973ThybO0hty9KFkobJW6gR6yDveK5ibGT2roWMwa imMQV8k3XjiIAs0EkRFOiWoKULAciM+CFIooaC0s0gtwq8dQT26CDbhu9c4QbmT45KWR YEVOQfpf1yoZmCP0P8vgAEWJzU01WABvFlJkcRrD5AKKKAmSgNedKbljnKys4exdNKcL I/WZ+fOmVB+zis79fxpluok/01i6busRtgv2E4Gp1rWkLczzR0lbaaZiMDhdVpkkaQzK hybSGvzbzFYAcesdMSfHYaqiENzIAicXdJ6LBJUM1CM2lLoV8hvHjMfTEI0+c71l7TDC 5CNw== 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=Zlo7QvV1kHhSXx3EE8qqugAVRt7klytA8rvkMUhc0w8=; b=ofyNzSBjo7jUpkViYg43+1L/aB8PF67mMGhXMCJR/8vxmPsQVN7Z9QWDMX+sf7ekWi cQCMUIrsnGVs3RevJiwBuDE4Y0SUOZY/DXKnqaKudnck2gUmjVhtHpaC2sLLzfhe6o2b FjMD7rxyyFdWheWPYVFDy+J+p5Z9/ZUjwl2D7BQKrfk3W0hEY0GQHIUFM+rlFCiTZ8Sl WxKQh3ZdmSiK7unNNp5+VBVp/Q37eb07Uf5E/OW6kzB4Y5eK0LdRKaDShO28E6PTA47V PmUPrB+wgK4yP/i0BkX29ZqzPNdvWPkZDSyTMsYY+97J2qQ0ILq5gBe8jnedSKddFLcm mpHg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 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=Zlo7QvV1kHhSXx3EE8qqugAVRt7klytA8rvkMUhc0w8=; b=m4Dl2MROjf78vln980ToJm1opMSttva9pwnZcMBOY/ixyhU9FJ8sPRzAsJbLZ3SxH0 yFcHAro1f0/MZHr4dTiPfnrnjyfNmaX/2RD3Kj7ZkkfwQLs6BOUa6upDWQoBom6KGXsc Ui1sRj5yEdQmoNM6tK56oVJKmh9vuw4ZdUNTY= 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=Zlo7QvV1kHhSXx3EE8qqugAVRt7klytA8rvkMUhc0w8=; b=CJspawxr29mM2PPEYcdSMYW7Ce8SCmy+Ja8YHmvJvedGn/JeUizQ78etL4n/rr9smQ /+Ll2Q7BvLxVzWomqOYvt3oJTC7ujtZunMjqNyYpcvmDK2lOfFQAawVIj9HjYTy5v0WY yGwNblkUvPpkxOSMhe0DXJaf2BbJ6hlLHIWRozpb4KBGJDp2zosrSidchR5fPKaAjxjh CiBjKGPxuHXllXLKn0aob/m2VnbagzhqKr9+ZF4uphtbsu0BZyDIt19x561maEcRCzQm 0ttAbsD8Qsokf4bBcp0+L7Y+xLu8nIX6VLwTg4Ba2lvF/gaxrHQDQeRl0QTixgIYuH/g 0bYw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AOAM5338SkcL87IliswJA+Tvh++NlklEszEy/Lelp7u5zD5Ovn8OhXk9 qfN4F8c8qi4L6V0kC80VMIlvBSb9 X-Google-Smtp-Source: ABdhPJxowJs6zI6cRo3CoLSI7wqrFWNQ5O8hEh4AH5C9rcdwXQTMR3cqZAQRIxdXs4jhxk+qnUQYBQ== X-Received: by 2002:a17:90a:c78f:: with SMTP id gn15mr23822959pjb.103.1590464081070; Mon, 25 May 2020 20:34:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a65:5649:: with SMTP id m9ls3257935pgs.7.gmail; Mon, 25 May 2020 20:34:40 -0700 (PDT) X-Received: by 2002:aa7:84d8:: with SMTP id x24mr16614015pfn.104.1590464080387; Mon, 25 May 2020 20:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590464080; cv=none; d=google.com; s=arc-20160816; b=fcY6kTBDvZLZ3NuZMzxLnHYvOGZtdxSD8fNec6yRAo78i7llUPc8HuSr2gaPWYgTzG ZVBfgJi7q3rqg/cf24hMV+8rzABz/bJpdLz3EBUPKItSAtJ2ief+d/hAcF85R5y+wDNb QjAMiNfXEKb+r1jU6YDOEa7j1nyAmqOI0wBdqeFRt7Lrke+1F5JFVXQTxXLG2dn6vuAF /e8NSGI/O6Pk6XizYxYRrt1FUOZqyk9j3hnwDyCHvwUQzVo5mJkPzmT1R+/rKsvcZgxj eG2FWfBT3xuP5rTao7Nl8bVj0gYRbTKF48fPSzIlJHNDOfH6kH3kPdqQVIarE8QrdVdl dw4A== 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=NcBR2203OCGCZzw/Awt+z1yvI16aF8IHG5nihiY7o8Q=; b=twd+fsLGE09K3M6FlNdmuAZnRekvoQ4CSsOqVXCLEtAIj/vYI3VSGLFYavjA7vJh4/ 1AKESniJ1h83fnlOcrvt4v/KXamEgKWIc2opZOJY5lBYEeKk0ITVcPajC0ttLQOQYnaA KZSUJtAkRbN6qTl5gQm6ixrWJuHZP4Prs4Vne9sktuxny+fZtgJhIcrGjrnLq6TJjjba nveckHvRRfutV6IjzKylqrX37hwmXg0hAVG0YIv2FyTFnagjoX5ZCKUXNtX29G7wuGVA 0JGY3azf5sBJpYJYackG9rv56Jf4sjZcbzdPhA46v86Jpf3hd2lsyQqmJXMfFmEw0e4g r9Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.130]) by mx.google.com with ESMTPS id y130si16058412pfg.71.2020.05.25.20.34.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2020 20:34:40 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) client-ip=211.157.147.130; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 1804CBB94C; Tue, 26 May 2020 11:34:39 +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 P10491T139788594689792S1590464077143166_; Tue, 26 May 2020 11:34:38 +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 v6 10/16] usb: dwc3: Enable AutoRetry feature in the controller Date: Tue, 26 May 2020 11:34:29 +0800 Message-Id: <20200526033435.20235-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200526033220.20047-1-frank.wang@rock-chips.com> References: <20200526033220.20047-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.130 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)