1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2 /*
3  * Copyright (C) 2019-2020 Marek Vasut <marex@denx.de>
4  */
5 
6 #include <dt-bindings/input/input.h>
7 #include <dt-bindings/pwm/pwm.h>
8 
9 / {
10 	aliases {
11 		serial0 = &uart4;
12 		serial1 = &usart3;
13 		serial2 = &uart8;
14 	};
15 
16 	chosen {
17 		stdout-path = "serial0:115200n8";
18 	};
19 
20 	clk_ext_audio_codec: clock-codec {
21 		compatible = "fixed-clock";
22 		#clock-cells = <0>;
23 		clock-frequency = <24000000>;
24 	};
25 
26 	display_bl: display-bl {
27 		compatible = "pwm-backlight";
28 		pwms = <&pwm2 3 500000 PWM_POLARITY_INVERTED>;
29 		brightness-levels = <0 16 22 30 40 55 75 102 138 188 255>;
30 		default-brightness-level = <8>;
31 		enable-gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
32 		power-supply = <&reg_panel_bl>;
33 		status = "okay";
34 	};
35 
36 	gpio-keys-polled {
37 		compatible = "gpio-keys-polled";
38 		poll-interval = <20>;
39 
40 		/*
41 		 * The EXTi IRQ line 3 is shared with ethernet,
42 		 * so mark this as polled GPIO key.
43 		 */
44 		button-0 {
45 			label = "TA1-GPIO-A";
46 			linux,code = <KEY_A>;
47 			gpios = <&gpiof 3 GPIO_ACTIVE_LOW>;
48 		};
49 
50 		/*
51 		 * The EXTi IRQ line 6 is shared with touchscreen,
52 		 * so mark this as polled GPIO key.
53 		 */
54 		button-1 {
55 			label = "TA2-GPIO-B";
56 			linux,code = <KEY_B>;
57 			gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
58 		};
59 
60 		/*
61 		 * The EXTi IRQ line 0 is shared with PMIC,
62 		 * so mark this as polled GPIO key.
63 		 */
64 		button-2 {
65 			label = "TA3-GPIO-C";
66 			linux,code = <KEY_C>;
67 			gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
68 		};
69 	};
70 
71 	gpio-keys {
72 		compatible = "gpio-keys";
73 
74 		button-3 {
75 			label = "TA4-GPIO-D";
76 			linux,code = <KEY_D>;
77 			gpios = <&gpiod 12 GPIO_ACTIVE_LOW>;
78 			wakeup-source;
79 		};
80 	};
81 
82 	led {
83 		compatible = "gpio-leds";
84 
85 		led-0 {
86 			label = "green:led5";
87 			gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
88 			default-state = "off";
89 			status = "disabled";
90 		};
91 
92 		led-1 {
93 			label = "green:led6";
94 			gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
95 			default-state = "off";
96 		};
97 
98 		led-2 {
99 			label = "green:led7";
100 			gpios = <&gpioi 2 GPIO_ACTIVE_HIGH>;
101 			default-state = "off";
102 		};
103 
104 		led-3 {
105 			label = "green:led8";
106 			gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
107 			default-state = "off";
108 		};
109 	};
110 
111 	panel {
112 		compatible = "edt,etm0700g0edh6";
113 		backlight = <&display_bl>;
114 		power-supply = <&reg_panel_bl>;
115 
116 		port {
117 			lcd_panel_in: endpoint {
118 				remote-endpoint = <&lcd_display_out>;
119 			};
120 		};
121 	};
122 
123 	reg_panel_bl: regulator-panel-bl {
124 		compatible = "regulator-fixed";
125 		regulator-name = "panel_backlight";
126 		regulator-min-microvolt = <3300000>;
127 		regulator-max-microvolt = <3300000>;
128 		vin-supply = <&reg_panel_supply>;
129 	};
130 
131 	reg_panel_supply: regulator-panel-supply {
132 		compatible = "regulator-fixed";
133 		regulator-name = "panel_supply";
134 		regulator-min-microvolt = <24000000>;
135 		regulator-max-microvolt = <24000000>;
136 	};
137 
138 	sound {
139 		compatible = "audio-graph-card";
140 		widgets = "Headphone", "Headphone Jack",
141 			  "Line", "Line In Jack",
142 			  "Microphone", "Microphone Jack";
143 		routing = "Headphone Jack", "HP_OUT",
144 			  "LINE_IN", "Line In Jack",
145 			  "MIC_IN", "Microphone Jack",
146 			  "Microphone Jack", "Mic Bias";
147 		dais = <&sai2a_port &sai2b_port>;
148 		status = "okay";
149 	};
150 };
151 
152 &cec {
153 	pinctrl-names = "default";
154 	pinctrl-0 = <&cec_pins_a>;
155 	status = "okay";
156 };
157 
158 &i2c2 {	/* Header X22 */
159 	pinctrl-names = "default";
160 	pinctrl-0 = <&i2c2_pins_a>;
161 	i2c-scl-rising-time-ns = <185>;
162 	i2c-scl-falling-time-ns = <20>;
163 	status = "okay";
164 	/* spare dmas for other usage */
165 	/delete-property/dmas;
166 	/delete-property/dma-names;
167 	status = "okay";
168 };
169 
170 &i2c5 {	/* Header X21 */
171 	pinctrl-names = "default";
172 	pinctrl-0 = <&i2c5_pins_a>;
173 	i2c-scl-rising-time-ns = <185>;
174 	i2c-scl-falling-time-ns = <20>;
175 	status = "okay";
176 	/* spare dmas for other usage */
177 	/delete-property/dmas;
178 	/delete-property/dma-names;
179 
180 	sgtl5000: codec@a {
181 		compatible = "fsl,sgtl5000";
182 		reg = <0x0a>;
183 		#sound-dai-cells = <0>;
184 		clocks = <&clk_ext_audio_codec>;
185 		VDDA-supply = <&v3v3>;
186 		VDDIO-supply = <&vdd>;
187 
188 		sgtl5000_port: port {
189 			#address-cells = <1>;
190 			#size-cells = <0>;
191 
192 			sgtl5000_tx_endpoint: endpoint@0 {
193 				reg = <0>;
194 				remote-endpoint = <&sai2a_endpoint>;
195 			};
196 
197 			sgtl5000_rx_endpoint: endpoint@1 {
198 				reg = <1>;
199 				remote-endpoint = <&sai2b_endpoint>;
200 			};
201 		};
202 
203 	};
204 
205 	touchscreen@38 {
206 		compatible = "edt,edt-ft5406";
207 		reg = <0x38>;
208 		interrupt-parent = <&gpioc>;
209 		interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
210 	};
211 };
212 
213 &ltdc {
214 	pinctrl-names = "default", "sleep";
215 	pinctrl-0 = <&ltdc_pins_b>;
216 	pinctrl-1 = <&ltdc_sleep_pins_b>;
217 	status = "okay";
218 
219 	port {
220 		lcd_display_out: endpoint {
221 			remote-endpoint = <&lcd_panel_in>;
222 		};
223 	};
224 };
225 
226 &sai2 {
227 	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
228 	clock-names = "pclk", "x8k", "x11k";
229 	pinctrl-names = "default", "sleep";
230 	pinctrl-0 = <&sai2a_pins_b &sai2b_pins_b>;
231 	pinctrl-1 = <&sai2a_sleep_pins_b &sai2b_sleep_pins_b>;
232 	status = "okay";
233 
234 	sai2a: audio-controller@4400b004 {
235 		#clock-cells = <0>;
236 		dma-names = "tx";
237 		clocks = <&rcc SAI2_K>;
238 		clock-names = "sai_ck";
239 		status = "okay";
240 
241 		sai2a_port: port {
242 			sai2a_endpoint: endpoint {
243 				remote-endpoint = <&sgtl5000_tx_endpoint>;
244 				bitclock-master;
245 				dai-format = "i2s";
246 				dai-tdm-slot-num = <2>;
247 				dai-tdm-slot-width = <16>;
248 				frame-master;
249 				mclk-fs = <256>;
250 			};
251 		};
252 	};
253 
254 	sai2b: audio-controller@4400b024 {
255 		dma-names = "rx";
256 		st,sync = <&sai2a 2>;
257 		clocks = <&rcc SAI2_K>, <&sai2a>;
258 		clock-names = "sai_ck", "MCLK";
259 		status = "okay";
260 
261 		sai2b_port: port {
262 			sai2b_endpoint: endpoint {
263 				remote-endpoint = <&sgtl5000_rx_endpoint>;
264 				bitclock-master;
265 				dai-format = "i2s";
266 				dai-tdm-slot-num = <2>;
267 				dai-tdm-slot-width = <16>;
268 				frame-master;
269 				mclk-fs = <256>;
270 			};
271 		};
272 	};
273 };
274 
275 &timers2 {
276 	/* spare dmas for other usage (un-delete to enable pwm capture) */
277 	/delete-property/dmas;
278 	/delete-property/dma-names;
279 	status = "okay";
280 	pwm2: pwm {
281 		pinctrl-0 = <&pwm2_pins_a>;
282 		pinctrl-names = "default";
283 		status = "okay";
284 	};
285 	timer@1 {
286 		status = "okay";
287 	};
288 };
289 
290 &usart3 {
291 	pinctrl-names = "default";
292 	pinctrl-0 = <&usart3_pins_a>;
293 	/delete-property/dmas;
294 	/delete-property/dma-names;
295 	status = "okay";
296 };
297 
298 &uart8 {
299 	pinctrl-names = "default";
300 	pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
301 	uart-has-rtscts;
302 	/delete-property/dmas;
303 	/delete-property/dma-names;
304 	status = "okay";
305 };
306 
307 &usbh_ehci {
308 	status = "okay";
309 };
310 
311 &usbotg_hs {
312 	dr_mode = "otg";
313 	pinctrl-0 = <&usbotg_hs_pins_a>;
314 	pinctrl-names = "default";
315 	phy-names = "usb2-phy";
316 	phys = <&usbphyc_port1 0>;
317 	vbus-supply = <&vbus_otg>;
318 	status = "okay";
319 };
320 
321 &usbphyc {
322 	status = "okay";
323 };
324 
325 &usbphyc_port0 {
326 	phy-supply = <&vdd_usb>;
327 };
328 
329 &usbphyc_port1 {
330 	phy-supply = <&vdd_usb>;
331 };
332