Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp940270pxb; Wed, 1 Sep 2021 13:14:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvIZ57tknVVlc0FhYWRXSCkEz0UfJ985XEJ7qJz3VGIaC1cgp2fWjsNMxLNq5bdbIFfbe7 X-Received: by 2002:a05:6402:1248:: with SMTP id l8mr1400951edw.94.1630527265676; Wed, 01 Sep 2021 13:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630527265; cv=none; d=google.com; s=arc-20160816; b=mfvYUh5lEpKQ97P4Kl9GdTregRXVTbBxLixxdgrbR1GAIH7GdXHdai4PZcw1q8DW8Z XmPv5O8dFZOiWRtA/eg/+npJ3oXi4dhpghGfSD1oHgn/7Se224y9bbqHgeYjyuziFn4O wCuNaEBUBy/X9nxKs35Zbn5mLh8SGjHipAW9yYiuhdyyv2PfGOgMiT16Jj7D/05uxTv0 o0tqSzGR1pbiqvbDnZJt5XrZ8cX7dSgzNzxqcRm0iDfwOfckhN7/GeY08X9nAi7LTddH b5Nau8vqaaQSwPzKdzIGyd9XYuc84CXBiW0+w8GkVoDCp9WMWzZd006AJ6V6szwy4ShW Z8+A== 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=1tO8Wzz4ZhCAgJea0EqGnV5W+/tSZBYBTo8w6KKwpbM=; b=p0X5oHykQAGKZNTHldToO5FPqkojVjOd7qIY9OsmqFiM1M3O/TYX+TvvGavTdpcgFv tS9EJxQJwpbs3uCPI3Ckp33SbqM1toNbVr66fZdT54aV1eAK3RZNrJ5k/JntEaMl1HlY WEKKljZzVdjAGKaUloCf+MTNavmjVlez2dGI3/3YeXs/jSaJ2VKKyhdPziNmj5nGyavg 9uhODezBMD7v5INiLQmihpNRfRc2esl1DrmRFiLP2NAL07otl4ovv6z7LjJdMhgrcWrB PP6GzuTj9t07FFLwaOW9jGUCl3cS/6tpLxil+cHNhfir7xLx+6HCRpCjFetDqt2wysv2 HJbQ== 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 b26si493904eds.500.2021.09.01.13.14.02; Wed, 01 Sep 2021 13:14:25 -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 S245562AbhIAQmJ (ORCPT + 99 others); Wed, 1 Sep 2021 12:42:09 -0400 Received: from netrider.rowland.org ([192.131.102.5]:52511 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S245557AbhIAQmG (ORCPT ); Wed, 1 Sep 2021 12:42:06 -0400 Received: (qmail 406198 invoked by uid 1000); 1 Sep 2021 12:41:07 -0400 Date: Wed, 1 Sep 2021 12:41:07 -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 v2] usb: ehci: handshake CMD_RUN instead of STS_HALT Message-ID: <20210901164107.GD404634@rowland.harvard.edu> References: <20210901035041.10810-1-neal_liu@aspeedtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210901035041.10810-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 Wed, Sep 01, 2021 at 11:50:41AM +0800, neal_liu wrote: > Retitle. > > For Aspeed, HCHalted status depends on not only Run/Stop but also > ASS/PSS status. > Handshake CMD_RUN on startup instead. > > Signed-off-by: neal_liu I'm still a little doubtful about doing this, but if you guys say it works for your hardware then I guess it's okay. Acked-by: Alan Stern > --- > drivers/usb/host/ehci-hcd.c | 11 ++++++++++- > drivers/usb/host/ehci-platform.c | 6 ++++++ > drivers/usb/host/ehci.h | 1 + > 3 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > index 10b0365f3439..01c022e46aa2 100644 > --- a/drivers/usb/host/ehci-hcd.c > +++ b/drivers/usb/host/ehci-hcd.c > @@ -634,7 +634,16 @@ 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 = ehci_handshake(ehci, &ehci->regs->command, CMD_RUN, > + 1, 100 * 1000); > + else > + rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, > + 0, 100 * 1000); > > up_write(&ehci_cf_port_reset_rwsem); > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index c70f2d0b4aaf..c3dc906274d9 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -297,6 +297,12 @@ static int ehci_platform_probe(struct platform_device *dev) > "has-transaction-translator")) > hcd->has_tt = 1; > > + if (of_device_is_compatible(dev->dev.of_node, > + "aspeed,ast2500-ehci") || > + of_device_is_compatible(dev->dev.of_node, > + "aspeed,ast2600-ehci")) > + ehci->is_aspeed = 1; > + > if (soc_device_match(quirk_poll_match)) > priv->quirk_poll = true; > > diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h > index 80bb823aa9fe..fdd073cc053b 100644 > --- a/drivers/usb/host/ehci.h > +++ b/drivers/usb/host/ehci.h > @@ -219,6 +219,7 @@ struct ehci_hcd { /* one per controller */ > unsigned need_oc_pp_cycle:1; /* MPC834X port power */ > unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ > unsigned spurious_oc:1; > + unsigned is_aspeed:1; > > /* required for usb32 quirk */ > #define OHCI_CTRL_HCFS (3 << 6) > -- > 2.17.1 >