Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2272914pxb; Mon, 11 Jan 2021 05:45:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl9YBxAHBfWpbmqyCUOWbSIZnjQpX7LRwsinyfwQyX1PCWouekr85dbrTSkj904vniILD/ X-Received: by 2002:a17:906:7f11:: with SMTP id d17mr10703801ejr.534.1610372706127; Mon, 11 Jan 2021 05:45:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372706; cv=none; d=google.com; s=arc-20160816; b=EWzwfvfyxcaHb4XioG89BrYVu5YdmYTGcs5lugmUSBTNwaNHqiZ7M2WpxjZ61ZpWT+ UZvASjzihdmU9uy95Y5oTfRWBizGl2OOjB/Qwplt+92M1V7hnQcZp7oxJv6dqwbwBadK 5F/ps+dR0KLHZ74hDqEqx57QGH7PtNhgoUomx/d+pLg+aZHSm+FRfofe1zGKyL++nIPk T5tkop5U91uTrtoXZYIV3uyubGWP0UxfGuF5kNxiWZulHdYh88use5zZXWvW2ewOEzqp eVMPr1OGRerkzRvzI9KBVVa/jE9RcBurKknv+WXYjBhHnUqhZUF1JwSxPHoLUxIUg4/v 9MyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oXoG7cxapylArM2ZVEm3qi/I004Y3KmBZXEGLPhJAqg=; b=dbJimVc8hoiFVEN3mddijaeaROzMS0ehhMP5eK93ZGrHKPStDPwwsGgudnsNYSPDxB lf846yQlIWdvfRNZvBMzM7TO0JZZvUs3Cyukb1m8lYt14DPx2dzwdMXCqRQ3Ux98nGxX sA8pYJl49ecQKnnjWFd/DHADAD5vJdMI9y6C8XPhhbtHllOaK9fqKPcH3UF/fFPOnm5a 1jNsQLyctBq0xGz/AHn+QgT1mBfYHYTiYGA3sEc2KCrPzc8gIOHHTSA4X6ug+cxAPLxK eQS4EedJ2RQfwSfZASwwXU6umrk9OLPsyjDAjHeHwA+BFRK3Y9eiWbESbkuuBdwNMdyq nZqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y7hYjdup; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq20si6942599edb.563.2021.01.11.05.44.42; Mon, 11 Jan 2021 05:45:06 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=y7hYjdup; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731622AbhAKNmO (ORCPT + 99 others); Mon, 11 Jan 2021 08:42:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:59308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731493AbhAKNMQ (ORCPT ); Mon, 11 Jan 2021 08:12:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8FD6322BEF; Mon, 11 Jan 2021 13:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370695; bh=6H5GGj7HOh8U/tIPGatbGzCG5pDdwPCzGC9ia3RsTr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7hYjdupORBgtIW+pwlEaeYuvoUgM8hlSgilDv1Cbmuve0zLDAVwtQOweazo/aPc4 uYGuOmLkkEO9/tYrO4IzHsGE4ObQE1Ml1vQrB1eNDAGcX0Aa0MEBtcXDiTnvQMkbMQ BeYNEpNvfZ2YzoQa/LhJUMbIoCUjB3B4WFh5t+EA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Serge Semin Subject: [PATCH 5.4 56/92] usb: dwc3: ulpi: Use VStsDone to detect PHY regs access completion Date: Mon, 11 Jan 2021 14:02:00 +0100 Message-Id: <20210111130041.845030430@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin commit ce722da66d3e9384aa2de9d33d584ee154e5e157 upstream. In accordance with [1] the DWC_usb3 core sets the GUSB2PHYACCn.VStsDone bit when the PHY vendor control access is done and clears it when the application initiates a new transaction. The doc doesn't say anything about the GUSB2PHYACCn.VStsBsy flag serving for the same purpose. Moreover we've discovered that the VStsBsy flag can be cleared before the VStsDone bit. So using the former as a signal of the PHY control registers completion might be dangerous. Let's have the VStsDone flag utilized instead then. [1] Synopsys DesignWare Cores SuperSpeed USB 3.0 xHCI Host Controller Databook, 2.70a, December 2013, p.388 Fixes: 88bc9d194ff6 ("usb: dwc3: add ULPI interface support") Acked-by: Heikki Krogerus Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20201210085008.13264-2-Sergey.Semin@baikalelectronics.ru Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ulpi.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -283,6 +283,7 @@ /* Global USB2 PHY Vendor Control Register */ #define DWC3_GUSB2PHYACC_NEWREGREQ BIT(25) +#define DWC3_GUSB2PHYACC_DONE BIT(24) #define DWC3_GUSB2PHYACC_BUSY BIT(23) #define DWC3_GUSB2PHYACC_WRITE BIT(22) #define DWC3_GUSB2PHYACC_ADDR(n) (n << 16) --- a/drivers/usb/dwc3/ulpi.c +++ b/drivers/usb/dwc3/ulpi.c @@ -24,7 +24,7 @@ static int dwc3_ulpi_busyloop(struct dwc while (count--) { reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0)); - if (!(reg & DWC3_GUSB2PHYACC_BUSY)) + if (reg & DWC3_GUSB2PHYACC_DONE) return 0; cpu_relax(); }