public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] LoongArch: dts: Add more support device ndoes to Loongson-2K
@ 2024-05-08  8:29 Binbin Zhou
  2024-05-08  8:29 ` [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500 Binbin Zhou
  2024-05-08  8:29 ` [PATCH v1 2/2] LoongArch: dts: Add new supported device nodes to Loongson-2K2000 Binbin Zhou
  0 siblings, 2 replies; 5+ messages in thread
From: Binbin Zhou @ 2024-05-08  8:29 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree
  Cc: Huacai Chen, loongson-kernel, Xuerui Wang, loongarch, Binbin Zhou

Hi all:

Now, more Loongson-2K related deviers are supported, this patchset add
these device nodes to dts files.

Thanks.

Binbin Zhou (2):
  LoongArch: dts: Add new supported device nodes to Loongson-2K0500
  LoongArch: dts: Add new supported device nodes to Loongson-2K2000

 .../boot/dts/loongson-2k0500-ref.dts          |  4 +
 arch/loongarch/boot/dts/loongson-2k0500.dtsi  | 81 ++++++++++++++++++-
 .../boot/dts/loongson-2k2000-ref.dts          |  4 +
 arch/loongarch/boot/dts/loongson-2k2000.dtsi  | 44 +++++++++-
 4 files changed, 126 insertions(+), 7 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500
  2024-05-08  8:29 [PATCH v1 0/2] LoongArch: dts: Add more support device ndoes to Loongson-2K Binbin Zhou
@ 2024-05-08  8:29 ` Binbin Zhou
  2024-05-08 16:26   ` Conor Dooley
  2024-05-08  8:29 ` [PATCH v1 2/2] LoongArch: dts: Add new supported device nodes to Loongson-2K2000 Binbin Zhou
  1 sibling, 1 reply; 5+ messages in thread
From: Binbin Zhou @ 2024-05-08  8:29 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree
  Cc: Huacai Chen, loongson-kernel, Xuerui Wang, loongarch, Binbin Zhou

By now, more Loongson-2K0500 related drivers are supported, such as
clock controller, thermal controller, and dma controller.
Now we add these device nodes to the Loongson-2K0500 dts file.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../boot/dts/loongson-2k0500-ref.dts          |  4 +
 arch/loongarch/boot/dts/loongson-2k0500.dtsi  | 81 ++++++++++++++++++-
 2 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
index 8aefb0c12672..62dad6297e82 100644
--- a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
+++ b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
@@ -41,6 +41,10 @@ linux,cma {
 	};
 };
 
+&clk {
+	status = "okay";
+};
+
 &gmac0 {
 	status = "okay";
 
diff --git a/arch/loongarch/boot/dts/loongson-2k0500.dtsi b/arch/loongarch/boot/dts/loongson-2k0500.dtsi
index 444779c21034..14345093631a 100644
--- a/arch/loongarch/boot/dts/loongson-2k0500.dtsi
+++ b/arch/loongarch/boot/dts/loongson-2k0500.dtsi
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clock/loongson,ls2k-clk.h>
 
 / {
 	#address-cells = <2>;
@@ -19,14 +20,15 @@ cpu0: cpu@0 {
 			compatible = "loongson,la264";
 			device_type = "cpu";
 			reg = <0x0>;
-			clocks = <&cpu_clk>;
+			clocks = <&clk LOONGSON2_NODE_CLK>;
 		};
 	};
 
-	cpu_clk: cpu-clk {
+	ref_100m: clock-ref-100m {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
-		clock-frequency = <500000000>;
+		clock-frequency = <100000000>;
+		clock-output-names = "ref_100m";
 	};
 
 	cpuintc: interrupt-controller {
@@ -35,6 +37,22 @@ cpuintc: interrupt-controller {
 		interrupt-controller;
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <1000>;
+			polling-delay = <5000>;
+			thermal-sensors = <&tsensor 0>;
+
+			trips {
+				cpu-crit {
+					temperature = <85000>;
+					hysteresis = <5000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	bus@10000000 {
 		compatible = "simple-bus";
 		ranges = <0x0 0x10000000 0x0 0x10000000 0x0 0x10000000>,
@@ -52,6 +70,55 @@ isa@16400000 {
 			ranges = <1 0x0 0x0 0x16400000 0x4000>;
 		};
 
+		clk: clock-controller@1fe10400 {
+			compatible = "loongson,ls2k0500-clk";
+			reg = <0x0 0x1fe10400 0x0 0x2c>;
+			#clock-cells = <1>;
+			clocks = <&ref_100m>;
+			clock-names = "ref_100m";
+			status = "disabled";
+		};
+
+		dma-controller@1fe10c00 {
+			compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
+			reg = <0 0x1fe10c00 0 0x8>;
+			interrupt-parent = <&eiointc>;
+			interrupts = <67>;
+			clocks = <&clk LOONGSON2_APB_CLK>;
+			#dma-cells = <1>;
+			status = "disabled";
+		};
+
+		dma-controller@1fe10c10 {
+			compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
+			reg = <0 0x1fe10c10 0 0x8>;
+			interrupt-parent = <&eiointc>;
+			interrupts = <68>;
+			clocks = <&clk LOONGSON2_APB_CLK>;
+			#dma-cells = <1>;
+			status = "disabled";
+		};
+
+		dma-controller@1fe10c20 {
+			compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
+			reg = <0 0x1fe10c20 0 0x8>;
+			interrupt-parent = <&eiointc>;
+			interrupts = <69>;
+			clocks = <&clk LOONGSON2_APB_CLK>;
+			#dma-cells = <1>;
+			status = "disabled";
+		};
+
+		dma-controller@1fe10c30 {
+			compatible = "loongson,ls2k0500-apbdma", "loongson,ls2k1000-apbdma";
+			reg = <0 0x1fe10c30 0 0x8>;
+			interrupt-parent = <&eiointc>;
+			interrupts = <70>;
+			clocks = <&clk LOONGSON2_APB_CLK>;
+			#dma-cells = <1>;
+			status = "disabled";
+		};
+
 		liointc0: interrupt-controller@1fe11400 {
 			compatible = "loongson,liointc-2.0";
 			reg = <0x0 0x1fe11400 0x0 0x40>,
@@ -139,6 +206,14 @@ ohci0: usb@1f058000 {
 			status = "disabled";
 		};
 
+		tsensor: thermal-sensor@1fe11500 {
+			compatible = "loongson,ls2k0500-thermal", "loongson,ls2k1000-thermal";
+			reg = <0x0 0x1fe11500 0x0 0x30>;
+			interrupt-parent = <&liointc0>;
+			interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
+			#thermal-sensor-cells = <1>;
+		};
+
 		uart0: serial@1ff40800 {
 			compatible = "ns16550a";
 			reg = <0x0 0x1ff40800 0x0 0x10>;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] LoongArch: dts: Add new supported device nodes to Loongson-2K2000
  2024-05-08  8:29 [PATCH v1 0/2] LoongArch: dts: Add more support device ndoes to Loongson-2K Binbin Zhou
  2024-05-08  8:29 ` [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500 Binbin Zhou
@ 2024-05-08  8:29 ` Binbin Zhou
  1 sibling, 0 replies; 5+ messages in thread
From: Binbin Zhou @ 2024-05-08  8:29 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree
  Cc: Huacai Chen, loongson-kernel, Xuerui Wang, loongarch, Binbin Zhou

By now, more Loongson-2K2000 related drivers are supported, such as
clock controller and thermal controller.
Now we add these device nodes to the Loongson-2K2000 dts file.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../boot/dts/loongson-2k2000-ref.dts          |  4 ++
 arch/loongarch/boot/dts/loongson-2k2000.dtsi  | 44 +++++++++++++++++--
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/arch/loongarch/boot/dts/loongson-2k2000-ref.dts b/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
index 74b99bd234cc..52daf41d7af4 100644
--- a/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
+++ b/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
@@ -39,6 +39,10 @@ linux,cma {
 	};
 };
 
+&clk {
+	status = "okay";
+};
+
 &sata {
 	status = "okay";
 };
diff --git a/arch/loongarch/boot/dts/loongson-2k2000.dtsi b/arch/loongarch/boot/dts/loongson-2k2000.dtsi
index 9eab2d02cbe8..4e717f5bad45 100644
--- a/arch/loongarch/boot/dts/loongson-2k2000.dtsi
+++ b/arch/loongarch/boot/dts/loongson-2k2000.dtsi
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clock/loongson,ls2k-clk.h>
 
 / {
 	#address-cells = <2>;
@@ -19,21 +20,22 @@ cpu0: cpu@1 {
 			compatible = "loongson,la364";
 			device_type = "cpu";
 			reg = <0x0>;
-			clocks = <&cpu_clk>;
+			clocks = <&clk LOONGSON2_NODE_CLK>;
 		};
 
 		cpu1: cpu@2 {
 			compatible = "loongson,la364";
 			device_type = "cpu";
 			reg = <0x1>;
-			clocks = <&cpu_clk>;
+			clocks = <&clk LOONGSON2_NODE_CLK>;
 		};
 	};
 
-	cpu_clk: cpu-clk {
+	ref_100m: clock-ref-100m {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
-		clock-frequency = <1400000000>;
+		clock-frequency = <100000000>;
+		clock-output-names = "ref_100m";
 	};
 
 	cpuintc: interrupt-controller {
@@ -42,6 +44,22 @@ cpuintc: interrupt-controller {
 		interrupt-controller;
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay-passive = <1000>;
+			polling-delay = <5000>;
+			thermal-sensors = <&tsensor 0>;
+
+			trips {
+				cpu-crit {
+					temperature = <85000>;
+					hysteresis = <5000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	bus@10000000 {
 		compatible = "simple-bus";
 		ranges = <0x0 0x10000000 0x0 0x10000000 0x0 0x10000000>,
@@ -58,6 +76,15 @@ isa@18400000 {
 			ranges = <1 0x0 0x0 0x18400000 0x4000>;
 		};
 
+		clk: clock-controller@10010480 {
+			compatible = "loongson,ls2k2000-clk";
+			reg = <0x0 0x10010480 0x0 0x100>;
+			#clock-cells = <1>;
+			clocks = <&ref_100m>;
+			clock-names = "ref_100m";
+			status = "disabled";
+		};
+
 		pmc: power-management@100d0000 {
 			compatible = "loongson,ls2k2000-pmc", "loongson,ls2k0500-pmc", "syscon";
 			reg = <0x0 0x100d0000 0x0 0x58>;
@@ -80,6 +107,15 @@ syscon-poweroff {
 			};
 		};
 
+		tsensor: thermal-sensor@1fe01460 {
+			compatible = "loongson,ls2k2000-thermal";
+			reg = <0x0 0x1fe01460 0x0 0x30>,
+			      <0x0 0x1fe0019c 0x0 0x4>;
+			interrupt-parent = <&liointc>;
+			interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
+			#thermal-sensor-cells = <1>;
+		};
+
 		liointc: interrupt-controller@1fe01400 {
 			compatible = "loongson,liointc-1.0";
 			reg = <0x0 0x1fe01400 0x0 0x64>;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500
  2024-05-08  8:29 ` [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500 Binbin Zhou
@ 2024-05-08 16:26   ` Conor Dooley
  2024-05-09  1:10     ` Binbin Zhou
  0 siblings, 1 reply; 5+ messages in thread
From: Conor Dooley @ 2024-05-08 16:26 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, Huacai Chen, loongson-kernel,
	Xuerui Wang, loongarch

[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]

On Wed, May 08, 2024 at 04:29:10PM +0800, Binbin Zhou wrote:
> By now, more Loongson-2K0500 related drivers are supported, such as
> clock controller, thermal controller, and dma controller.
> Now we add these device nodes to the Loongson-2K0500 dts file.
> 
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../boot/dts/loongson-2k0500-ref.dts          |  4 +
>  arch/loongarch/boot/dts/loongson-2k0500.dtsi  | 81 ++++++++++++++++++-
>  2 files changed, 82 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> index 8aefb0c12672..62dad6297e82 100644
> --- a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> +++ b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> @@ -41,6 +41,10 @@ linux,cma {
>  	};
>  };
>  
> +&clk {
> +	status = "okay";
> +};

For most devices, doing the "disable in dtsi, enable in dts" approach is
the right thing to do, but for things like clock-controllers or
architectural interrupt controllers that no-one is going to disable
since they'll not have a usable system otherwise, it's not needed.

Cheers,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500
  2024-05-08 16:26   ` Conor Dooley
@ 2024-05-09  1:10     ` Binbin Zhou
  0 siblings, 0 replies; 5+ messages in thread
From: Binbin Zhou @ 2024-05-09  1:10 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Binbin Zhou, Huacai Chen, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, Huacai Chen, loongson-kernel,
	Xuerui Wang, loongarch

On Wed, May 8, 2024 at 10:26 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Wed, May 08, 2024 at 04:29:10PM +0800, Binbin Zhou wrote:
> > By now, more Loongson-2K0500 related drivers are supported, such as
> > clock controller, thermal controller, and dma controller.
> > Now we add these device nodes to the Loongson-2K0500 dts file.
> >
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >  .../boot/dts/loongson-2k0500-ref.dts          |  4 +
> >  arch/loongarch/boot/dts/loongson-2k0500.dtsi  | 81 ++++++++++++++++++-
> >  2 files changed, 82 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> > index 8aefb0c12672..62dad6297e82 100644
> > --- a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> > +++ b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
> > @@ -41,6 +41,10 @@ linux,cma {
> >       };
> >  };
> >
> > +&clk {
> > +     status = "okay";
> > +};
>
> For most devices, doing the "disable in dtsi, enable in dts" approach is
> the right thing to do, but for things like clock-controllers or
> architectural interrupt controllers that no-one is going to disable
> since they'll not have a usable system otherwise, it's not needed.
>
Hi Conor:

Yes, as you said, it is not needed here. I will check it again.

Thanks.
Binbin

> Cheers,
> Conor.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-09  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08  8:29 [PATCH v1 0/2] LoongArch: dts: Add more support device ndoes to Loongson-2K Binbin Zhou
2024-05-08  8:29 ` [PATCH v1 1/2] LoongArch: dts: Add new supported device nodes to Loongson-2K0500 Binbin Zhou
2024-05-08 16:26   ` Conor Dooley
2024-05-09  1:10     ` Binbin Zhou
2024-05-08  8:29 ` [PATCH v1 2/2] LoongArch: dts: Add new supported device nodes to Loongson-2K2000 Binbin Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox