Add support for hwspinlock on A64 SoC
v2 cover Add support for hwspinlock on A64 SoC
Here's v2 of hwspinlock support in A64 SoC. Main changes:
* Rewrote dt bindings in yaml
* Re-arranged hwspinlock node in dts to follow ascending address order
* Sorted includes alphabetically
* Minor style changes
* Use GENMASK/FIELD_GET to query number of locks from mmio register
* Separate hwspinlock_device from sun50i_hwspinlock. This enables to utilize devm_add_action_or_reset, which results in cleaner error handling in the probe function.
* Switched to device managed resources where applicable.
This was tested on a pine64 board. I loadeded/unloaded the driver checking the state of clock/reset/sysstatus registers as well as trying lock/unlock operations (using the devmem busybox utility).
Nikolay Borisov (3):
hwspinlock: sunxi: Implement support for Allwinner's A64 SoC
arm64: dts: allwinner: a64: Add hwspinlock node
dt-bindings: hwlock: Document A64 hwspinlock bindings
.../allwinner,sun50i-a64-hwspinlock.yaml | 47 +++++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 + drivers/hwspinlock/Kconfig | 9 + drivers/hwspinlock/Makefile | 1 + drivers/hwspinlock/sun50i_hwspinlock.c | 163 ++++++++++++++++++ 5 files changed, 229 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml create mode 100644 drivers/hwspinlock/sun50i_hwspinlock.c
--
2.17.1
PATCH v2 1/3 hwspinlock: sunxi: Implement support for Allwinner's A64 SoC
Based on the datasheet this implements support for the hwspinlock IP block.
--- drivers/hwspinlock/Kconfig | 9 ++ drivers/hwspinlock/Makefile | 1 + drivers/hwspinlock/sun50i_hwspinlock.c | 163 +++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 drivers/hwspinlock/sun50i_hwspinlock.c
drivers/hwspinlock/Kconfig +9 -0
@@ -68,3 +68,12 @@ config HSEM_U8500 SoC. If unsure, say N. + +config HWSPINLOCK_SUN50I + tristate "Allwinner Hardware Spinlock device" + depends on ARCH_SUNXI + depends on HWSPINLOCK + help + Say y here to support the SUNXI Hardware Spinlock device. + + If unsure, say N.
drivers/hwspinlock/Makefile +1 -0
@@ -8,5 +8,6 @@ obj-$(CONFIG_HWSPINLOCK_OMAP) += omap_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_QCOM) += qcom_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_SIRF) += sirf_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_SPRD) += sprd_hwspinlock.o +obj-$(CONFIG_HWSPINLOCK_SUN50I) += sun50i_hwspinlock.o obj-$(CONFIG_HWSPINLOCK_STM32) += stm32_hwspinlock.o obj-$(CONFIG_HSEM_U8500) += u8500_hsem.o
drivers/hwspinlock/sun50i_hwspinlock.c new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/3 arm64: dts: allwinner: a64: Add hwspinlock node
In reply to Nikolay BorisovAdd a node describing the hwspinlock on A64.
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +9 -0
@@ -496,6 +496,15 @@ resets = <&ccu RST_BUS_CE>; }; + hwspinlock: spinlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock"; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; + status = "ok"; + }; + usb_otg: usb@1c19000 { compatible = "allwinner,sun8i-a33-musb"; reg = <0x01c19000 0x0400>;
Signature · 1 line
2.17.1
PATCH v2 3/3 dt-bindings: hwlock: Document A64 hwspinlock bindings
In reply to Nikolay BorisovAdd binding for the hwspinlock found on Allwinner A64 SoC.
--- .../allwinner,sun50i-a64-hwspinlock.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml
Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml new file +47 -0
@@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwlock/allwinner,sun50i-a64-hwspinlock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner A64 SoC Hardware Spinlock bindings + +maintainers: + - Nikolay Borisov <[email protected]> + +properties: + "#hwlock-cells": + const: 1 + + compatible: + const: allwinner,sun50i-a64-hwspinlock + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + resets: + maxItems: 1 + +required: + - "#hwlock-cells" + - compatible + - reg + - clocks + - resets + +additionalProperties: false + +examples: + - | + hwspinlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock"; + #hwlock-cells = <1>; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + resets = <&ccu RST_BUS_SPINLOCK>; + }; + +...
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v2 3/3] dt-bindings: hwlock: Document A64 hwspinlock bindings
Quoted 8 lines · Nikolay Borisov
Add binding for the hwspinlock found on Allwinner A64 SoC.
Signed-off-by Nikolay Borisov <[email protected]>--- .../allwinner,sun50i-a64-hwspinlock.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml
My bot found errors running 'make dt_binding_check' on your patch:
Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dts:21.28-29 syntax error
FATAL ERROR: Unable to parse input treescripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dt.yaml' failed make[1]: *** [Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2
See https://patchwork.ozlabs.org/patch/1236266
Please check and re-submit.
Re: [PATCH v2 3/3] dt-bindings: hwlock: Document A64 hwspinlock bindings
Quoted 20 lines · Rob Herring
Quoted 8 lines · Nikolay Borisov
Add binding for the hwspinlock found on Allwinner A64 SoC.
Signed-off-by Nikolay Borisov <[email protected]>--- .../allwinner,sun50i-a64-hwspinlock.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yamlMy bot found errors running 'make
dt_binding_check' on your patch:Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (
chosen_node_is_root): /example-0/chosen: chosen node must be at root node
Error: Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dts:21.28-29 syntax error
FATAL ERROR: Unable to parse input treescripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dt.yaml' failed make[1]: *** [Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2
Quoted 3 lines
See https://patchwork.ozlabs.org/patch/1236266
Please check and re-submit.
I'm not able to build this schema at all:
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- allmodconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml
This results in a allwinner,sun50i-a64-hwspinlock.example.dts file and:
make[1]: *** No rule to make target 'Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.example.dt.yaml', needed by '__build'. Stop. Makefile:1263: recipe for target 'dt_binding_check' failed
PATCH v3 1/1 dt-bindings: hwlock: Document A64 hwspinlock bindings
In reply to Nikolay BorisovAdd binding for the hwspinlock found on Allwinner A64 SoC.
---
V3: Added #include directive. This makes the patch pass schema validation.
.../allwinner,sun50i-a64-hwspinlock.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml
Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwlock/allwinner,sun50i-a64-hwspinlock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner A64 SoC Hardware Spinlock bindings + +maintainers: + - Nikolay Borisov <[email protected]> + +properties: + "#hwlock-cells": + const: 1 + + compatible: + const: allwinner,sun50i-a64-hwspinlock + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + resets: + maxItems: 1 + +required: + - "#hwlock-cells" + - compatible + - reg + - clocks + - resets + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/sun50i-a64-ccu.h> + #include <dt-bindings/reset/sun50i-a64-ccu.h> + hwspinlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock"; + #hwlock-cells = <1>; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + resets = <&ccu RST_BUS_SPINLOCK>; + }; + +...
--
2.17.1
Re: [PATCH v3] dt-bindings: hwlock: Document A64 hwspinlock bindings
Quoted 11 lines · Nikolay Borisov
Add binding for the hwspinlock found on Allwinner A64 SoC.
Signed-off-by Nikolay Borisov <[email protected]>---
V3: Added #include directive. This makes the patch pass schema validation.
.../allwinner,sun50i-a64-hwspinlock.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/allwinner,sun50i-a64-hwspinlock.yaml