Support reset controller of Loongson 2K0300 SoC
Subsystems (3)
cover Support reset controller of Loongson 2K0300 SoC
Different from previous Loongson SoCs, 2K0300 integrates a reset controller that provides reset signals represented by contiguous, distinct register bits for almost every SoC function block. This series adds its dt-binding and implements its support through reset-simple driver.
Reset functionalities are tested with UARTs and GPIO module, it's verified the module won't work with the corresponding reset asserted.
The devicetree patch (PATCH 3) depends on series "Support pinctrl for Loongson 2K0300 SoC" for a clean apply. Thanks for your time and review.
[1]: https://lore.kernel.org/all/[email protected]/
Yao Zi (3):
dt-bindings: reset: Document reset controller of Loongson 2K0300 SoC
reset: simple: Support Loongson 2K0300 SoC
LoongArch: dts: Add reset controller for Loongson 2K0300
.../reset/loongson,ls2k0300-reset.yaml | 35 ++++++++++ arch/loongarch/boot/dts/loongson-2k0300.dtsi | 17 +++++ drivers/reset/reset-simple.c | 2 + .../reset/loongson,ls2k0300-reset.h | 70 +++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml create mode 100644 include/dt-bindings/reset/loongson,ls2k0300-reset.h
Signature · 1 line
2.50.1
PATCH 1/3 dt-bindings: reset: Document reset controller of Loongson 2K0300 SoC
Add bindings for the reset controller of Loongson 2K0300 SoC.
--- .../reset/loongson,ls2k0300-reset.yaml | 35 ++++++++++ .../reset/loongson,ls2k0300-reset.h | 70 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml create mode 100644 include/dt-bindings/reset/loongson,ls2k0300-reset.h
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml new file +35 -0
@@ -0,0 +1,35 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/loongson,ls2k0300-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Loongson 2K0300 SoC Reset Controller + +maintainers: + - Yao Zi <[email protected]> + +properties: + compatible: + const: loongson,ls2k0300-reset + + reg: + maxItems: 1 + + "#reset-cells": + const: 1 + +required: + - compatible + - reg + - "#reset-cells" + +additionalProperties: false + +examples: + - | + rst: reset-controller@1600011c { + compatible = "loongson,ls2k0300-reset"; + reg = <0x1600011c 0x8>; + #reset-cells = <1>; + };
include/dt-bindings/reset/loongson,ls2k0300-reset.h new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
2.50.1
Re: [PATCH 1/3] dt-bindings: reset: Document reset controller of Loongson 2K0300 SoC
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml line 31
Quoted 6 lines · Yao Zi
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml new file +6
-0+ +additionalProperties: false + +examples: + - | + rst: reset-controller@1600011c {
Drop unused label
include/dt-bindings/reset/loongson,ls2k0300-reset.h line 1
Quoted 11 lines
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml new file +4
-0+ compatible = "loongson,ls2k0300-reset"; + reg = <0x1600011c 0x8>; + #reset-cells = <1>; + };include/dt-bindings/reset/loongson,ls2k0300-reset.h new file +1
-0@@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
Why not using same license as the binding?
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: reset: Document reset controller of Loongson 2K0300 SoC
Quoted 11 lines · Krzysztof Kozlowski
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml line 31
Quoted 6 lines · Yao Zi
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml new file +6
-0+ +additionalProperties: false + +examples: + - | + rst: reset-controller@1600011c {Drop unused label
Quoted 13 lines
include/dt-bindings/reset/loongson,ls2k0300-reset.h line 1
Quoted 11 lines
Documentation/devicetree/bindings/reset/loongson,ls2k0300-reset.yaml new file +4
-0+ compatible = "loongson,ls2k0300-reset"; + reg = <0x1600011c 0x8>; + #reset-cells = <1>; + };include/dt-bindings/reset/loongson,ls2k0300-reset.h new file +1
-0@@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ Why not using same license as the binding?
I was referring to another binding's header when writing this, and yes it's better to keep them the same.
Quoted 2 lines
Reviewed-by Krzysztof Kozlowski <[email protected]>
Will fix these issues and carry the tag in v2, thanks.
Quoted 2 lines
Best regards,
Krzysztof
Best regards,
Yao Zi
PATCH 2/3 reset: simple: Support Loongson 2K0300 SoC
In reply to Yao ZiThe controller has contiguous distinct control bits for each reset signal, where setting to low represents reset assertion. Add support for it through the reset-simple driver.
--- drivers/reset/reset-simple.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/reset/reset-simple.c +2 -0
@@ -155,6 +155,8 @@ static const struct of_device_id reset_simple_dt_ids[] = { .data = &reset_simple_active_low }, { .compatible = "sophgo,sg2042-reset", .data = &reset_simple_active_low }, + { .compatible = "loongson,ls2k0300-reset", + .data = &reset_simple_active_low }, { /* sentinel */ }, };
Signature · 1 line
2.50.1
PATCH 3/3 LoongArch: dts: Add reset controller for Loongson 2K0300
In reply to Yao ZiDescribe the reset controller and add resets for UART nodes.
--- arch/loongarch/boot/dts/loongson-2k0300.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/loongarch/boot/dts/loongson-2k0300.dtsi +17 -0
@@ -7,6 +7,7 @@ /dts-v1/; #include <dt-bindings/clock/loongson,ls2k0300-clk.h> +#include <dt-bindings/reset/loongson,ls2k0300-reset.h> #include <dt-bindings/interrupt-controller/irq.h> #define PINMUX(pin, func) (((pin) << 8) | func)
@@ -50,6 +51,12 @@ soc@10000000 { <0x00 0x02000000 0x00 0x02000000 0x0 0x04000000>, <0x00 0x40000000 0x00 0x40000000 0x0 0x40000000>; + rst: reset-controller@1600011c { + compatible = "loongson,ls2k0300-reset"; + reg = <0x0 0x1600011c 0x0 0x8>; + #reset-cells = <1>; + }; + clk: clock-controller@16000400 { compatible = "loongson,ls2k0300-clk"; reg = <0x0 0x16000400 0x0 0x30>;
@@ -128,6 +135,7 @@ uart0: serial@16100000 { compatible = "ns16550a"; reg = <0 0x16100000 0 0x10>; clocks = <&clk LS2K0300_CLK_APB_GATE>; + resets = <&rst RST_UART0>; interrupt-parent = <&liointc0>; interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; no-loopback-test;
@@ -141,6 +149,7 @@ uart1: serial@16100400 { reg = <0 0x16100400 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART1>; no-loopback-test; pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>;
@@ -152,6 +161,7 @@ uart2: serial@16100800 { reg = <0 0x16100800 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART2>; no-loopback-test; pinctrl-names = "default"; pinctrl-0 = <&uart2_pins>;
@@ -163,6 +173,7 @@ uart3: serial@16100c00 { reg = <0 0x16100c00 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART3>; no-loopback-test; pinctrl-names = "default"; pinctrl-0 = <&uart3_pins>;
@@ -174,6 +185,7 @@ uart4: serial@16101000 { reg = <0 0x16101000 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART4>; no-loopback-test; status = "disabled"; };
@@ -183,6 +195,7 @@ uart5: serial@16101400 { reg = <0 0x16101400 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART5>; no-loopback-test; status = "disabled"; };
@@ -192,6 +205,7 @@ uart6: serial@16101800 { reg = <0 0x16101800 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART6>; no-loopback-test; status = "disabled"; };
@@ -201,6 +215,7 @@ uart7: serial@16101c00 { reg = <0 0x16101c00 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART7>; no-loopback-test; status = "disabled"; };
@@ -210,6 +225,7 @@ uart8: serial@16102000 { reg = <0 0x16102000 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART8>; no-loopback-test; status = "disabled"; };
@@ -219,6 +235,7 @@ uart9: serial@16102400 { reg = <0 0x16102400 0 0x10>; interrupt-parent = <&liointc0>; interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + resets = <&rst RST_UART9>; no-loopback-test; status = "disabled"; };
Signature · 1 line
2.50.1