linux-stable/drivers/hwspinlock
Wilken Gottwalt 3c881e05c8 hwspinlock: add sun6i hardware spinlock support
Adds the sun6i_hwspinlock driver for the hardware spinlock unit found in
most of the sun6i compatible SoCs.

This unit provides at least 32 spinlocks in hardware. The implementation
supports 32, 64, 128 or 256 32bit registers. A lock can be taken by
reading a register and released by writing a 0 to it. This driver
supports all 4 spinlock setups, but for now only the first setup (32
locks) seem to exist in available devices. This spinlock unit is shared
between all ARM cores and the embedded companion core. All of them can
take/release a lock with a single cycle operation. It can be used to
sync access to devices shared by the ARM cores and the companion core.

There are two ways to check if a lock is taken. The first way is to read
a lock. If a 0 is returned, the lock was free and is taken now. If an 1
is returned, the caller has to try again. Which means the lock is taken.
The second way is to read a 32bit wide status register where every bit
represents one of the 32 first locks. According to the datasheets this
status register supports only the 32 first locks. This is the reason the
first way (lock read/write) approach is used to be able to cover all 256
locks in future devices. The driver also reports the amount of supported
locks via debugfs.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/bfd2b97307c2321b15c09683f4bd5e1fcc792f13.1615713499.git.wilken.gottwalt@posteo.net
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-05-27 22:19:42 -05:00
..
hwspinlock_core.c hwspinlock: Let the PM runtime can be optional 2019-11-08 16:42:00 -08:00
hwspinlock_internal.h hwspinlock: hwspinlock_internal.h: Replace zero-length array with flexible-array member 2020-03-25 22:30:46 -07:00
Kconfig hwspinlock: add sun6i hardware spinlock support 2021-05-27 22:19:42 -05:00
Makefile hwspinlock: add sun6i hardware spinlock support 2021-05-27 22:19:42 -05:00
omap_hwspinlock.c hwspinlock: omap: Add support for K3 AM64x SoCs 2021-02-09 11:36:50 -06:00
qcom_hwspinlock.c hwspinlock: qcom: Allow mmio usage in addition to syscon 2020-07-13 22:29:28 -07:00
sprd_hwspinlock.c hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match' 2020-11-17 21:42:13 -06:00
stm32_hwspinlock.c hwspinlock: stm32: convert to devm_platform_ioremap_resource 2019-12-28 20:43:23 -08:00
sun6i_hwspinlock.c hwspinlock: add sun6i hardware spinlock support 2021-05-27 22:19:42 -05:00
u8500_hsem.c hwspinlock: u8500_hsem: Remove redundant PM runtime implementation 2019-11-08 16:42:26 -08:00