Skip to content

Commit abd000d

Browse files
AaronDotchenhuacai
authored andcommitted
LoongArch: dts: Add PWM support to Loongson-2K1000
The module is supported, enable it. Also, add the pwm-fan and cooling-maps associated with it. Reviewed-by: Yanteng Si <si.yanteng@linux.dev> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 07aeb50 commit abd000d

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

arch/loongarch/boot/dts/loongson-2k1000-ref.dts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/dts-v1/;
77

8+
#include "dt-bindings/thermal/thermal.h"
89
#include "loongson-2k1000.dtsi"
910

1011
/ {
@@ -38,6 +39,13 @@
3839
linux,cma-default;
3940
};
4041
};
42+
43+
fan0: pwm-fan {
44+
compatible = "pwm-fan";
45+
cooling-levels = <255 153 85 25>;
46+
pwms = <&pwm1 0 100000 0>;
47+
#cooling-cells = <2>;
48+
};
4149
};
4250

4351
&gmac0 {
@@ -92,6 +100,22 @@
92100
#size-cells = <0>;
93101
};
94102

103+
&pwm1 {
104+
status = "okay";
105+
106+
pinctrl-0 = <&pwm1_pins_default>;
107+
pinctrl-names = "default";
108+
};
109+
110+
&cpu_thermal {
111+
cooling-maps {
112+
map0 {
113+
trip = <&cpu_alert>;
114+
cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
115+
};
116+
};
117+
};
118+
95119
&ehci0 {
96120
status = "okay";
97121
};

arch/loongarch/boot/dts/loongson-2k1000.dtsi

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
};
6969

7070
thermal-zones {
71-
cpu-thermal {
71+
cpu_thermal: cpu-thermal {
7272
polling-delay-passive = <1000>;
7373
polling-delay = <5000>;
7474
thermal-sensors = <&tsensor 0>;
@@ -322,6 +322,46 @@
322322
status = "disabled";
323323
};
324324

325+
pwm@1fe22000 {
326+
compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm";
327+
reg = <0x0 0x1fe22000 0x0 0x10>;
328+
interrupt-parent = <&liointc0>;
329+
interrupts = <24 IRQ_TYPE_LEVEL_HIGH>;
330+
clocks = <&clk LOONGSON2_APB_CLK>;
331+
#pwm-cells = <3>;
332+
status = "disabled";
333+
};
334+
335+
pwm1: pwm@1fe22010 {
336+
compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm";
337+
reg = <0x0 0x1fe22010 0x0 0x10>;
338+
interrupt-parent = <&liointc0>;
339+
interrupts = <25 IRQ_TYPE_LEVEL_HIGH>;
340+
clocks = <&clk LOONGSON2_APB_CLK>;
341+
#pwm-cells = <3>;
342+
status = "disabled";
343+
};
344+
345+
pwm@1fe22020 {
346+
compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm";
347+
reg = <0x0 0x1fe22020 0x0 0x10>;
348+
interrupt-parent = <&liointc0>;
349+
interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
350+
clocks = <&clk LOONGSON2_APB_CLK>;
351+
#pwm-cells = <3>;
352+
status = "disabled";
353+
};
354+
355+
pwm@1fe22030 {
356+
compatible = "loongson,ls2k1000-pwm", "loongson,ls7a-pwm";
357+
reg = <0x0 0x1fe22030 0x0 0x10>;
358+
interrupt-parent = <&liointc0>;
359+
interrupts = <27 IRQ_TYPE_LEVEL_HIGH>;
360+
clocks = <&clk LOONGSON2_APB_CLK>;
361+
#pwm-cells = <3>;
362+
status = "disabled";
363+
};
364+
325365
pmc: power-management@1fe27000 {
326366
compatible = "loongson,ls2k1000-pmc", "loongson,ls2k0500-pmc", "syscon";
327367
reg = <0x0 0x1fe27000 0x0 0x58>;

0 commit comments

Comments
 (0)