diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts index 4020c727f09e8e..f696db01353c5b 100644 --- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts +++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts @@ -4,6 +4,7 @@ */ #include "th1520-lichee-module-4a.dtsi" +#include / { model = "Sipeed Lichee Pi 4A"; @@ -28,6 +29,58 @@ chosen { stdout-path = "serial0:115200n8"; }; + + gpio_pwm: gpio-pwm { + #pwm-cells = <3>; + compatible = "pwm-gpio"; + gpios = <&gpio3 3 GPIO_ACTIVE_HIGH>; + }; + + fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + pwms = <&gpio_pwm 0 100000000 0>; + cooling-levels = <0 66 196 255>; + }; +}; + +&cpu_thermal_zone { + trips { + fan_trip0: fan-trip-0 { + temperature = <40000>; + hysteresis = <8000>; + type = "active"; + }; + + fan_trip1: fan-trip-1 { + temperature = <50000>; + hysteresis = <8000>; + type = "active"; + }; + + fan_trip2: fan-trip-2 { + temperature = <60000>; + hysteresis = <8000>; + type = "active"; + }; + }; + + cooling-maps { + map-active-0 { + cooling-device = <&fan 1 1>; + trip = <&fan_trip0>; + }; + + map-active-1 { + cooling-device = <&fan 2 2>; + trip = <&fan_trip1>; + }; + + map-active-2 { + cooling-device = <&fan 3 3>; + trip = <&fan_trip2>; + }; + }; }; &padctrl0_apsys { diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi index 42724bf7e90e08..b549852201de60 100644 --- a/arch/riscv/boot/dts/thead/th1520.dtsi +++ b/arch/riscv/boot/dts/thead/th1520.dtsi @@ -674,6 +674,10 @@ reg-names = "common", "ts", "pd", "vm"; clocks = <&aonsys_clk>; #thermal-sensor-cells = <1>; + moortec,ts-coeff-g = <42740>; + moortec,ts-coeff-h = <220500>; + moortec,ts-coeff-j = <(-160)>; + moortec,ts-coeff-cal5 = <4094>; }; gpio@fffff52000 { @@ -695,4 +699,29 @@ }; }; }; + + thermal-zones { + cpu_thermal_zone: cpu-thermal { + polling-delay-passive = <250>; + polling-delay = <15000>; + + thermal-sensors = <&pvt 0>; + + trips { + cpu_crit: crit-trip { + /* milliCelsius */ + temperature = <110000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + + ddrc-thermal { + polling-delay-passive = <250>; + polling-delay = <15000>; + + thermal-sensors = <&pvt 1>; + }; + }; };