Introduce reset driver for T-HEAD th1520 SoC
A message that is not in the archive (sent off-list or not yet received): CGME20230918045133epcas1p42fa41cb80a1250b9db28f398b31d041c@epcas1p4.samsung.com
v3 cover Introduce reset driver for T-HEAD th1520 SoC
This patchset adds initial support for reset driver. Register information is from vendor kernel [1].
I sent an e-mail to get permission the original author, but there was no answer. So I upload patch since it has GPL license.
This patch also can be tested with watchdog simply with
watchdog0: watchdog@ffefc30000 {
compatible = "snps,dw-wdt";
reg = <0xff 0xefc30000 0x0 0x1000>;
interrupts = <24 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&osc>;
resets = <&rst TH1520_RESET_WDT0>;
};[1] https://github.com/revyos/thead-kernel
Changelog:
v2:
https://lore.kernel.org/linux-riscv/[email protected]/
- wrong patch version
- yaml file indent
- missing vendor prefix
- drop okay
rfc:
https://lore.kernel.org/linux-riscv/[email protected]/
- dt_binding_check
- enable reset controller default
Kwanghoon Son (3):
dt-bindings: reset: Document th1520 reset control
reset: Add th1520 reset driver support
riscv: dts: Add th1520 reset device tree
.../bindings/reset/thead,th1520-reset.yaml | 44 +++++++ arch/riscv/boot/dts/thead/th1520.dtsi | 7 ++ drivers/reset/Kconfig | 10 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-th1520.c | 109 ++++++++++++++++++ .../dt-bindings/reset/thead,th1520-reset.h | 9 ++ 6 files changed, 180 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml create mode 100644 drivers/reset/reset-th1520.c create mode 100644 include/dt-bindings/reset/thead,th1520-reset.h
Signature · 1 line
2.34.1
PATCH v3 1/3 dt-bindings: reset: Document th1520 reset control
Add documentation to describe th1520 reset device
--- .../bindings/reset/thead,th1520-reset.yaml | 44 +++++++++++++++++++ .../dt-bindings/reset/thead,th1520-reset.h | 9 ++++ 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml create mode 100644 include/dt-bindings/reset/thead,th1520-reset.h
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +44 -0
@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/thead,th1520-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: T-HEAD th1520 SoC Reset Controller + +maintainers: + - Kwanghoon Son <[email protected]> + +properties: + compatible: + items: + - const: thead,th1520-reset + - const: syscon + + reg: + maxItems: 1 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/thead,th1520-reset.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + reset-controller@ffef014000 { + compatible = "thead,th1520-reset", "syscon"; + reg = <0xff 0xef014000 0x0 0x1000>; + #reset-cells = <1>; + }; + };
include/dt-bindings/reset/thead,th1520-reset.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef DT_BINDING_RESET_TH1520_H +#define DT_BINDING_RESET_TH1520_H + +#define TH1520_RESET_WDT0 0 +#define TH1520_RESET_WDT1 1 + +#endif
Signature · 1 line
2.34.1
Re: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
Quoted 1 line · Kwanghoon Son
Add documentation to describe th1520 reset device
I would appreciate if you could add some information here as to what is missing from this - the reset controller isn't just for two WDTs is it?
Quoted 21 lines
Signed-off-by Kwanghoon Son <[email protected]>--- .../bindings/reset/thead,th1520-reset.yaml | 44 +++++++++++++++++++ .../dt-bindings/reset/thead,th1520-reset.h | 9 ++++ 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml create mode 100644 include/dt-bindings/reset/thead,th1520-reset.hDocumentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +6
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/thead,th1520-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +10
-0+title: T-HEAD th1520 SoC Reset Controller + +maintainers: + - Kwanghoon Son <[email protected]> + +properties: + compatible: + items: + - const: thead,th1520-reset + - const: syscon
iDumb question perhaps, but why is this a syscon?
Cheers,
Conor.
Quoted 41 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +28
-0+ + reg: + maxItems: 1 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/thead,th1520-reset.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + reset-controller@ffef014000 { + compatible = "thead,th1520-reset", "syscon"; + reg = <0xff 0xef014000 0x0 0x1000>; + #reset-cells = <1>; + }; + };include/dt-bindings/reset/thead,th1520-reset.h new file +7
-0@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef DT_BINDING_RESET_TH1520_H +#define DT_BINDING_RESET_TH1520_H + +#define TH1520_RESET_WDT0 0 +#define TH1520_RESET_WDT1 1
RE: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
Quoted 4 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 2 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +2
-0+ - const: thead,th1520-reset + - const: sysconiDumb question perhaps, but why is this a syscon?
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followed drivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.
Regards,
Kwang.
Quoted 9 lines
Cheers,
Conor.Quoted 6 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +6
-0+ + reg: + maxItems: 1 + + '#reset-cells': + const: 1
RE: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
In reply to Conor DooleyQuoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 2 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +2
-0+ - const: thead,th1520-reset + - const: sysconiDumb question perhaps, but why is this a syscon?
Quoted 8 lines
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followeddrivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.Regards,
Kwang.
I have investigated vendor kernels, but it is still not sure reset information. I thought this is about sys_reg, but without datasheet, can't tell. Therefore, should be stopped patch for a while until knows better comes out.
Kwang.
Quoted 9 lines
Quoted 9 lines
Cheers,
Conor.Quoted 6 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +6
-0+ + reg: + maxItems: 1 + + '#reset-cells': + const: 1
Re: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
Guo,
Quoted 5 lines · Kwanghoon Son
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 2 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +2
-0+ - const: thead,th1520-reset + - const: sysconiDumb question perhaps, but why is this a syscon?
Quoted 8 lines
Quoted 4 lines
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followeddrivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.I have investigated vendor kernels, but it is still not sure reset information. I thought this is about
sys_reg, but without datasheet, can't tell. Therefore, should be stopped patch for a while until knows better comes out.
Is there documentation in English you can provide to these people that are trying to add support for your product?
Thanks,
Conor.
Guo Ren
maintainerRe: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
Quoted 14 lines · Conor Dooley
Guo,
Quoted 9 lines · Kwanghoon Son
Quoted 9 lines
Quoted 4 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 2 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +2
-0+ - const: thead,th1520-reset + - const: sysconiDumb question perhaps, but why is this a syscon?
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followeddrivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.
Quoted 6 lines
Quoted 3 lines
I have investigated vendor kernels, but it is still not sure reset information. I thought this is about
sys_reg, but without datasheet, can't tell. Therefore, should be stopped patch for a while until knows better comes out.Is there documentation in English you can provide to these people that are trying to add support for your product?
Yes, Fuwei would help with this, and thx for all of your work.
Quoted 3 lines
Thanks,
Conor.
Signature · 2 lines
Best Regards Guo Ren
Re: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
In reply to Conor DooleyQuoted 13 lines · Conor Dooley
Guo,
Quoted 9 lines · Kwanghoon Son
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
+ - const: thead,th1520-reset
+ - const: sysconiDumb question perhaps, but why is this a syscon?
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followeddrivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.
Quoted 6 lines
Quoted 3 lines
I have investigated vendor kernels, but it is still not sure reset information. I thought this is about
sys_reg, but without datasheet, can't tell. Therefore, should be stopped patch for a while until knows better comes out.Is there documentation in English you can provide to these people that are trying to add support for your product?
It can be downloaded from
https://dl.sipeed.com/shareURL/LICHEE/licheepi4a/09_Doc now. Click on "TH1520 User Manual.zip" and enter a captcha. The doc about resetting is in chapter 5 of "TH1520 System User Manual.pdf".
Signature · 2 lines
Xi Ruoyao <[email protected]> School of Aerospace Science and Technology, Xidian University
Re: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
Quoted 18 lines · Xi Ruoyao
Quoted 17 lines · Conor Dooley
Guo,
Quoted 13 lines · Kwanghoon Son
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
+ - const: thead,th1520-reset
+ - const: sysconiDumb question perhaps, but why is this a syscon?
This is good point.
In fact, I took it from the vendor kernel, and I tried to keep it as same as I could. Vendor also followeddrivers/reset/reset-imx7.c
As Rob said, if don't need it, I'll change it.I have investigated vendor kernels, but it is still not sure reset information. I thought this is about
sys_reg, but without datasheet, can't tell. Therefore, should be stopped patch for a while until knows better comes out.
Quoted 7 lines
Quoted 2 lines
Is there documentation in English you can provide to these people that are trying to add support for your product?
It can be downloaded from
https://dl.sipeed.com/shareURL/LICHEE/licheepi4a/09_Doc now. Click on "TH1520 User Manual.zip" and enter a captcha. The doc about resetting is in chapter 5 of "TH1520 System User Manual.pdf".
Thanks Xi! Pity there was no response from the vendor to this for months :(
Rob Herring
maintainerRe: [PATCH v3 1/3] dt-bindings: reset: Document th1520 reset control
In reply to Kwanghoon SonQuoted 22 lines · Kwanghoon Son
Add documentation to describe th1520 reset device
Signed-off-by Kwanghoon Son <[email protected]>--- .../bindings/reset/thead,th1520-reset.yaml | 44 +++++++++++++++++++ .../dt-bindings/reset/thead,th1520-reset.h | 9 ++++ 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml create mode 100644 include/dt-bindings/reset/thead,th1520-reset.hDocumentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +6
-0@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/thead,th1520-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml new file +10
-0+title: T-HEAD th1520 SoC Reset Controller + +maintainers: + - Kwanghoon Son <[email protected]> + +properties: + compatible: + items: + - const: thead,th1520-reset + - const: syscon
Why do you need "syscon"? Are there other functions? If so, please describe them in top-level "description". If not, drop "syscon" and use device_node_to_regmap() instead of syscon_node_to_regmap().
Rob
PATCH v3 2/3 reset: Add th1520 reset driver support
In reply to Kwanghoon SonThis driver supports th1520 T-HEAD SoC reset platform device.
--- drivers/reset/Kconfig | 10 ++++ drivers/reset/Makefile | 1 + drivers/reset/reset-th1520.c | 109 +++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 drivers/reset/reset-th1520.c
drivers/reset/Kconfig +10 -0
@@ -253,6 +253,16 @@ config RESET_SUNXI help This enables the reset driver for Allwinner SoCs. +config RESET_TH1520 + bool "TH1520 Reset Driver" + depends on (ARCH_THEAD || COMPILE_TEST) && OF + select MFD_SYSCON + default ARCH_THEAD + help + Support for the T-HEAD 1520 RISC-V SoC reset controller. + Say Y if you want to control reset signals provided by this + controller. + config RESET_TI_SCI tristate "TI System Control Interface (TI-SCI) reset driver" depends on TI_SCI_PROTOCOL || (COMPILE_TEST && TI_SCI_PROTOCOL=n)
drivers/reset/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_RESET_SUNPLUS) += reset-sunplus.o obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o +obj-$(CONFIG_RESET_TH1520) += reset-th1520.o obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o obj-$(CONFIG_RESET_TI_TPS380X) += reset-tps380x.o
drivers/reset/reset-th1520.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 3/3 riscv: dts: Add th1520 reset device tree
In reply to Kwanghoon SonAdd reset device tree for th1520 SoC
--- arch/riscv/boot/dts/thead/th1520.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/riscv/boot/dts/thead/th1520.dtsi +7 -0
@@ -5,6 +5,7 @@ */ #include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/reset/thead,th1520-reset.h> / { compatible = "thead,th1520";
@@ -418,5 +419,11 @@ portf: gpio-controller@0 { interrupts = <55 IRQ_TYPE_LEVEL_HIGH>; }; }; + + rst: reset-controller@ffef014000 { + compatible = "thead,th1520-reset", "syscon"; + reg = <0xff 0xef014000 0x0 0x1000>; + #reset-cells = <1>; + }; }; };
Signature · 1 line
2.34.1