Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1926785imm; Thu, 24 May 2018 03:03:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNF5lGD04x3c0F8xFipgHcvSgpZHW3qD+DN8ZDonItQHe+PChSU1WldGkHL3sQIZz3nWYH X-Received: by 2002:a17:902:57d0:: with SMTP id g16-v6mr6238780plj.222.1527156229747; Thu, 24 May 2018 03:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156229; cv=none; d=google.com; s=arc-20160816; b=dCWnHIWzsT2c1OUkZ6OKLxL7SRDrBenMg6JXCIbdpDTlNT7rgQ4iaovhyXsYF49/LD 5I/WHv1CVUPLiejBML+W6TjsRGUrwObumkNSVlqxLNx9xhv/yFseVfyXj150q5NOFlu0 Ep5ztAFzb9tPWCJvP71vWYiHBu+BalJY1y9ssKYHPt5y+VpL9JRiOiinE7Xc0qfWR1G+ xEEsU2qrhNy85gnrSyIqsHB2h8eRoFcIyjce5xdSPd8FMUpDktBoDcZ1oGJqqyAMATIF ge2r0VRAzNoLHRH8h9zL1Rqw4J16ajKqo1AHI/MgiF5lIF8qUb1fK8V7tfCEFHEIZty5 BMfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tI7z1p9NOV2TlDccKzxU7iqL4K9TRMmLRfgy62KGp2s=; b=a/chmcSqPKhpZlzmTsJClw5AsdjlAdIr2TNM6vM7OcomcJ41uXFZgURzPlEpj5T/tV fm6DhUAdzM92xE+JuOU+PcGTLrHY4UFL8c3lo0NIaFnHon1JPhdDwLczajL5Tk0D5rId OEinc4EDSCPX2Vh+wAgSp8dupiORwW2iQoMtqspLpiekuC7UVH3Fe038ZTpqukrBJKsn S2ZIbJ7p0IejcBZ6yWolDO1mZC95OVtqx8XHdm0prLmu32sDUJPMWn33xMnZZYRcNryu BbKbjWmkr9LA8Ies7RBL4NUiTi0EpOgP7rE7envQqMWiQwhYvqiEXbKzCvOkxtS+T2rb 3qBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qh4mErtT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6-v6si2138739pln.250.2018.05.24.03.03.34; Thu, 24 May 2018 03:03:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qh4mErtT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031068AbeEXKCL (ORCPT + 99 others); Thu, 24 May 2018 06:02:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:48416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031058AbeEXKCI (ORCPT ); Thu, 24 May 2018 06:02:08 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 079E120891; Thu, 24 May 2018 10:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156127; bh=U9rUjkVKpEdkq8QvB2ycB519S3INdXW4ehBDkFiQW5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qh4mErtTSreveBZMlav2MRHvywEtns2tfncYj8aPULam+cci4c3xY/L+5X5XVsbeF gMuPrr1wsv80mgXqqMDb/SFKsjjOINW7/x00F+chmd8TtXGRtJb7KKl4Cx4LTVbZ6r jQi3xlfT9LJNjZ3SM882jJnmu3cPcaIafyZPj9dI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Youn , Minas Harutyunyan , Grigor Tovmasyan , Felipe Balbi , Sasha Levin Subject: [PATCH 4.16 074/161] usb: dwc2: host: Fix transaction errors in host mode Date: Thu, 24 May 2018 11:38:19 +0200 Message-Id: <20180524093027.399079466@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Minas Harutyunyan [ Upstream commit 92a8dd26464e1f21f1d869ec53717bd2c1200d63 ] Added missing GUSBCFG programming in host mode, which fixes transaction errors issue on HiKey and Altera Cyclone V boards. These field even if was programmed in device mode (in function dwc2_hsotg_core_init_disconnected()) will be resetting to POR values after core soft reset applied. So, each time when switching to host mode required to set this field to correct value. Acked-by: John Youn Signed-off-by: Minas Harutyunyan Signed-off-by: Grigor Tovmasyan Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc2/hcd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2340,10 +2340,22 @@ static int dwc2_core_init(struct dwc2_hs */ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg) { - u32 hcfg, hfir, otgctl; + u32 hcfg, hfir, otgctl, usbcfg; dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg); + /* Set HS/FS Timeout Calibration to 7 (max available value). + * The number of PHY clocks that the application programs in + * this field is added to the high/full speed interpacket timeout + * duration in the core to account for any additional delays + * introduced by the PHY. This can be required, because the delay + * introduced by the PHY in generating the linestate condition + * can vary from one PHY to another. + */ + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); + usbcfg |= GUSBCFG_TOUTCAL(7); + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); + /* Restart the Phy Clock */ dwc2_writel(0, hsotg->regs + PCGCTL);