From: Nishanth Menon <nm@ti.com>
To: Santosh Shilimkar <ssantosh@kernel.org>,
Tero Kristo <kristo@kernel.org>, Nishanth Menon <nm@ti.com>
Cc: Francesco Dolcini <francesco@dolcini.it>,
Wadim Egorov <w.egorov@phytec.de>, <vigneshr@ti.com>,
<d-gole@ti.com>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Francesco Dolcini <francesco.dolcini@toradex.com>
Subject: [PATCH V2] firmware: ti_sci: Use system_state to determine polling
Date: Tue, 20 Jun 2023 08:03:29 -0500 [thread overview]
Message-ID: <20230620130329.4120443-1-nm@ti.com> (raw)
Commit b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled
mode during system suspend") aims to resolve issues with tisci
operations during system suspend operation. However, the system may
enter a no_irq stage in various other usage modes, including power-off
and restart. To determine if polling mode is appropriate, use the
system_state instead.
While at this, drop the unused is_suspending state variable and
related helpers.
Reported-by: Francesco Dolcini <francesco@dolcini.it>
Reported-by: Wadim Egorov <w.egorov@phytec.de>
Closes: https://lore.kernel.org/all/ZGeHMjlnob2GFyHF@francesco-nb.int.toradex.com/
Fixes: b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled mode during system suspend")
Tested-by: Francesco Dolcini <francesco.dolcini@toradex.com> # Toradex Verdin AM62
Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes Since V1:
* Fixed up comments from Francesco:
* Fat fingered miss part of the change causing a build break
* Added Fixes, s/Link/Closes
* Picked up Tested-by
Note: there are two reported by, and a closes link - which confuses
checkpatch a little, but I am going to assume it is ok.
V1: https://lore.kernel.org/all/20230619131236.3285069-1-nm@ti.com/
drivers/firmware/ti_sci.c | 36 ++----------------------------------
1 file changed, 2 insertions(+), 34 deletions(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 039d92a595ec..91aaa0ca9bde 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -97,7 +97,6 @@ struct ti_sci_desc {
* @node: list head
* @host_id: Host ID
* @users: Number of users of this instance
- * @is_suspending: Flag set to indicate in suspend path.
*/
struct ti_sci_info {
struct device *dev;
@@ -116,7 +115,6 @@ struct ti_sci_info {
u8 host_id;
/* protected by ti_sci_list_mutex */
int users;
- bool is_suspending;
};
#define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
@@ -418,14 +416,14 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *info,
ret = 0;
- if (!info->is_suspending) {
+ if (system_state <= SYSTEM_RUNNING) {
/* And we wait for the response. */
timeout = msecs_to_jiffies(info->desc->max_rx_timeout_ms);
if (!wait_for_completion_timeout(&xfer->done, timeout))
ret = -ETIMEDOUT;
} else {
/*
- * If we are suspending, we cannot use wait_for_completion_timeout
+ * If we are !running, we cannot use wait_for_completion_timeout
* during noirq phase, so we must manually poll the completion.
*/
ret = read_poll_timeout_atomic(try_wait_for_completion, done_state,
@@ -3281,35 +3279,6 @@ static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
return NOTIFY_BAD;
}
-static void ti_sci_set_is_suspending(struct ti_sci_info *info, bool is_suspending)
-{
- info->is_suspending = is_suspending;
-}
-
-static int ti_sci_suspend(struct device *dev)
-{
- struct ti_sci_info *info = dev_get_drvdata(dev);
- /*
- * We must switch operation to polled mode now as drivers and the genpd
- * layer may make late TI SCI calls to change clock and device states
- * from the noirq phase of suspend.
- */
- ti_sci_set_is_suspending(info, true);
-
- return 0;
-}
-
-static int ti_sci_resume(struct device *dev)
-{
- struct ti_sci_info *info = dev_get_drvdata(dev);
-
- ti_sci_set_is_suspending(info, false);
-
- return 0;
-}
-
-static DEFINE_SIMPLE_DEV_PM_OPS(ti_sci_pm_ops, ti_sci_suspend, ti_sci_resume);
-
/* Description for K2G */
static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
.default_host_id = 2,
@@ -3516,7 +3485,6 @@ static struct platform_driver ti_sci_driver = {
.driver = {
.name = "ti-sci",
.of_match_table = of_match_ptr(ti_sci_of_match),
- .pm = &ti_sci_pm_ops,
},
};
module_platform_driver(ti_sci_driver);
--
2.40.0
next reply other threads:[~2023-06-20 13:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 13:03 Nishanth Menon [this message]
2023-07-12 14:30 ` Nishanth Menon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230620130329.4120443-1-nm@ti.com \
--to=nm@ti.com \
--cc=d-gole@ti.com \
--cc=francesco.dolcini@toradex.com \
--cc=francesco@dolcini.it \
--cc=kristo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ssantosh@kernel.org \
--cc=vigneshr@ti.com \
--cc=w.egorov@phytec.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®