summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-06-17 17:07:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-06-20 16:03:50 +0200
commit1b90b3ff9233556c4082837c58462a919b14e008 (patch)
tree89bd9e45c7b4f902525dacfc3b7ba5668ace6ae0
parent0bf713e53a1f2556e66f76a368476e233e5ab89d (diff)
downloadbarebox-1b90b3ff9233556c4082837c58462a919b14e008.tar.gz
barebox-1b90b3ff9233556c4082837c58462a919b14e008.tar.xz
driver: add stubs for hardware spinlocks
Some STM32MP Linux drivers, which could be ported to barebox as part of improved second stage barebox support, are using hardware spinlocks to coordinate access between the three processors. While barebox only uses one of the two Cortex-A cores, spin locks may still be necessary because of firmware loaded unto the Cortex-M. To ease porting these drivers, without having to import the hw spinlock driver now, add stubs for the functions. The stubs will we be reused when CONFIG_HWSPINLOCK is introduced, but is disabled in config. The API is oriented after the implementation in U-Boot. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/hwspinlock.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/hwspinlock.h b/include/hwspinlock.h
new file mode 100644
index 0000000000..ba21c6d296
--- /dev/null
+++ b/include/hwspinlock.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ */
+
+#ifndef __HWSPINLOCK_H
+#define __HWSPINLOCK_H
+
+struct hwspinlock { /* TODO to be implemented */ };
+
+static inline int hwspinlock_get_by_index(struct device_d *dev,
+ int index,
+ struct hwspinlock *hws)
+{
+ return -ENOSYS;
+}
+
+static inline int hwspinlock_lock_timeout(struct hwspinlock *hws,
+ int timeout_ms)
+{
+ return -ENOSYS;
+}
+
+static inline int hwspinlock_unlock(struct hwspinlock *hws)
+{
+ return -ENOSYS;
+}
+
+struct hwspinlock_ops { /* TODO to be implemented */ };
+
+#endif /* __HWSPINLOCK_H */