From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9DD8EB64DE for ; Tue, 10 Sep 2024 14:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc: Subject:From:To:Message-Id:Date:Content-Type:Content-Transfer-Encoding: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cbvz3JQ6Dzafg8NgXNOuBniHfq+3yKtYClfjYxdImOM=; b=5ChM6250XApVF+Kge53Ls6teW7 8tHh94D8vPQvLtOHfHhYIMUMdLjrjGGsi2b1SHVHonof5g2N1D+CEWVTKl1djpOnZ7Y1BY4sWzUkm GVFLztxdH63t1eJJUNIDjy5H8k6ANTh+jcuM5I3qNvWYU0l4pr4GwtJqdk9hNubsdlHmhXfPvjHmh wV7EnTCQBTvFi1pj7xkRyVU79htwpfkyhzTiEL0L0ROgXDP71OXhkTw/bkC/j+SisfWupq3QM54AL 4w4NXg+rnE0Onl+n1A3vp1Sxzpc0AG3hi4M0Orp7SjiI+XJ7pMtBosf8Ku4KnbaE/Jm2JkgWqPYVf jXt8qyuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1so1Uj-00000005o5f-0osE; Tue, 10 Sep 2024 14:05:25 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1so1Th-00000005nqG-0Axb for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2024 14:04:22 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 03BD91C000D; Tue, 10 Sep 2024 14:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1725977058; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cbvz3JQ6Dzafg8NgXNOuBniHfq+3yKtYClfjYxdImOM=; b=DRd8C1mAQDBaTQOrfuyjMKW5d7pmqbS8bcV6C60uk/1Q179nX5Ynppjikh9xA5ewgkHzo5 E6Xjsco+6DLttCCCXyP00KjhoMMKwXmMPS3Q/Q7nv2ekxcZdGzpb62Zm6DNdwETyHJ2ckk +PNf14dUjc4mCWW4KOhKTr50mj11WNObCtKvMbaYTmWfhz2kWo+m+jbREPwklbnpr3B29U SB/uSJoYjYcJWa2/6B/EijKgto+Ci8glIkhFCorL4wLuKUUV1LCotxK0SA8+hTZN9XJK+E /OiFRpyvwph2mjVEEctN4XUq9uE5zGKotvLL+gNZBc1ubLbpb22QoKm3jSEw+Q== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 10 Sep 2024 16:04:17 +0200 Message-Id: To: "Peter Chen" From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH v5 00/12] Fix USB suspend on TI J7200 (cdns3-ti, cdns3, xhci) Cc: "Greg Kroah-Hartman" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Roger Quadros" , "Pawel Laszczak" , "Mathias Nyman" , "Nishanth Menon" , "Vignesh Raghavendra" , "Tero Kristo" , , , , , "Kevin Hilman" , =?utf-8?q?Gr=C3=A9gory_Clement?= , "Thomas Petazzoni" , "Conor Dooley" X-Mailer: aerc 0.18.2-0-ge037c095a049 References: <20240726-s2r-cdns-v5-0-8664bfb032ac@bootlin.com> <20240809011921.GA2673490@nchen-desktop> In-Reply-To: <20240809011921.GA2673490@nchen-desktop> X-GND-Sasl: theo.lebrun@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240910_070421_364229_EEA06BE2 X-CRM114-Status: GOOD ( 19.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Peter, On Fri Aug 9, 2024 at 3:19 AM CEST, Peter Chen wrote: > On 24-07-26 20:17:48, Th=C3=A9o Lebrun wrote: > > Currently, system-wide suspend is broken on J7200 because of a > > controller reset. The TI wrapper does not get re-initialised at resume > > and the first register access from cdns core fails. > >=20 > > We address that in a few ways: > > - In cdns3-ti, if a reset has occured at resume, we reconfigure the HW= . > > - We pass the XHCI_RESET_ON_RESUME quirk, meaning the XHCI core expect= s > > a resume. > > - We add a xhci->lost_power flag. > >=20 > > The previous revision had one big issue: we had to know if > > reset-on-resume was true, at probe-time. This is where the main > > difference with previous revisions is. We now pass the information from > > wrapper devices back up into XHCI. The xhci->lost_power flag gets its > > default value from the XHCI_RESET_ON_RESUME quirk. It however allows > > wrappers to signal *at resume* if they still expect a reset. > >=20 > > That means wrappers that are unsure if they will reset should: > > - (1) set the quirk at probe and, > > - (2) potentially set xhci->lost_power to false at resume. > > Judge if controller is power lost has implemented at cdns_power_is_lost > Please check if you could use that. That function is being used! Its return value is passed as second argument to the resume() callback in struct cdns_role_driver. We set xhci->lost_power using that exact value. My cover letter explanation was slightly off, as it is not wrappers that set xhci->lost_power, but instead role drivers. Wrappers don't have any reason to touch the xhci struct directly, they are one layer above. Related: [PATCH v5 08/15] commit message looks like this: ------------------------------------------------------------------------ The cdns_role_driver->resume() callback takes a second boolean argument named `hibernated` in its implementations. This is mistaken; the only potential caller is: int cdns_resume(struct cdns *cdns) { /* ... */ if (cdns->roles[cdns->role]->resume) cdns->roles[cdns->role]->resume(cdns, cdns_power_is_lost(cdns)); return 0; } The argument can be true in cases outside of return from hibernation. Reflect the true meaning by renaming both arguments to `lost_power`. ------------------------------------------------------------------------ Regards, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com