summaryrefslogtreecommitdiffstats
path: root/drivers/hwspinlock
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2019-03-07 16:42:16 +0100
committerBjorn Andersson <bjorn.andersson@linaro.org>2019-06-30 06:04:24 +0200
commit5cd69f13deef804d113d31c5c744396b1a1b8a9a (patch)
treeffd22095935db3e3032910e29490bb0654926655 /drivers/hwspinlock
parenthwspinlock: ignore disabled device (diff)
downloadlinux-5cd69f13deef804d113d31c5c744396b1a1b8a9a.tar.xz
linux-5cd69f13deef804d113d31c5c744396b1a1b8a9a.zip
hwspinlock: stm32: implement the relax() ops
Implement this optional ops, called by hwspinlock core while spinning on a lock, between two successive invocations of trylock(). Reviewed-by: Benjamin Gaignard <benjamin.gaignard@st.com> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/hwspinlock')
-rw-r--r--drivers/hwspinlock/stm32_hwspinlock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c
index 441839288893..c8eacf4f9692 100644
--- a/drivers/hwspinlock/stm32_hwspinlock.c
+++ b/drivers/hwspinlock/stm32_hwspinlock.c
@@ -5,6 +5,7 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/hwspinlock.h>
#include <linux/io.h>
#include <linux/kernel.h>
@@ -42,9 +43,15 @@ static void stm32_hwspinlock_unlock(struct hwspinlock *lock)
writel(STM32_MUTEX_COREID, lock_addr);
}
+static void stm32_hwspinlock_relax(struct hwspinlock *lock)
+{
+ ndelay(50);
+}
+
static const struct hwspinlock_ops stm32_hwspinlock_ops = {
.trylock = stm32_hwspinlock_trylock,
.unlock = stm32_hwspinlock_unlock,
+ .relax = stm32_hwspinlock_relax,
};
static int stm32_hwspinlock_probe(struct platform_device *pdev)