[PATCH v2 0/2] hwspinlock: add sunxi hardware spinlock support

From: Wilken Gottwalt
Date: Fri Dec 04 2020 - 10:34:54 EST


Most of the Allwinner sun8i and sun50i based SoCs contain a spinlock
unit which can be used to sync access to devices shared between the ARM
cores in the embedded OpenRisc (AR100) core. This spinlock unit is
included in the A83T, A64, H2+, H3, H5 and H6 SoCs and according to the
datasheets support at least 32 spinlocks. The implementation supports
32, 64, 128 and 256 spinlock setups, but there is no known SoC yet,
which supports more the 32.

This driver adds support for this hardware spinlock unit to Linux
including all 4 possible setups. The driver reports the found setup via
debugfs. It can be build as a builtin and normal module by using the
HWSPINLOCK_SUNXI symbol.

This driver is the first step to enable hwspinlock support in Linux,
but also needs support on the OpenRisc core side in the crust firmware.
This patch provides the driver and binding documentation but is not yet
included into the sun8i and sun50i dtsi files. Also not every sun8i or
sun50i SoC seem to have support for this hardware. For example the H616
is missing the whole spinlock section in the datasheets.

This patch adds:
- hwspinlock driver sunxi_hwspinlock
- updates makefiles
- hwspinlock dt bindings documentation
- updates MAINTAINERS

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@xxxxxxxxxx>

Changes in v2:
- redone coverletter
- fixed ranges in the device tree description
- added suggestions from Bjorn Andersson and Maxime Ripard to the driver
- provided better driver and test description

Wilken Gottwalt (2):
dt-bindings: hwlock: sunxi: add sunxi_hwspinlock documentation
hwspinlock: add sunxi hardware spinlock support

.../bindings/hwlock/sunxi-hwspinlock.yaml | 64 +++++
MAINTAINERS | 6 +
drivers/hwspinlock/Kconfig | 9 +
drivers/hwspinlock/Makefile | 1 +
drivers/hwspinlock/sunxi_hwspinlock.c | 234 ++++++++++++++++++
5 files changed, 314 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwlock/sunxi-hwspinlock.yaml
create mode 100644 drivers/hwspinlock/sunxi_hwspinlock.c

--
2.29.2