Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp533653pxb; Thu, 26 Aug 2021 08:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbNTS6Mp8w6jSsbF/l06q8l0yq81XOs2G8Hy1OLNkPy1I//WIz+geCpVBKhTVuwdcWV9/F X-Received: by 2002:aa7:cad7:: with SMTP id l23mr4719199edt.75.1629992028178; Thu, 26 Aug 2021 08:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629992028; cv=none; d=google.com; s=arc-20160816; b=S6zloWIEhBBCQplb2DrfoUF5Vg/JY6VM1CvjUZB7ZYt6X068Z5F891AKNVmD8+MhMj qx+JoIcNlTVF4kM85kCySA3VxDKiMpnPwLspG7UZ0fhN9xktAGSyV5KyzRTiM5NLTJhN pyrrQWW/kGLI9JNApbxgnydlbuo0BEOoggTkzseKPFS/Mtrm18CvA0ZkS1Z+EP8dZG3/ /xyIf8Jhq+vybEVJHqQjFzZJ/6gq8v8/l6C3USYRzvX9PRfm1CpkP+xhqTEVAyy3LmQy evN6R6A7KUPRPtG/54uRK4WoAzmLz4cNRvz3pDqUEiOBtJ/jyOaSEJ4qte8K2DLWrfny 5UGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qqhxzXzJgknWD6R5ZCSKiedlwdVty0dOKJ2irZkJHhg=; b=NaYG48P2BqkWBcMK8FG2Q7Aa+OnjnzYd8Bo1gSCPt1fGvLX3gUuRvHXRA/6G4cjklc dRzheH0NprswJKbgEHR5Y2p5uMVUQT4M9S/fJPmGx338tFC5qOvFgbjitXbvF0uDql91 gr1q1jwap2XZUed5MVV1/zhKCsmckgGdNDn/J0d0dpOlKN8w6jR6m3A2TyD2D+SCdKh8 22pRvSR/PcKJVubk+yiTG8FtAek72tOCI9rvaT1xYONVGXoMFCrhqDh70ld8JFBSZR+A 0GpMy77+mr9XZ+3nQ3e6qIfDcm2CO6ptzEfgaTTb/QgD5QNimFCvossLepB+0PHVIAwj 2/eg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si3537870ejy.739.2021.08.26.08.33.20; Thu, 26 Aug 2021 08:33:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242986AbhHZP3U (ORCPT + 99 others); Thu, 26 Aug 2021 11:29:20 -0400 Received: from netrider.rowland.org ([192.131.102.5]:52701 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S242936AbhHZP3N (ORCPT ); Thu, 26 Aug 2021 11:29:13 -0400 Received: (qmail 230582 invoked by uid 1000); 26 Aug 2021 11:28:24 -0400 Date: Thu, 26 Aug 2021 11:28:24 -0400 From: Alan Stern To: neal_liu Cc: Greg Kroah-Hartman , Tony Prisk , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tao Ren , BMC-SW@aspeedtech.com Subject: Re: [PATCH] usb: host: ehci: skip STS_HALT check for aspeed platform Message-ID: <20210826152824.GC228824@rowland.harvard.edu> References: <20210826071525.27651-1-neal_liu@aspeedtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210826071525.27651-1-neal_liu@aspeedtech.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 26, 2021 at 03:15:25PM +0800, neal_liu wrote: > STS_HALT also depends on ASS/PSS status for apseed. > Skip this check on startup. > > Signed-off-by: neal_liu > --- > drivers/usb/host/ehci-hcd.c | 10 +++++++++- > drivers/usb/host/ehci-platform.c | 6 ++++++ > drivers/usb/host/ehci.h | 1 + > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > index 10b0365f3439..a539e11502ef 100644 > --- a/drivers/usb/host/ehci-hcd.c > +++ b/drivers/usb/host/ehci-hcd.c > @@ -634,7 +634,15 @@ static int ehci_run (struct usb_hcd *hcd) > /* Wait until HC become operational */ > ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ > msleep(5); > - rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, 0, 100 * 1000); > + > + /* For Aspeed, STS_HALT also depends on ASS/PSS status. > + * Skip this check on startup. > + */ > + if (ehci->is_aspeed) > + rc = 0; > + else > + rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, > + 0, 100 * 1000); You must not do this. You are assuming the controller will always begin operating within 5 ms of the time it is told to start. What happens if you are wrong? There must be some way for the aspeed controller's host computer to tell when the controller has started running. Find out what it is and use it. Alan Stern