Commit 91160150 authored by Douglas Anderson's avatar Douglas Anderson Committed by Bjorn Andersson

soc: qcom: rpmh-rsc: Timeout after 1 second in write_tcs_reg_sync()

If our data still isn't there after 1 second, shout and give up.
Reported-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20200415095953.v3.2.I8550512081c89ec7a545018a7d2d9418a27c1a7a@changeidSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent faa0c1f1
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -175,12 +176,13 @@ static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id, ...@@ -175,12 +176,13 @@ static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id,
static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id, static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id,
u32 data) u32 data)
{ {
u32 new_data;
writel(data, tcs_reg_addr(drv, reg, tcs_id)); writel(data, tcs_reg_addr(drv, reg, tcs_id));
for (;;) { if (readl_poll_timeout_atomic(tcs_reg_addr(drv, reg, tcs_id), new_data,
if (data == readl(tcs_reg_addr(drv, reg, tcs_id))) new_data == data, 1, USEC_PER_SEC))
break; pr_err("%s: error writing %#x to %d:%#x\n", drv->name,
udelay(1); data, tcs_id, reg);
}
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment