From patchwork Thu Jan 31 14:28:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minas Harutyunyan X-Patchwork-Id: 10790717 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 A0191746 for ; Thu, 31 Jan 2019 14:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9297530FF1 for ; Thu, 31 Jan 2019 14:29:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8394E2A1A6; Thu, 31 Jan 2019 14:29:38 +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 0C9E12A1A6 for ; Thu, 31 Jan 2019 14:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725875AbfAaO3g (ORCPT ); Thu, 31 Jan 2019 09:29:36 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:44204 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbfAaO3g (ORCPT ); Thu, 31 Jan 2019 09:29:36 -0500 Received: from mailhost.synopsys.com (dc2-mailhost2.synopsys.com [10.12.135.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 510C624E23AC; Thu, 31 Jan 2019 06:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1548944976; bh=Zg4yz7coZiUJiUzHfZXJkj4+ADmVrdWnhJHNzYV7Kz0=; h=Date:From:Subject:To:CC:From; b=giKKxlRofKLtUB/1P6pG2EwhUMwAYoBTKR3c0xc3m5KREPbiCAUdI2kYrUVOD0f2H Pza/yKPL8RxkgI3vbh8ArS/OcQ3jpVAWPUL1WVJ3Ja/xUuPm/cVa/rYlk9EmQo0BhK VjLZX9/OD2jPhRLxHzLJwe6jwhuWsEvDQpqYMm6axGw4RqvzRIa3Je2wxD4jna0gQi E+e2J+wNlf4loYg7jOCd70I76qXG//B2sOjZeKh7VnZeoSMHTjB0seTwPxh+Vty/Qy EoMNXmbcSNTg0f0D0d0+D33w42rL9PBDnIdL2BR4MxyrsPtLTxsswG3yFut2qUVyai OF5HtSy02vuXA== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 3BCD8A0091; Thu, 31 Jan 2019 14:29:36 +0000 (UTC) Received: from US01WEHTC1.internal.synopsys.com (10.12.239.236) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 31 Jan 2019 06:28:13 -0800 Received: from hminas-z420 (10.13.184.20) by us01wehtc1.internal.synopsys.com (10.12.239.236) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 31 Jan 2019 06:28:12 -0800 Received: by hminas-z420 (sSMTP sendmail emulation); Thu, 31 Jan 2019 18:28:07 +0400 Date: Thu, 31 Jan 2019 18:28:07 +0400 Message-ID: From: Minas Harutyunyan Subject: [PATCH] usb: dwc2: Fix EP TxFIFO number setting To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , CC: John Youn MIME-Version: 1.0 X-Originating-IP: [10.13.184.20] 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 In case when some EP IN is frequently reused, i.e. enabled/disabled by function driver. It is required to clear TxFIFO number field in DIEPCTL register before setting new number. Otherwise there is probability to have same TxFIFO number for different EP's because of OR operator. Signed-off-by: Minas Harutyunyan --- drivers/usb/dwc2/gadget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 68ad75a7460d..1e5ee3c7be39 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4005,6 +4005,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, ret = -ENOMEM; goto error1; } + epctrl &= ~(DXEPCTL_TXFNUM_LIMIT << DXEPCTL_TXFNUM_SHIFT); hsotg->fifo_map |= 1 << fifo_index; epctrl |= DXEPCTL_TXFNUM(fifo_index); hs_ep->fifo_index = fifo_index;