summaryrefslogtreecommitdiff
path: root/drivers/reset
diff options
context:
space:
mode:
authorAlain Volmat <avolmat@me.com>2023-02-10 23:43:31 +0100
committerPhilipp Zabel <p.zabel@pengutronix.de>2023-05-08 09:28:31 +0200
commit2db4da59485f9c25837acc8024fc58b7a4143aaa (patch)
tree0e862c183ab17612e3262d4962d8ddf8a5bb2870 /drivers/reset
parentfdcfdb230c67c7f37df2fdfa5369f560f4a06c9d (diff)
reset: sti: rely on regmap_field_read_poll_timeout for ack wait
Use regmap_field_read_poll_timeout function when waiting for the ack bit upon performing the reset control. Signed-off-by: Alain Volmat <avolmat@me.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://lore.kernel.org/r/20230210224332.98482-1-avolmat@me.com Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/sti/reset-syscfg.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c
index b4b46e0f207e..c1ba04f6f155 100644
--- a/drivers/reset/sti/reset-syscfg.c
+++ b/drivers/reset/sti/reset-syscfg.c
@@ -64,22 +64,12 @@ static int syscfg_reset_program_hw(struct reset_controller_dev *rcdev,
return err;
if (ch->ack) {
- unsigned long timeout = jiffies + msecs_to_jiffies(1000);
u32 ack_val;
- while (true) {
- err = regmap_field_read(ch->ack, &ack_val);
- if (err)
- return err;
-
- if (ack_val == ctrl_val)
- break;
-
- if (time_after(jiffies, timeout))
- return -ETIME;
-
- cpu_relax();
- }
+ err = regmap_field_read_poll_timeout(ch->ack, ack_val, (ack_val == ctrl_val),
+ 100, USEC_PER_SEC);
+ if (err)
+ return err;
}
return 0;