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@xxxxxxxxxxxxxx> --- include/hwspinlock.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/hwspinlock.h diff --git a/include/hwspinlock.h b/include/hwspinlock.h new file mode 100644 index 000000000000..ba21c6d29695 --- /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 */ -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox