Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp532527lqi; Thu, 7 Mar 2024 04:52:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXpxFk1Skhq/IdLuKN9IqYMv7TneJBt3sf5MkqLhx0PetLG6bBUiYyys8NdVWUDskTCyLZMpqDETPxOYkJKrrYZv8f9LhPE+d+kd3knyg== X-Google-Smtp-Source: AGHT+IFGbx7y087PJuvYAgnzrzqI+/IAcclieUSX/36/8q67Bni1qFQAXW149nH2zF/0r/KkVgQP X-Received: by 2002:a05:6a20:244f:b0:1a1:7821:d012 with SMTP id t15-20020a056a20244f00b001a17821d012mr587816pzc.26.1709815958799; Thu, 07 Mar 2024 04:52:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709815958; cv=pass; d=google.com; s=arc-20160816; b=eAxNLJaH8t6SZ7if1hyly9kLq3kaxIoOsRxNpSTB2kR6wDo/UTjSjaekxWo634D/jd lvo7Q7Na0hM22fvfGUQB7t+Vq4E2uL/DkhrXUcNhPeUNPa5jY1g6a3XMGVe86PXM/dR7 TFgvkvCGOVlI3o9+HWX5cUmuRvzRNnCsgKHcwAUF0AO99MKeUbjrlUiXalAkEx8+uSeC OqqHO5+bNREZuSTovNP20mQehR2kla3CkQs9Alch4gl49A5Okf6+c+bF1f2Slv8720Qv 50U5LauozQUA9CJq3OocRW8UD3N9s9TqXujx6xtkPmWgoEoEODd1agEaQ02y5rdUSUIs EiYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=38ETAnDNyCNmuELos9+yDeonVlO8ADM5302lDfgU5Hw=; fh=yh51UpersxORvMuhpBjLTcDV7JpssZwcCAmXMkMLQuA=; b=STVl0VJ7JDnddOl+dOeLbaIz2RHe1uCrqm4gCQvNWL7HBmMSY9rj+jeApyqB4AOLcd BHyhPoXhQ3y4laJiShIufjwyXDXzii8CT+/DnUCUxcipVZckrYMn+P0nqG1PIDdPi9oZ Amh2PUmmSLORb2O4KWXqugn9hXbDqJ6FekyRM6L3wV/+s5ylob2MENGcgUItQJpbPPRb rkXCD4LPoEjJUY9WUpyPAai9sAxcw1CdSQ3w3QKsXd4xqwbLwuIj8jzdDmDgPf739bXu GZbYfvQIrbYl4Y7oRzHdGvXVfnDq/tm13I3S4shO/AywpbllUnWQHpAZqDm6WktK+WLK 3gFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GmpiMxyl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-95542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t124-20020a628182000000b006e56d76ca22si13794821pfd.140.2024.03.07.04.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 04:52:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GmpiMxyl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-95542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E29F0B2202F for ; Thu, 7 Mar 2024 12:34:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAB3712BEA8; Thu, 7 Mar 2024 12:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GmpiMxyl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CABBF12881C; Thu, 7 Mar 2024 12:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709814878; cv=none; b=BDe1e9MfVje+ZUK047TMeFww4L70Mrcx6suu3jmSz14EPHjmWqADtXrrLYSF22CU/ln+LsKDkcNCc6T+SAgFL6Ss7FMVMxby1ALWeoJmnrygii6Y0pT3MAtZT8M9Ai5tSxujVKNcM5hkFS47YZVl+pxZ/y/iFiyvPbSDo2iXJK4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709814878; c=relaxed/simple; bh=BvAvilTGYuQBuxg/VkWEO98QsQNG4+isNYq/1wZqKww=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CfeK/YvqVxPtaqnKgCcYpSW1y/WAyu+VSfBuRl35hZydb5avW7CmKQ5l9G9U7GxXjx+b0EhHReQP4G0E4EFkEjeisiGPNpvhzmctGsPhiU76xWiJdEtHHOwgkDYLKzzs7wcEX1D8JFSoGWMXDzdjezu3LKHRqg4ghuVMaF4f5AA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GmpiMxyl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E68C433C7; Thu, 7 Mar 2024 12:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709814878; bh=BvAvilTGYuQBuxg/VkWEO98QsQNG4+isNYq/1wZqKww=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GmpiMxylS6Xl3bIHxxo/gypLff/ee2i+qpEr+hVbvn+Ij7s0G6zQ/rSn/1lqNCPVp RolkjveZ9nGF2nu+6pvMeK7fuLzayNil6bl5iOZIkIPx0htF7cA1hBXV5bVp90uw+y COAssc5Spszl9duXjpGMCIlCxLTX7S8j5bPeib11S7SgaVlSFgur0FuySxLWIxph8m oRwCT4kYk1hYAcjIRGXO7UqSK/TaTId7Koc19FsLxrbKfaXb2OahVJJD3rz3Jf8MbQ OB+mCtAeSEPPfBZJTPkJbcnpj9wvB40LWoJak4tXQPjg0iQ94WOCgchEahPsWkuqlz uQ1bBvKC7fz2A== Message-ID: <6f9c1ee1-3b3a-44e3-96c6-ae1bef52d51d@kernel.org> Date: Thu, 7 Mar 2024 14:34:31 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 4/9] usb: cdns3-ti: support reset-on-resume behavior Content-Language: en-US To: =?UTF-8?Q?Th=C3=A9o_Lebrun?= , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo Cc: Thomas Petazzoni , =?UTF-8?Q?Gr=C3=A9gory_Clement?= , Kevin Hilman , Alan Stern , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20240307-j7200-usb-suspend-v4-0-5ec7615431f3@bootlin.com> <20240307-j7200-usb-suspend-v4-4-5ec7615431f3@bootlin.com> From: Roger Quadros In-Reply-To: <20240307-j7200-usb-suspend-v4-4-5ec7615431f3@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 07/03/2024 11:55, Théo Lebrun wrote: > Add match data support, with one boolean to indicate whether the > hardware resets after a system-wide suspend. If hardware resets, we > force execute ->runtime_resume() at system-wide resume to run the > hardware init sequence. > > No compatible exploits this functionality, just yet. > > Signed-off-by: Théo Lebrun > --- > drivers/usb/cdns3/cdns3-ti.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c > index 4c8a557e6a6f..f76327566798 100644 > --- a/drivers/usb/cdns3/cdns3-ti.c > +++ b/drivers/usb/cdns3/cdns3-ti.c > @@ -57,9 +57,14 @@ struct cdns_ti { > unsigned vbus_divider:1; > struct clk *usb2_refclk; > struct clk *lpm_clk; > + const struct cdns_ti_match_data *match_data; > int usb2_refclk_rate_code; > }; > > +struct cdns_ti_match_data { > + bool reset_on_resume; > +}; > + > static const int cdns_ti_rate_table[] = { /* in KHZ */ > 9600, > 10000, > @@ -101,6 +106,7 @@ static int cdns_ti_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, data); > > data->dev = dev; > + data->match_data = device_get_match_data(dev); > > data->usbss = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(data->usbss)) { > @@ -220,8 +226,29 @@ static int cdns_ti_runtime_resume(struct device *dev) > return 0; > } > > +static int cdns_ti_suspend(struct device *dev) > +{ > + struct cdns_ti *data = dev_get_drvdata(dev); > + > + if (data->match_data && data->match_data->reset_on_resume) > + return pm_runtime_force_suspend(dev); > + else > + return 0; > +} > + > +static int cdns_ti_resume(struct device *dev) > +{ > + struct cdns_ti *data = dev_get_drvdata(dev); > + Instead of this just do Reset and re-init here on affected platforms. This is after you remove reset/re-init code from .runtime_resume(). > + if (data->match_data && data->match_data->reset_on_resume) > + return pm_runtime_force_resume(dev); > + else > + return 0; > +} > + > static const struct dev_pm_ops cdns_ti_pm_ops = { > RUNTIME_PM_OPS(NULL, cdns_ti_runtime_resume, NULL) > + SYSTEM_SLEEP_PM_OPS(cdns_ti_suspend, cdns_ti_resume) > }; > > static const struct of_device_id cdns_ti_of_match[] = { > -- cheers, -roger