Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1003157pxb; Wed, 6 Oct 2021 21:33:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPVY4JVMY5nK96kFXUdm/Lept230ylUPPtMvkjmb1UDaTaTxESfOjCH2V8bhLlkLgNozIQ X-Received: by 2002:a05:6402:350c:: with SMTP id b12mr3227982edd.244.1633581202182; Wed, 06 Oct 2021 21:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633581202; cv=none; d=google.com; s=arc-20160816; b=lAISwL+lffFEGdJXzbodik27ZFJFXzDWrSdjfw3vvksLrg69Cuw/EMAUta+KadM3dI c1fc3IBBrE0sBSaf7qrkpF/qNPA8thi206iLvJC5RhIfcg2kGI7bGGy/SbmdwXor1oaQ xAX3/5RVf0phMfocsX2DjntYcEkIlv5sQQmCD3uLA3tabCh/N01A07V2rX3anVUKzIsf W1O/vFk1jiTBX6lAW/ye5FE636CK5g77drFHhf/BHSyvUCcX+LMmPJxTdifAEg/5b8pJ wcscH5DKgbWalhddniE+2RJdWZLxjo5W6Ziyd2piSDtkHB0biwHh+5AwIA5GdUUiJLBo 89Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+dBRd0tFajiPwGqgeCGYWbzroYi2VHfoRO3DUspY0Fs=; b=e/PBNYLv/6GJhsdotftd2jctUXHGnKo8IDPeBejKd59e3rQmwQd32C3GsBOKaXOwOT a+liKs/68SZvgoZXLadrp3279FAmK/VUIgvvOWC9C3PFLCZlJe4DjzcbgRhv6l7dLdaD tK7aIx/+RySl9m/YcIAyWFfEzC1F8dBZa8nLPYlfkK+U/ZPLqXU4bSnD6NioDB1uPFqR 3dF/qwchlL/1Jt5UmK1IsJ+oDpTEY5lr+SsYmc4feYKv2ItHzfIkvXgvboMLDFrTF/xe gAm9ad+17GS+8JahSty6sZ7GvgF82L3fDmtUihmDmh1TCEsSfMBAEd7bPqevE8xAC5BC m4Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hWDQkvWu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si26757053ejl.25.2021.10.06.21.32.06; Wed, 06 Oct 2021 21:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hWDQkvWu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229752AbhJGE3d (ORCPT + 99 others); Thu, 7 Oct 2021 00:29:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbhJGE3d (ORCPT ); Thu, 7 Oct 2021 00:29:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D2FF610EA; Thu, 7 Oct 2021 04:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633580859; bh=jxXvN5afASHFFmVBHrpmjuDtB6YdKWx/IRGUIEVcW3c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hWDQkvWuf7OBqY7PsFKnNwrlNXL3nnZclaSOrXqrmG2rv6BRKLM7ragRQnd3Q/1to TWWBv2YQgqo+7IkJg8wreP1I7o9XEpmWH4Ok19P2BL1FYyK/buhqxjj8ux2OBwqD2/ 8Fb3Xm1dd2ARKthAEWZjHxyaOtDnBBRuqz8/yAFWMbilzQkbPcVhQlSGJznAVQibGY 4So2rkHv7EKJvB95dqij3ZfQxwlYujFCNFjpC77K52D8efWmrNU/dkmCk/ySYRW7VX 31jsIfLQzlWv+2XqxmrT6bVMk42ACFYKEeiLAToN9kGGqXcNtD5Mjh59n1qhy5MEMF oKMC8Ey8vnHpg== Date: Thu, 7 Oct 2021 12:27:30 +0800 From: Peter Chen To: Piyush Mehta Cc: "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , git , Srinivas Goud , Michal Simek Subject: Re: [PATCH V2] usb: chipidea: udc: make controller hardware endpoint primed Message-ID: <20211007042730.GA3786@Peter> References: <20210913140005.955699-1-piyush.mehta@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21-10-06 04:36:59, Piyush Mehta wrote: > > Root-cause: > There is an issue like endpoint is not recognized as primed, when bus have more pressure and the add dTD tripwire semaphore (ATDTW bit in USBCMD register) that can cause the controller to ignore a dTD that is added to a primed endpoint. > This issue observed with the Windows10 host machine. > > Workaround: > The software must implement a periodic cycle, and check for each dTD, if the endpoint is primed. It can do this by reading the corresponding bits in the ENDPTPRIME and ENDPTSTAT registers. If these bits are read at 0, the software needs to re-prime the endpoint by writing 1 to the corresponding bit in the ENDPTPRIME register. > > Added conditional revision check of 2.20[CI_REVISION_22]. > > Signed-off-by: Piyush Mehta > --- > Changes for V2: > - Addressed Peter review comments - Remove unrelated new-line > - Updated commit message > > Link: https://lore.kernel.org/linux-usb/SJ0PR02MB8644CBBA848A0F68323F1AA5D4D99@SJ0PR02MB8644.namprd02.prod.outlook.com/ > --- > drivers/usb/chipidea/udc.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 8834ca6..f9ca501 100644 > --- a/drivers/usb/chipidea/udc.c > +++ b/drivers/usb/chipidea/udc.c > @@ -49,6 +49,8 @@ ctrl_endpt_in_desc = { > .wMaxPacketSize = cpu_to_le16(CTRL_PAYLOAD_MAX), }; > > +static int reprime_dtd(struct ci_hdrc *ci, struct ci_hw_ep *hwep, > + struct td_node *node); > /** > * hw_ep_bit: calculates the bit number > * @num: endpoint number > @@ -599,6 +601,12 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) > > prevlastnode->ptr->next = cpu_to_le32(next); > wmb(); > + > + if (ci->rev == CI_REVISION_22) { > + if (!hw_read(ci, OP_ENDPTSTAT, BIT(n))) > + reprime_dtd(ci, hwep, prevlastnode); > + } > + > if (hw_read(ci, OP_ENDPTPRIME, BIT(n))) > goto done; > do { > -- Acked-by: Peter Chen -- Thanks, Peter Chen