xref: /linux/arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts (revision e78f70bad29c5ae1e1076698b690b15794e9b81e)
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	pinctrl-0 = <&emmc_cfg>;
46	pinctrl-names = "default";
47	bus-width = <4>;
48	no-sdio;
49	no-sd;
50	non-removable;
51	wp-inverted;
52	status = "okay";
53};
54
55&i2c1 {
56	pinctrl-0 = <&i2c1_cfg>;
57	pinctrl-names = "default";
58	status = "okay";
59
60	mcu: syscon@17 {
61		compatible = "sophgo,sg2042-hwmon-mcu";
62		reg = <0x17>;
63		#thermal-sensor-cells = <1>;
64	};
65};
66
67&pinctrl {
68	emmc_cfg: sdhci-emmc-cfg {
69		sdhci-emmc-wp-pins {
70			pinmux = <PINMUX(PIN_EMMC_WP, 0)>;
71			bias-disable;
72			drive-strength-microamp = <26800>;
73			input-schmitt-disable;
74		};
75
76		sdhci-emmc-cd-pins {
77			pinmux = <PINMUX(PIN_EMMC_CD, 0)>;
78			bias-pull-up;
79			drive-strength-microamp = <26800>;
80			input-schmitt-enable;
81		};
82
83		sdhci-emmc-rst-pwr-pins {
84			pinmux = <PINMUX(PIN_EMMC_RST, 0)>,
85				 <PINMUX(PIN_EMMC_PWR_EN, 0)>;
86			bias-disable;
87			drive-strength-microamp = <26800>;
88			input-schmitt-disable;
89		};
90	};
91
92	i2c1_cfg: i2c1-cfg {
93		i2c1-pins {
94			pinmux = <PINMUX(PIN_IIC1_SDA, 0)>,
95				 <PINMUX(PIN_IIC1_SCL, 0)>;
96			bias-pull-up;
97			drive-strength-microamp = <26800>;
98			input-schmitt-enable;
99		};
100	};
101
102	sd_cfg: sdhci-sd-cfg {
103		sdhci-sd-cd-wp-pins {
104			pinmux = <PINMUX(PIN_SDIO_CD, 0)>,
105				 <PINMUX(PIN_SDIO_WP, 0)>;
106			bias-pull-up;
107			drive-strength-microamp = <26800>;
108			input-schmitt-enable;
109		};
110
111		sdhci-sd-rst-pwr-pins {
112			pinmux = <PINMUX(PIN_SDIO_RST, 0)>,
113				 <PINMUX(PIN_SDIO_PWR_EN, 0)>;
114			bias-disable;
115			drive-strength-microamp = <26800>;
116			input-schmitt-disable;
117		};
118	};
119
120	uart0_cfg: uart0-cfg {
121		uart0-rx-pins {
122			pinmux = <PINMUX(PIN_UART0_TX, 0)>,
123				 <PINMUX(PIN_UART0_RX, 0)>;
124			bias-pull-up;
125			drive-strength-microamp = <26800>;
126			input-schmitt-enable;
127		};
128	};
129};
130
131&sd {
132	pinctrl-0 = <&sd_cfg>;
133	pinctrl-names = "default";
134	bus-width = <4>;
135	no-sdio;
136	no-mmc;
137	wp-inverted;
138	status = "okay";
139};
140
141&uart0 {
142	pinctrl-0 = <&uart0_cfg>;
143	pinctrl-names = "default";
144	status = "okay";
145};
146
147/ {
148	pwmfan: pwm-fan {
149		compatible = "pwm-fan";
150		cooling-levels = <103 128 179 230 255>;
151		pwms = <&pwm 0 40000 0>;
152		#cooling-cells = <2>;
153	};
154
155	thermal-zones {
156		soc-thermal {
157			polling-delay-passive = <1000>;
158			polling-delay = <1000>;
159			thermal-sensors = <&mcu 0>;
160
161			trips {
162				soc_active1: soc-active1 {
163					temperature = <30000>;
164					hysteresis = <8000>;
165					type = "active";
166				};
167
168				soc_active2: soc-active2 {
169					temperature = <58000>;
170					hysteresis = <12000>;
171					type = "active";
172				};
173
174				soc_active3: soc-active3 {
175					temperature = <70000>;
176					hysteresis = <10000>;
177					type = "active";
178				};
179
180				soc_hot: soc-hot {
181					temperature = <80000>;
182					hysteresis = <5000>;
183					type = "hot";
184				};
185			};
186
187			cooling-maps {
188				map0 {
189					trip = <&soc_active1>;
190					cooling-device = <&pwmfan 0 1>;
191				};
192
193				map1 {
194					trip = <&soc_active2>;
195					cooling-device = <&pwmfan 1 2>;
196				};
197
198				map2 {
199					trip = <&soc_active3>;
200					cooling-device = <&pwmfan 2 3>;
201				};
202
203				map3 {
204					trip = <&soc_hot>;
205					cooling-device = <&pwmfan 3 4>;
206				};
207			};
208		};
209
210		board-thermal {
211			polling-delay-passive = <1000>;
212			polling-delay = <1000>;
213			thermal-sensors = <&mcu 1>;
214
215			trips {
216				board_active: board-active {
217					temperature = <75000>;
218					hysteresis = <8000>;
219					type = "active";
220				};
221			};
222
223			cooling-maps {
224				map4 {
225					trip = <&board_active>;
226					cooling-device = <&pwmfan 3 4>;
227				};
228			};
229		};
230	};
231};
232