summaryrefslogtreecommitdiff
path: root/drivers/clk/renesas/clk-mstp.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@kernel.org>2023-06-09 14:59:14 -0700
committerStephen Boyd <sboyd@kernel.org>2023-06-09 14:59:14 -0700
commite90f15be2447d95d6b56068ad03c5ec73730103d (patch)
treef35a17cdb584cefe1e5d9615ff9ec67a87bc2d0e /drivers/clk/renesas/clk-mstp.c
parentf73b836edfef23054c227712bbdb9d4c23e00440 (diff)
parent7df8eea64a417f1db6777cddc1d7eda3634b7175 (diff)
downloadlinux-e90f15be2447d95d6b56068ad03c5ec73730103d.tar.gz
linux-e90f15be2447d95d6b56068ad03c5ec73730103d.tar.bz2
linux-e90f15be2447d95d6b56068ad03c5ec73730103d.zip
Merge tag 'renesas-clk-for-v6.5-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-renesas
Pull more Renesas clk driver updates from Geert Uytterhoeven: - Convert the Renesas clock drivers to readl_poll_timeout_atomic() * tag 'renesas-clk-for-v6.5-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers: clk: renesas: rzg2l: Convert to readl_poll_timeout_atomic() clk: renesas: mstp: Convert to readl_poll_timeout_atomic() clk: renesas: cpg-mssr: Convert to readl_poll_timeout_atomic() iopoll: Do not use timekeeping in read_poll_timeout_atomic() iopoll: Call cpu_relax() in busy loops
Diffstat (limited to 'drivers/clk/renesas/clk-mstp.c')
-rw-r--r--drivers/clk/renesas/clk-mstp.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 90804ac06fa5..6280f4dfed71 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -14,6 +14,7 @@
#include <linux/clk/renesas.h>
#include <linux/device.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/pm_clock.h>
@@ -78,8 +79,8 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
struct mstp_clock_group *group = clock->group;
u32 bitmask = BIT(clock->bit_index);
unsigned long flags;
- unsigned int i;
u32 value;
+ int ret;
spin_lock_irqsave(&group->lock, flags);
@@ -101,19 +102,14 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
if (!enable || !group->mstpsr)
return 0;
- for (i = 1000; i > 0; --i) {
- if (!(cpg_mstp_read(group, group->mstpsr) & bitmask))
- break;
- cpu_relax();
- }
-
- if (!i) {
+ /* group->width_8bit is always false if group->mstpsr is present */
+ ret = readl_poll_timeout_atomic(group->mstpsr, value,
+ !(value & bitmask), 0, 10);
+ if (ret)
pr_err("%s: failed to enable %p[%d]\n", __func__,
group->smstpcr, clock->bit_index);
- return -ETIMEDOUT;
- }
- return 0;
+ return ret;
}
static int cpg_mstp_clock_enable(struct clk_hw *hw)