Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp14939952rwd; Sun, 25 Jun 2023 07:11:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GZWSJLAEwlHoQ4EUGQ7jEICwn7L1q6kG8t+h9pWeMx/JuNG31xFAcAe198jvwPsHl0Pkl X-Received: by 2002:a17:907:78c8:b0:98e:16b7:e024 with SMTP id kv8-20020a17090778c800b0098e16b7e024mr2377013ejc.38.1687702313085; Sun, 25 Jun 2023 07:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687702313; cv=none; d=google.com; s=arc-20160816; b=hu1pXZ5ZXtmkcTLIV3zAm93dcAJPaXmQsBp/bvAeXjrKKo4tmuzMUYV0mEiheEZ1lj S9oDTOlT5bCjyulrvRG63rH73KtCKI8zH2g7efvQXvV6j76ezuMDBIjpefOXyxmpNLBd Mdg6JRxY6rwE+YjoWt5EPTa0uIp9yLm57Kdq6EIZ92K47QP3sKQjZ3v7mEue6KqP8sp4 1IiD5Q8pkhMCMObrn0nJSy/+vPe7qS1zZiX1hh6XjJ2HDbvg41+/+nW6xv+2TQjlvkmg lCvzO4corNWP4o5XI1ocFBAl3jlpSqxJenMLUaAOFDYEXG0WFm66OYSaRBa+2n71FYpN 69rA== 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; bh=zrbxu/064TlgTba2iJ2PYzJomuPLqJsVGtXU8NDpuaw=; fh=YbSK8HHyO/Stm/2hnktMekoLLI8c6cewIW6GSrZwdP0=; b=YBnyNzl39ooPC5wk0QUyoRk7IEXd98JOSYvjVjXyEbk14wSPUkGrmReE/U9Rhp34JQ E9JQphjzJvyfGgeTVCMm+O4NLe03VlmODngciu5Bgn/ro08T8NS01KV4/AVFmEbmXuhk mV44xS2zm/APk3HvuVTXBrhZSfS/EWNm/KNBfOzAnhkUEh1IFCuPZPV8ZBe8QAYXVkqb CVD2naoyB7itZN9ik8rC8e+b8vtwRCS25AIzhwC4Rfk90ofOtI9/96kinZU077ROH0uU +RF1yyPpOHJTL00c0LZhpx+6bjMAziVEMVcXPtKwtuqoMxGliip4IQIqltacpzdmW9hf ptfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a056402039300b00514a0265c39si1717655edv.74.2023.06.25.07.11.28; Sun, 25 Jun 2023 07:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbjFYN5s (ORCPT + 99 others); Sun, 25 Jun 2023 09:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjFYN5r (ORCPT ); Sun, 25 Jun 2023 09:57:47 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 45BD91B1 for ; Sun, 25 Jun 2023 06:57:45 -0700 (PDT) Received: (qmail 804932 invoked by uid 1000); 25 Jun 2023 09:57:43 -0400 Date: Sun, 25 Jun 2023 09:57:43 -0400 From: Alan Stern To: Guiting Shen Cc: gregkh@linuxfoundation.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@microchip.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: ohci-at91: Fix the unhandle interrupt when resume Message-ID: References: <20230622025739.13934-1-aarongt.shen@gmail.com> <4cf867a9-3c78-403a-aaeb-91f6cf099a3d@rowland.harvard.edu> <9c702495-a839-43ea-85b7-1c0a0c54ec73@rowland.harvard.edu> <8569ced1-ed6d-18b3-5223-a8bd923f864b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8569ced1-ed6d-18b3-5223-a8bd923f864b@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 25, 2023 at 12:01:12PM +0800, Guiting Shen wrote: > On Fri, Jun 23, 2023 at 23:52:53PM GMT+8, Alan Stern wrote: > >> The comment which was added with commit-id 0365ee0a8f745 may be outdated > >> because ohci_suspend() and ohci_at91_port_suspend() is used to suspend > >> instead of setting ohci->rh_state to OHCI_RH_HALTED. > > > > The comment says nothing about ohci->rh_state; it talks about the > > integrated transceivers and the 48 MHz clock. I don't see why you would > > think the comment is outdated. > > > > The comment says the reason to discard connection state by reset, but I > don't see any reset operation at ohci-at91 suspend/resume routine in > source code.And ohci_suspend() disable irq emission and mark HW > unaccessible maybe do the same effect as set ohci->rh_state to > OHCI_RH_HALTED to discard connection state which I think the comment is > outdated. No, it doesn't do the same. An actual reset is needed. > >> What's more, I found that only ohci-at91 driver to set the ohci->rh_state > >> which may be unnessory because the ohci_suspend() disable irq emission and > >> mark HW unaccessible and ohci_at91_port_suspend() suspend the controller. > >> > >> Is it really need to set ohci->rh_state in ohci_hcd_at91_drv_suspend()? > >> > >> It maybe confused to set ohci->rh_state to OHCI_RH_SUSPEND in resume > >> routine. > > > > I'm not really sure what that assignment was intended to accomplish, but > > maybe it was meant to force a reset when the controller resumes. > > > > You could get the same result by leaving ohci->rh_state set to > > OHCI_RH_SUSPENDED but changing ohci_hcd_at91_drv_resume(). Instead of > > calling ohci_resume(hcd, false), have it call: > > > > ohci_resume(hcd, !ohci_at91->wakeup); > > > > That way, if the wakeup flag is clear and the clock was stopped, > > ohci_resume() will call ohci_usb_reset(). You should also add a comment > > explaining the reason. > > > > I can't test this because I don't have the AT91 hardware. > > > > It works by your methods to force a reset in my sama5d3 soc hardware. > And I found that the ohci->rh_state was already OHCI_RH_SUSPEND before > set it OHCI_RH_HALTED in suspend.So the question is whether to set it > OHCI_RH_HALETED in ohci-at91 suspend routine. > > It also works by comment the ohci->rh_state = OHCI_RH_HALTED in suspend > routine.But I think it is safer to use your methods. > > Do you have any suggestion on it before I send v2 patch latter. No suggestions now. Submit your v2 patch and then maybe I'll have something more to say. Alan Stern