Commit 73100deb authored by Richard Maina's avatar Richard Maina Committed by Bjorn Andersson

hwspinlock: qcom: implement bust operation

Implement a new operation qcom_hwspinlock_bust() which can be invoked
to bust any locks that are in use when a remoteproc is stopped or
crashed.
Signed-off-by: default avatarRichard Maina <quic_rmaina@quicinc.com>
Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
Signed-off-by: default avatarChris Lew <quic_clew@quicinc.com>
Link: https://lore.kernel.org/r/20240529-hwspinlock-bust-v3-2-c8b924ffa5a2@quicinc.comSigned-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 7c327d56
......@@ -64,9 +64,34 @@ static void qcom_hwspinlock_unlock(struct hwspinlock *lock)
pr_err("%s: failed to unlock spinlock\n", __func__);
}
static int qcom_hwspinlock_bust(struct hwspinlock *lock, unsigned int id)
{
struct regmap_field *field = lock->priv;
u32 owner;
int ret;
ret = regmap_field_read(field, &owner);
if (ret) {
dev_err(lock->bank->dev, "unable to query spinlock owner\n");
return ret;
}
if (owner != id)
return 0;
ret = regmap_field_write(field, 0);
if (ret) {
dev_err(lock->bank->dev, "failed to bust spinlock\n");
return ret;
}
return 0;
}
static const struct hwspinlock_ops qcom_hwspinlock_ops = {
.trylock = qcom_hwspinlock_trylock,
.unlock = qcom_hwspinlock_unlock,
.bust = qcom_hwspinlock_bust,
};
static const struct regmap_config sfpb_mutex_config = {
......
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