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		status = "okay";
33	};
34
35	gpio-keys-polled {
36		compatible = "gpio-keys-polled";
37		#size-cells = <0>;
38		poll-interval = <20>;
39
40		/*
41		 * The EXTi IRQ line 3 is shared with touchscreen and 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 0 is shared with PMIC,
52		 * so mark this as polled GPIO key.
53		 */
54		button-2 {
55			label = "TA3-GPIO-C";
56			linux,code = <KEY_C>;
57			gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
58		};
59	};
60
61	gpio-keys {
62		compatible = "gpio-keys";
63		#size-cells = <0>;
64
65		button-1 {
66			label = "TA2-GPIO-B";
67			linux,code = <KEY_B>;
68			gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
69			wakeup-source;
70		};
71
72		button-3 {
73			label = "TA4-GPIO-D";
74			linux,code = <KEY_D>;
75			gpios = <&gpiod 12 GPIO_ACTIVE_LOW>;
76			wakeup-source;
77		};
78	};
79
80	led {
81		compatible = "gpio-leds";
82
83		led-0 {
84			label = "green:led5";
85			gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
86			default-state = "off";
87		};
88
89		led-1 {
90			label = "green:led6";
91			gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
92			default-state = "off";
93		};
94
95		led-2 {
96			label = "green:led7";
97			gpios = <&gpioi 2 GPIO_ACTIVE_HIGH>;
98			default-state = "off";
99		};
100
101		led-3 {
102			label = "green:led8";
103			gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
104			default-state = "off";
105		};
106	};
107
108	panel {
109		compatible = "edt,etm0700g0edh6";
110		backlight = <&display_bl>;
111
112		port {
113			lcd_panel_in: endpoint {
114				remote-endpoint = <&lcd_display_out>;
115			};
116		};
117	};
118
119	sound {
120		compatible = "audio-graph-card";
121		routing =
122			"MIC_IN", "Capture",
123			"Capture", "Mic Bias",
124			"Playback", "HP_OUT";
125		dais = <&sai2a_port &sai2b_port>;
126		status = "okay";
127	};
128};
129
130&cec {
131	pinctrl-names = "default";
132	pinctrl-0 = <&cec_pins_a>;
133	status = "okay";
134};
135
136&i2c2 {	/* Header X22 */
137	pinctrl-names = "default";
138	pinctrl-0 = <&i2c2_pins_a>;
139	i2c-scl-rising-time-ns = <185>;
140	i2c-scl-falling-time-ns = <20>;
141	status = "okay";
142	/* spare dmas for other usage */
143	/delete-property/dmas;
144	/delete-property/dma-names;
145	status = "okay";
146};
147
148&i2c5 {	/* Header X21 */
149	pinctrl-names = "default";
150	pinctrl-0 = <&i2c5_pins_a>;
151	i2c-scl-rising-time-ns = <185>;
152	i2c-scl-falling-time-ns = <20>;
153	status = "okay";
154	/* spare dmas for other usage */
155	/delete-property/dmas;
156	/delete-property/dma-names;
157
158	sgtl5000: codec@a {
159		compatible = "fsl,sgtl5000";
160		reg = <0x0a>;
161		#sound-dai-cells = <0>;
162		clocks = <&clk_ext_audio_codec>;
163		VDDA-supply = <&v3v3>;
164		VDDIO-supply = <&vdd>;
165
166		sgtl5000_port: port {
167			#address-cells = <1>;
168			#size-cells = <0>;
169
170			sgtl5000_tx_endpoint: endpoint@0 {
171				reg = <0>;
172				remote-endpoint = <&sai2a_endpoint>;
173				frame-master;
174				bitclock-master;
175			};
176
177			sgtl5000_rx_endpoint: endpoint@1 {
178				reg = <1>;
179				remote-endpoint = <&sai2b_endpoint>;
180				frame-master;
181				bitclock-master;
182			};
183		};
184
185	};
186
187	polytouch@38 {
188		compatible = "edt,edt-ft5x06";
189		reg = <0x38>;
190		interrupt-parent = <&gpiog>;
191		interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
192		linux,wakeup;
193	};
194};
195
196&ltdc {
197	pinctrl-names = "default", "sleep";
198	pinctrl-0 = <&ltdc_pins_b>;
199	pinctrl-1 = <&ltdc_sleep_pins_b>;
200	status = "okay";
201
202	port {
203		lcd_display_out: endpoint {
204			remote-endpoint = <&lcd_panel_in>;
205		};
206	};
207};
208
209&sai2 {
210	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
211	clock-names = "pclk", "x8k", "x11k";
212	pinctrl-names = "default", "sleep";
213	pinctrl-0 = <&sai2a_pins_b &sai2b_pins_b>;
214	pinctrl-1 = <&sai2a_sleep_pins_b &sai2b_sleep_pins_b>;
215	status = "okay";
216
217	sai2a: audio-controller@4400b004 {
218		#clock-cells = <0>;
219		dma-names = "tx";
220		clocks = <&rcc SAI2_K>;
221		clock-names = "sai_ck";
222		status = "okay";
223
224		sai2a_port: port {
225			sai2a_endpoint: endpoint {
226				remote-endpoint = <&sgtl5000_tx_endpoint>;
227				format = "i2s";
228				mclk-fs = <512>;
229				dai-tdm-slot-num = <2>;
230				dai-tdm-slot-width = <16>;
231			};
232		};
233	};
234
235	sai2b: audio-controller@4400b024 {
236		dma-names = "rx";
237		st,sync = <&sai2a 2>;
238		clocks = <&rcc SAI2_K>, <&sai2a>;
239		clock-names = "sai_ck", "MCLK";
240		status = "okay";
241
242		sai2b_port: port {
243			sai2b_endpoint: endpoint {
244				remote-endpoint = <&sgtl5000_rx_endpoint>;
245				format = "i2s";
246				mclk-fs = <512>;
247				dai-tdm-slot-num = <2>;
248				dai-tdm-slot-width = <16>;
249			};
250		};
251	};
252};
253
254&timers2 {
255	/* spare dmas for other usage (un-delete to enable pwm capture) */
256	/delete-property/dmas;
257	/delete-property/dma-names;
258	status = "okay";
259	pwm2: pwm {
260		pinctrl-0 = <&pwm2_pins_a>;
261		pinctrl-names = "default";
262		status = "okay";
263	};
264	timer@1 {
265		status = "okay";
266	};
267};
268
269&usart3 {
270	pinctrl-names = "default";
271	pinctrl-0 = <&usart3_pins_a>;
272	status = "okay";
273};
274
275&uart8 {
276	pinctrl-names = "default";
277	pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
278	uart-has-rtscts;
279	status = "okay";
280};
281
282&usbh_ehci {
283	phys = <&usbphyc_port0>;
284	status = "okay";
285};
286
287&usbotg_hs {
288	dr_mode = "otg";
289	pinctrl-0 = <&usbotg_hs_pins_a>;
290	pinctrl-names = "default";
291	phy-names = "usb2-phy";
292	phys = <&usbphyc_port1 0>;
293	vbus-supply = <&vbus_otg>;
294	status = "okay";
295};
296
297&usbphyc {
298	status = "okay";
299};
300
301&usbphyc_port0 {
302	phy-supply = <&vdd_usb>;
303};
304
305&usbphyc_port1 {
306	phy-supply = <&vdd_usb>;
307};
308