1// SPDX-License-Identifier: GPL-2.0 OR MIT
2/*
3 * Copyright (C) 2022 Sophgo Technology Inc. All rights reserved.
4 */
5
6#include "sg2042.dtsi"
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10
11/ {
12	model = "Milk-V Pioneer";
13	compatible = "milkv,pioneer", "sophgo,sg2042";
14
15	chosen {
16		stdout-path = "serial0";
17	};
18
19	gpio-power {
20		compatible = "gpio-keys";
21
22		key-power {
23			label = "Power Key";
24			linux,code = <KEY_POWER>;
25			gpios = <&port0a 22 GPIO_ACTIVE_HIGH>;
26			linux,input-type = <EV_KEY>;
27			debounce-interval = <100>;
28		};
29	};
30};
31
32&cgi_main {
33	clock-frequency = <25000000>;
34};
35
36&cgi_dpll0 {
37	clock-frequency = <25000000>;
38};
39
40&cgi_dpll1 {
41	clock-frequency = <25000000>;
42};
43
44&emmc {
45	bus-width = <4>;
46	no-sdio;
47	no-sd;
48	non-removable;
49	wp-inverted;
50	status = "okay";
51};
52
53&i2c1 {
54	status = "okay";
55
56	mcu: syscon@17 {
57		compatible = "sophgo,sg2042-hwmon-mcu";
58		reg = <0x17>;
59		#thermal-sensor-cells = <1>;
60	};
61};
62
63&sd {
64	bus-width = <4>;
65	no-sdio;
66	no-mmc;
67	wp-inverted;
68	status = "okay";
69};
70
71&uart0 {
72	status = "okay";
73};
74
75/ {
76	pwmfan: pwm-fan {
77		compatible = "pwm-fan";
78		cooling-levels = <103 128 179 230 255>;
79		pwms = <&pwm 0 40000 0>;
80		#cooling-cells = <2>;
81	};
82
83	thermal-zones {
84		soc-thermal {
85			polling-delay-passive = <1000>;
86			polling-delay = <1000>;
87			thermal-sensors = <&mcu 0>;
88
89			trips {
90				soc_active1: soc-active1 {
91					temperature = <30000>;
92					hysteresis = <8000>;
93					type = "active";
94				};
95
96				soc_active2: soc-active2 {
97					temperature = <58000>;
98					hysteresis = <12000>;
99					type = "active";
100				};
101
102				soc_active3: soc-active3 {
103					temperature = <70000>;
104					hysteresis = <10000>;
105					type = "active";
106				};
107
108				soc_hot: soc-hot {
109					temperature = <80000>;
110					hysteresis = <5000>;
111					type = "hot";
112				};
113			};
114
115			cooling-maps {
116				map0 {
117					trip = <&soc_active1>;
118					cooling-device = <&pwmfan 0 1>;
119				};
120
121				map1 {
122					trip = <&soc_active2>;
123					cooling-device = <&pwmfan 1 2>;
124				};
125
126				map2 {
127					trip = <&soc_active3>;
128					cooling-device = <&pwmfan 2 3>;
129				};
130
131				map3 {
132					trip = <&soc_hot>;
133					cooling-device = <&pwmfan 3 4>;
134				};
135			};
136		};
137
138		board-thermal {
139			polling-delay-passive = <1000>;
140			polling-delay = <1000>;
141			thermal-sensors = <&mcu 1>;
142
143			trips {
144				board_active: board-active {
145					temperature = <75000>;
146					hysteresis = <8000>;
147					type = "active";
148				};
149			};
150
151			cooling-maps {
152				map4 {
153					trip = <&board_active>;
154					cooling-device = <&pwmfan 3 4>;
155				};
156			};
157		};
158	};
159};
160