Enable hwlock on Allwinner A64
Subsystems (4)
v2 cover Enable hwlock on Allwinner A64
The allwinner,sun6i-a31-hwspinlock compatible driver can be used with the Allwinner A64 chip. Add the wiring required to enable it.
The device tree binding needs some work to verify everything that is needed by the sun6i hwlock driver.
The hwlock device was verified to be available with this series applied on a Pinebook.
1/5 was already applied in linux-next.
Changelog:
v2:
Fix the dt-binding example for the added properties. Add a compatible string for a64.
Wording 3/5: driver -> Linux driver.
Bastian Germann (5):
dt-bindings: hwlock: sun6i: Add missing #hwlock-cells
dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
dt-bindings: hwlock: sun6i: Add missing names
dt-bindings: hwlock: sun6i: Add a64 compatible string
arm64: dts: allwinner: a64: Add hwspinlock node
.../allwinner,sun6i-a31-hwspinlock.yaml | 21 ++++++++++++++++++- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 11 ++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
Signature · 1 line
2.39.1
PATCH v2 1/5 dt-bindings: hwlock: sun6i: Add missing #hwlock-cells
The allwinner,sun6i-a31-hwspinlock.yaml binding needs #hwlock-cells which is required by the hwlock type.
--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +4 -0
@@ -26,11 +26,15 @@ properties: resets: maxItems: 1 + '#hwlock-cells': + const: 1 + required: - compatible - reg - clocks - resets + - "#hwlock-cells" additionalProperties: false
Signature · 1 line
2.39.1
PATCH v2 2/5 dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
In reply to Bastian GermannThe dt-bindings tools will compile the yaml dt examples and this prevents an error about this node not existing.
--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +1 -0
@@ -48,5 +48,6 @@ examples: reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; }; ...
Signature · 1 line
2.39.1
Re: [PATCH v2 2/5] dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
On Wed, 15 Feb 2023 21:37:07 +0100
Bastian Germann <[email protected]> wrote:
Hi,
Quoted 2 lines
The dt-bindings tools will compile the yaml dt examples and this prevents an error about this node not existing.
This needs to be part of patch 1/5, otherwise it will break bisecting. Just squash the two patches together.
Cheers,
Andre
Quoted 16 lines
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +1
-0@@ -48,5 +48,6 @@ examples: reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; };
Re: [PATCH v2 2/5] dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
Am 15.02.23 um 21:40 schrieb Andre Przywara:
Quoted 10 lines
On Wed, 15 Feb 2023 21:37:07 +0100
Bastian Germann <[email protected]> wrote:Hi,
Quoted 2 lines
The dt-bindings tools will compile the yaml dt examples and this prevents an error about this node not existing.
This needs to be part of patch 1/5, otherwise it will break bisecting. Just squash the two patches together.
Is this also okay with 1/5 already being applied in linux-next?
Quoted 21 lines
Cheers,
AndreQuoted 16 lines
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +1
-0@@ -48,5 +48,6 @@ examples: reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; };
Re: [PATCH v2 2/5] dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
Quoted 6 lines · On Wed, 15 Feb 2023 21:43:50 +0100 Bastian Germann <[email protected]> wrote:
Am 15.02.23 um 21:40 schrieb Andre Przywara:
Quoted 5 lines
On Wed, 15 Feb 2023 21:37:07 +0100
Bastian Germann <[email protected]> wrote:Hi,
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
The dt-bindings tools will compile the yaml dt examples and this prevents an error about this node not existing.
This needs to be part of patch 1/5, otherwise it will break bisecting. Just squash the two patches together.
Is this also okay with 1/5 already being applied in linux-next?
The idea of -next is to spot those things before they cause problems. I don't know if it's already too late, let's see what Bjorn says (see the other mail).
You could either send a totally separate fix patch (outside of a series), or a new series with the correct patch. But for now let's wait how this ends up.
Cheers,
Andre
Quoted 23 lines
Quoted 22 lines
Cheers,
AndreQuoted 16 lines
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +1
-0@@ -48,5 +48,6 @@ examples: reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; };
Re: [PATCH v2 2/5] dt-bindings: hwlock: sun6i: Add #hwlock-cells to example
In reply to Bastian GermannQuoted 7 lines · Bastian Germann
The dt-bindings tools will compile the yaml dt examples and this prevents an error about this node not existing.
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 1 + 1 file changed, 1 insertion(+)
so Bjorn can fix his tree. Can be also squashed with original one.
Best regards,
Krzysztof
PATCH v2 3/5 dt-bindings: hwlock: sun6i: Add missing names
In reply to Bastian GermannThe allwinner,sun6i-a31-hwspinlock.yaml binding needs clock-names and reset-names set to "ahb" as required by the Linux driver.
--- .../hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +12 -0
@@ -23,9 +23,17 @@ properties: clocks: maxItems: 1 + clock-names: + items: + - const: ahb + resets: maxItems: 1 + reset-names: + items: + - const: ahb + '#hwlock-cells': const: 1
@@ -33,7 +41,9 @@ required: - compatible - reg - clocks + - clock-names - resets + - reset-names - "#hwlock-cells" additionalProperties: false
@@ -47,7 +57,9 @@ examples: compatible = "allwinner,sun6i-a31-hwspinlock"; reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb"; resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb"; #hwlock-cells = <1>; }; ...
Signature · 1 line
2.39.1
Re: [PATCH v2 3/5] dt-bindings: hwlock: sun6i: Add missing names
Quoted 2 lines · On Wed, 15 Feb 2023 21:37:08 +0100 Bastian Germann <[email protected]> wrote:
The allwinner,sun6i-a31-hwspinlock.yaml binding needs clock-names and reset-names set to "ahb" as required by the Linux driver.
Mmmh, but I thought that Krzysztof pretty clearly NAKed this? So we have to either reach consensus on this or find another solution, like teaching the driver to comply with the existing binding. We could for instance get the first clock, should the devm_clk_get() call fail.
Cheers,
Andre
Quoted 49 lines
Fixes f9e784dcb63f ("dt-bindings: hwlock: add sun6i_hwspinlock")Signed-off-by Bastian Germann <[email protected]>--- .../hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +12
-0@@ -23,9 +23,17 @@ properties: clocks: maxItems: 1 + clock-names: + items: + - const: ahb + resets: maxItems: 1 + reset-names: + items: + - const: ahb + '#hwlock-cells': const: 1@@ -33,7 +41,9 @@ required: - compatible - reg - clocks + - clock-names - resets + - reset-names - "#hwlock-cells" additionalProperties: false@@ -47,7 +57,9 @@ examples: compatible = "allwinner,sun6i-a31-hwspinlock"; reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb"; resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb"; #hwlock-cells = <1>; };
Re: [PATCH v2 3/5] dt-bindings: hwlock: sun6i: Add missing names
Am 15.02.23 um 21:45 schrieb Andre Przywara:
Quoted 11 lines
Quoted 2 lines · On Wed, 15 Feb 2023 21:37:08 +0100 Bastian Germann <[email protected]> wrote:
The allwinner,sun6i-a31-hwspinlock.yaml binding needs clock-names and reset-names set to "ahb" as required by the Linux driver.
Mmmh, but I thought that Krzysztof pretty clearly NAKed this? So we have to either reach consensus on this or find another solution, like teaching the driver to comply with the existing binding. We could for instance get the first clock, should the
devm_clk_get()call fail.
Either way - I wanted to send a fix for the dt-binding example as Rob requested. This is not to say that I want to ignore the NAK.
Quoted 54 lines
Cheers,
AndreQuoted 49 lines
Fixes f9e784dcb63f ("dt-bindings: hwlock: add sun6i_hwspinlock")Signed-off-by Bastian Germann <[email protected]>--- .../hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +12
-0@@ -23,9 +23,17 @@ properties: clocks: maxItems: 1 + clock-names: + items: + - const: ahb + resets: maxItems: 1 + reset-names: + items: + - const: ahb + '#hwlock-cells': const: 1@@ -33,7 +41,9 @@ required: - compatible - reg - clocks + - clock-names - resets + - reset-names - "#hwlock-cells" additionalProperties: false@@ -47,7 +57,9 @@ examples: compatible = "allwinner,sun6i-a31-hwspinlock"; reg = <0x01c18000 0x1000>; clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb"; resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb"; #hwlock-cells = <1>; };
Re: [PATCH v2 3/5] dt-bindings: hwlock: sun6i: Add missing names
In reply to Bastian GermannQuoted 5 lines · Bastian Germann
The allwinner,sun6i-a31-hwspinlock.yaml binding needs clock-names and reset-names set to "ahb" as required by the Linux driver.
Fixes f9e784dcb63f ("dt-bindings: hwlock: add sun6i_hwspinlock")Signed-off-by Bastian Germann <[email protected]>
With new data, I changed my opinion and NAKed this. Still NAK, sorry. Please drop the clock/reset-names from the driver (use indices) and DTS.
NAK means Not-acknowledge. Usually you should not send the same patch after getting NAK, because it looks like you ignore the comment.
Best regards,
Krzysztof
Wilken Gottwalt
maintainerRe: [PATCH v2 3/5] dt-bindings: hwlock: sun6i: Add missing names
Quoted 9 lines · On Thu, 16 Feb 2023 09:36:08 +0100 Krzysztof Kozlowski…
Quoted 5 lines · Bastian Germann
The allwinner,sun6i-a31-hwspinlock.yaml binding needs clock-names and reset-names set to "ahb" as required by the Linux driver.
Fixes f9e784dcb63f ("dt-bindings: hwlock: add sun6i_hwspinlock")Signed-off-by Bastian Germann <[email protected]>With new data, I changed my opinion and NAKed this. Still NAK, sorry. Please drop the clock/reset-names from the driver (use indices) and DTS.
I won't be able to fix this in the next time. I'm currently in the state of moving and can't set up my hardware to test the changes. And I'm not willing to submit changes without testing. And with testing I really mean testing it against a running Crust firmware which touches the hwspinlock unit.
If someone wants to change that, I'm happy to see it working out, but please do it properly. Just testing the locks in Linux only is not sufficient. If some directions are required, I still have my working repo up at Github:
https://github.com/wgottwalt/sunxi_hwspinlock
It may be a bit dated, but should be a good start.
Greetings,
Will
PATCH v2 4/5 dt-bindings: hwlock: sun6i: Add a64 compatible string
In reply to Bastian GermannAdd an allwinner,sun50i-a64-hwspinlock compatible string to the device tree binding. The A31 and A64 have compatible hwspinlocks.
--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +3 -1
@@ -15,7 +15,9 @@ description: properties: compatible: - const: allwinner,sun6i-a31-hwspinlock + items: + - const: allwinner,sun6i-a31-hwspinlock + - const: allwinner,sun50i-a64-hwspinlock reg: maxItems: 1
Signature · 1 line
2.39.1
Re: [PATCH v2 4/5] dt-bindings: hwlock: sun6i: Add a64 compatible string
Quoted 13 lines · On Wed, 15 Feb 2023 21:37:09 +0100 Bastian Germann <[email protected]> wrote:
Add an allwinner,sun50i-a64-hwspinlock compatible string to the device tree binding. The A31 and A64 have compatible hwspinlocks.
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +0
-0
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml description: · line 20
Quoted 7 lines
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +3
-1@@ -15,7 +15,9 @@ description: properties: compatible: - const: allwinner,sun6i-a31-hwspinlock + items: + - const: allwinner,sun6i-a31-hwspinlock + - const: allwinner,sun50i-a64-hwspinlock
So this would not allow the previous single compatible string, which I think we should preserve?
You can check out other bindings (like allwinner,sun6i-a31-spi.yaml) to get an idea of how this could be written.
Cheers,
Andre
Quoted 3 lines
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +0
-0reg: maxItems: 1
Rob Herring
maintainerRe: [PATCH v2 4/5] dt-bindings: hwlock: sun6i: Add a64 compatible string
In reply to Bastian GermannQuoted 8 lines · Bastian Germann
Add an allwinner,sun50i-a64-hwspinlock compatible string to the device tree binding. The A31 and A64 have compatible hwspinlocks.
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.example.dtb: hwlock@1c18000: compatible: ['allwinner,sun6i-a31-hwspinlock'] is too short
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH v2 4/5] dt-bindings: hwlock: sun6i: Add a64 compatible string
In reply to Bastian GermannQuoted 13 lines · Bastian Germann
Add an allwinner,sun50i-a64-hwspinlock compatible string to the device tree binding. The A31 and A64 have compatible hwspinlocks.
Signed-off-by Bastian Germann <[email protected]>--- .../bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +0
-0
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml description: · line 20
Quoted 7 lines
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml +3
-1@@ -15,7 +15,9 @@ description: properties: compatible: - const: allwinner,sun6i-a31-hwspinlock + items: + - const: allwinner,sun6i-a31-hwspinlock + - const: allwinner,sun50i-a64-hwspinlock
Does not look like you tested the DTS against bindings. Please run make dtbs_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).
That's my template answer. More detailed:
Please test that your DTS changes always pass your binding changes. The above looks reversed with your DTS, thus if you tested DTS, you would see errors. Expecting that existing in-kernel DTS passes dtbs_check is a bit too much (although Samsung Exynos is almost there!), but at least new code could not introduce new errors.
Best regards,
Krzysztof
PATCH v2 5/5 arm64: dts: allwinner: a64: Add hwspinlock node
In reply to Bastian GermannAdd the hwspinlock to A64 which is already implemented for A31.
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +11 -0
@@ -851,6 +851,17 @@ wdt0: watchdog@1c20ca0 { clocks = <&osc24M>; }; + hwspinlock: hwlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock", + "allwinner,sun6i-a31-hwspinlock"; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb"; + resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb"; + #hwlock-cells = <1>; + }; + spdif: spdif@1c21000 { #sound-dai-cells = <0>; compatible = "allwinner,sun50i-a64-spdif",
Signature · 1 line
2.39.1
Re: [PATCH v2 5/5] arm64: dts: allwinner: a64: Add hwspinlock node
On Wed, 15 Feb 2023 21:37:10 +0100
Bastian Germann <[email protected]> wrote:
Hi,
Quoted 3 lines
Add the hwspinlock to A64 which is already implemented for A31.
Signed-off-by Bastian Germann <[email protected]>
This looks alright to me, but there is still the debate what to do with the names properties. So holding any tags back until this is resolved.
Cheers,
Andre
Quoted 26 lines
--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +11
-0@@ -851,6 +851,17 @@ wdt0: watchdog@1c20ca0 { clocks = <&osc24M>; }; + hwspinlock: hwlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock", + "allwinner,sun6i-a31-hwspinlock"; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb"; + resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb"; + #hwlock-cells = <1>; + }; + spdif: spdif@1c21000 { #sound-dai-cells = <0>; compatible = "allwinner,sun50i-a64-spdif",
Re: [PATCH v2 5/5] arm64: dts: allwinner: a64: Add hwspinlock node
In reply to Bastian GermannQuoted 12 lines · Bastian Germann
Add the hwspinlock to A64 which is already implemented for A31.
Signed-off-by Bastian Germann <[email protected]>--- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +0
-0
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi wdt0: watchdog@1c20ca0 { · line 859
Quoted 9 lines
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +6
-0@@ -851,6 +851,17 @@ wdt0: watchdog@1c20ca0 { clocks = <&osc24M>; }; + hwspinlock: hwlock@1c18000 { + compatible = "allwinner,sun50i-a64-hwspinlock", + "allwinner,sun6i-a31-hwspinlock"; + reg = <0x01c18000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + clock-names = "ahb";
Please drop.
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi wdt0: watchdog@1c20ca0 { · line 861
Quoted 2 lines
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +2
-0+ resets = <&ccu RST_BUS_SPINLOCK>; + reset-names = "ahb";
Please drop.
Fix the driver instead.
Best regards,
Krzysztof