From patchwork Thu Apr 25 20:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10917763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8314814B6 for ; Thu, 25 Apr 2019 20:55:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 742AF28D17 for ; Thu, 25 Apr 2019 20:55:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6559928D1A; Thu, 25 Apr 2019 20:55:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D358428D17 for ; Thu, 25 Apr 2019 20:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730860AbfDYUzb (ORCPT ); Thu, 25 Apr 2019 16:55:31 -0400 Received: from dc2-smtprelay2.synopsys.com ([198.182.61.142]:45860 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfDYUzb (ORCPT ); Thu, 25 Apr 2019 16:55:31 -0400 Received: from mailhost.synopsys.com (badc-mailhost2.synopsys.com [10.192.0.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 536C2C0B19; Thu, 25 Apr 2019 20:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1556225730; bh=cp0BoDUPMoEV0JUtUCY1xJGof7qBDjAR/xgEr+ilkII=; h=Date:From:Subject:To:CC:From; b=B7a0racbo3wN3DQ15Y4nVmdlza/L+RCQA9jDVmsdykaJ0wSfKCbQEPt9Ki/ot4qlN UY1Nkk0P5cE2K8xW1S4DNwLPC1dxlVf8no9ddaVppwTysfB1sKBNP5fN9bQXiVo4jl HlZkPgPQK/X0ohATPVojD/dDJDEuoFbxJi1WZGeuaHL6LBak4gEHmITacYOEbxV0Yp G/hx6jUmwzg35LhFEyiV6n/faalwk5VUwVR4tB+Xsa3wmMV0L4s6QeNQPk1N77DzkO llHeqOtqfFofXt7v+RC2tv7fc6zgAd0do+tTbO1joA3dBz44z541ehVj6FaCuQojyY RWpQwTNCTYilg== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 1B459A0067; Thu, 25 Apr 2019 20:55:29 +0000 (UTC) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 13:55:25 -0700 Received: from te-lab16 (10.13.184.19) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 13:55:24 -0700 Received: by te-lab16 (sSMTP sendmail emulation); Thu, 25 Apr 2019 13:55:23 -0700 Date: Thu, 25 Apr 2019 13:55:23 -0700 Message-ID: <63e615de8c5fde68c036f847c65547ce7bf6c45a.1556224658.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH 1/2] usb: dwc3: Fix default lpm_nyet_threshold value To: Felipe Balbi CC: John Youn , Thinh Nguyen , , MIME-Version: 1.0 X-Originating-IP: [10.13.184.19] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change the default value to 15. Cc: stable@vger.kernel.org Fixes: 80caf7d21adc ("usb: dwc3: add lpm erratum support") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2c9110ef9865..c6735f0c1424 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1221,7 +1221,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) u8 tx_max_burst_prd; /* default to highest possible threshold */ - lpm_nyet_threshold = 0xff; + lpm_nyet_threshold = 0xf; /* default to -3.5dB de-emphasis */ tx_de_emphasis = 1; From patchwork Thu Apr 25 20:55:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thinh Nguyen X-Patchwork-Id: 10917767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46BE912 for ; Thu, 25 Apr 2019 21:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 956C228D31 for ; Thu, 25 Apr 2019 21:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89D6528D33; Thu, 25 Apr 2019 21:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30C8A28D31 for ; Thu, 25 Apr 2019 21:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728901AbfDYVCl (ORCPT ); Thu, 25 Apr 2019 17:02:41 -0400 Received: from dc8-smtprelay2.synopsys.com ([198.182.47.102]:59426 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726282AbfDYVCl (ORCPT ); Thu, 25 Apr 2019 17:02:41 -0400 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1B399C0B0E; Thu, 25 Apr 2019 21:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1556226161; bh=MR/Ws/GXBakjQn3nv2u7Emb4kguqdYY365buRLz1EIY=; h=Date:In-Reply-To:References:From:Subject:To:CC:From; b=hnewcBQ7HRRAIdvvjLpKYHkMwz4P93JCWS+5V26PP+PDL4C3i0WQO33IRoApmcDTg 5JpH2Ycxjdi7Xn242CQbKT+cXgMeyZch91HdnnO2SLyq1ZjBXy5fqAMtfATqdjcv3k Nc9809NIL5wrmubKws5M7tjky55sr16X46dblA/HUGD+2WowkAsZUqFrH/Td0fEV4b jeZEdSiXvBc/OxVpalyAaa0s5cRB5M5DyOtz573LVHsPNlP/To919ShAq5ReJeAEhe Zc96WK+YzNmcrTiq07QMXP2bPJMcr7DhomJEMW+BTSDu/AB7m4pdCgt/6fo41i4uzq fPqdt19Ce64nQ== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id A2A44A0095; Thu, 25 Apr 2019 20:55:31 +0000 (UTC) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 13:55:31 -0700 Received: from te-lab16 (10.13.184.19) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 25 Apr 2019 13:55:30 -0700 Received: by te-lab16 (sSMTP sendmail emulation); Thu, 25 Apr 2019 13:55:30 -0700 Date: Thu, 25 Apr 2019 13:55:30 -0700 Message-ID: <3745c5e48536b2d3e4e04006860ced7dd961dc31.1556224658.git.thinhn@synopsys.com> In-Reply-To: <63e615de8c5fde68c036f847c65547ce7bf6c45a.1556224658.git.thinhn@synopsys.com> References: <63e615de8c5fde68c036f847c65547ce7bf6c45a.1556224658.git.thinhn@synopsys.com> From: Thinh Nguyen Subject: [PATCH 2/2] usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA To: Felipe Balbi CC: John Youn , Thinh Nguyen , MIME-Version: 1.0 X-Originating-IP: [10.13.184.19] Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The macro name DWC3_DCTL_LPM_ERRATA is uninformative and does not do masking. Remove DWC3_DCTL_LPM_ERRATA_MASK and rename DWC3_DCTL_LPM_ERRATA to DWC3_DCTL_NYET_THRES with proper masking. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 3 +-- drivers/usb/dwc3/gadget.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 1528d395b156..f19cbeb01087 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -406,8 +406,7 @@ #define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) /* These apply for core versions 1.94a and later */ -#define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf) -#define DWC3_DCTL_LPM_ERRATA(n) ((n) << 20) +#define DWC3_DCTL_NYET_THRES(n) (((n) & 0xf) << 20) #define DWC3_DCTL_KEEP_CONNECT BIT(19) #define DWC3_DCTL_L1_HIBER_EN BIT(18) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2bb0ff9608d3..1d808d15e886 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2863,7 +2863,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) "LPM Erratum not available on dwc3 revisions < 2.40a\n"); if (dwc->has_lpm_erratum && dwc->revision >= DWC3_REVISION_240A) - reg |= DWC3_DCTL_LPM_ERRATA(dwc->lpm_nyet_threshold); + reg |= DWC3_DCTL_NYET_THRES(dwc->lpm_nyet_threshold); dwc3_writel(dwc->regs, DWC3_DCTL, reg); } else {