1// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2/*
3 * Copyright (c) 2016 Protonic Holland
4 * Copyright (c) 2020 Oleksij Rempel <kernel@pengutronix.de>, Pengutronix
5 */
6
7/dts-v1/;
8#include "imx6dl.dtsi"
9#include "imx6qdl-vicut1.dtsi"
10
11/ {
12	model = "Kverneland TGO";
13	compatible = "kvg,victgo", "fsl,imx6dl";
14
15	gpio-keys {
16		compatible = "gpio-keys";
17		pinctrl-names = "default";
18		pinctrl-0 = <&pinctrl_gpiokeys>;
19		autorepeat;
20
21		key-power {
22			label = "Power Button";
23			gpios = <&gpio2 23 GPIO_ACTIVE_LOW>;
24			linux,code = <KEY_POWER>;
25			wakeup-source;
26		};
27
28		key-enter {
29			label = "Rotary Key";
30			gpios = <&gpio2 05 GPIO_ACTIVE_LOW>;
31			linux,code = <KEY_ENTER>;
32			wakeup-source;
33		};
34	};
35
36	iio-hwmon {
37		compatible = "iio-hwmon";
38		io-channels = <&vdiv_vaccu>, <&vdiv_hitch_pos>;
39	};
40
41	panel {
42		compatible = "lg,lb070wv8";
43		backlight = <&backlight_lcd>;
44		power-supply = <&reg_3v3>;
45
46		port {
47			panel_in: endpoint {
48				remote-endpoint = <&lvds0_out>;
49			};
50		};
51	};
52
53	clk50m_phy: phy-clock {
54		compatible = "fixed-clock";
55		#clock-cells = <0>;
56		clock-frequency = <50000000>;
57		clock-output-names = "enet_ref_pad";
58	};
59
60	rotary-encoder {
61		compatible = "rotary-encoder";
62		pinctrl-0 = <&pinctrl_rotary_ch>;
63		gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>,
64			<&gpio2 4 GPIO_ACTIVE_HIGH>;
65		linux,axis = <REL_WHEEL>;
66		rotary-encoder,steps-per-period = <4>;
67		rotary-encoder,relative-axis;
68		rotary-encoder,rollover;
69		wakeup-source;
70	};
71
72	thermal-zones {
73		chassis-thermal {
74			polling-delay = <20000>;
75			polling-delay-passive = <0>;
76			thermal-sensors = <&tsens0>;
77
78			trips {
79				alert {
80					temperature = <105000>; /* millicelsius */
81					hysteresis = <2000>; /* millicelsius */
82					type = "passive";
83				};
84			};
85		};
86
87		touch-thermal0 {
88			polling-delay = <20000>;
89			polling-delay-passive = <0>;
90			thermal-sensors = <&touch_temp0>;
91
92			trips {
93				alert {
94					temperature = <105000>; /* millicelsius */
95					hysteresis = <2000>; /* millicelsius */
96					type = "passive";
97				};
98			};
99		};
100
101		touch-thermal1 {
102			polling-delay = <20000>;
103			polling-delay-passive = <0>;
104			thermal-sensors = <&touch_temp1>;
105
106			trips {
107				alert {
108					temperature = <105000>; /* millicelsius */
109					hysteresis = <2000>; /* millicelsius */
110					type = "passive";
111				};
112			};
113		};
114	};
115
116	touchscreen {
117		compatible = "resistive-adc-touch";
118		io-channels = <&adc_ts 1>, <&adc_ts 3>, <&adc_ts 4>,
119                              <&adc_ts 5>;
120		io-channel-names = "y", "z1", "z2", "x";
121		touchscreen-min-pressure = <64687>;
122		touchscreen-inverted-y;
123		touchscreen-x-plate-ohms = <300>;
124		touchscreen-y-plate-ohms = <800>;
125	};
126
127	touch_temp0: touch-temperature-sensor0 {
128		compatible = "generic-adc-thermal";
129		#thermal-sensor-cells = <0>;
130		io-channels = <&adc_ts 0>;
131		io-channel-names = "sensor-channel";
132		temperature-lookup-table = <    (-40000) 736
133						85000 474>;
134	};
135
136	touch_temp1: touch-temperature-sensor1 {
137		compatible = "generic-adc-thermal";
138		#thermal-sensor-cells = <0>;
139		io-channels = <&adc_ts 7>;
140		io-channel-names = "sensor-channel";
141		temperature-lookup-table = <    (-40000) 826
142						85000 609>;
143	};
144
145	vdiv_vaccu: voltage-divider-vaccu {
146		compatible = "voltage-divider";
147		io-channels = <&adc_ts 2>;
148		output-ohms = <2500>;
149		full-ohms = <64000>;
150		#io-channel-cells = <0>;
151	};
152
153	vdiv_hitch_pos: voltage-divider-hitch-pos {
154		compatible = "voltage-divider";
155		io-channels = <&adc_ts 6>;
156		output-ohms = <3300>;
157		full-ohms = <13300>;
158		#io-channel-cells = <0>;
159	};
160};
161
162&clks {
163	clocks = <&clk50m_phy>;
164	clock-names = "enet_ref_pad";
165	assigned-clocks = <&clks IMX6QDL_CLK_ENET_REF_SEL>;
166	assigned-clock-parents = <&clk50m_phy>;
167};
168
169&ecspi2 {
170	cs-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
171	pinctrl-names = "default";
172	pinctrl-0 = <&pinctrl_ecspi2>;
173	status = "okay";
174
175	adc_ts: adc@0 {
176		compatible = "ti,tsc2046e-adc";
177		reg = <0>;
178		pinctrl-0 = <&pinctrl_touchscreen>;
179		pinctrl-names = "default";
180		spi-max-frequency = <1000000>;
181		interrupts-extended = <&gpio5 8 IRQ_TYPE_LEVEL_LOW>;
182		#io-channel-cells = <1>;
183
184		#address-cells = <1>;
185		#size-cells = <0>;
186
187		channel@1 {
188			reg = <1>;
189			settling-time-us = <700>;
190			oversampling-ratio = <5>;
191		};
192
193		channel@3 {
194			reg = <3>;
195			settling-time-us = <700>;
196			oversampling-ratio = <5>;
197		};
198
199		channel@4 {
200			reg = <4>;
201			settling-time-us = <700>;
202			oversampling-ratio = <5>;
203		};
204
205		channel@5 {
206			reg = <5>;
207			settling-time-us = <700>;
208			oversampling-ratio = <5>;
209		};
210	};
211};
212
213&fec {
214	pinctrl-names = "default";
215	pinctrl-0 = <&pinctrl_enet>;
216	phy-mode = "rmii";
217	phy-handle = <&rmii_phy>;
218	status = "okay";
219
220	mdio {
221		#address-cells = <1>;
222		#size-cells = <0>;
223
224		/* Microchip KSZ8081RNA PHY */
225		rmii_phy: ethernet-phy@0 {
226			reg = <0>;
227			interrupts-extended = <&gpio4 30 IRQ_TYPE_LEVEL_LOW>;
228			reset-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
229			reset-assert-us = <10000>;
230			reset-deassert-us = <300>;
231		};
232	};
233};
234
235&gpio1 {
236	gpio-line-names =
237		"CAN1_TERM", "SD1_CD", "ITU656_RESET", "CAM1_MIRROR",
238			"CAM2_MIRROR", "", "", "SMBALERT",
239		"DEBUG_0", "DEBUG_1", "", "", "", "", "", "",
240		"SD1_DATA0", "SD1_DATA1", "SD1_CMD", "SD1_DATA2", "SD1_CLK",
241			"SD1_DATA3", "ETH_MDIO", "",
242		"", "", "", "", "", "", "", "ETH_MDC";
243};
244
245&gpio4 {
246	gpio-line-names =
247		"", "", "", "", "", "", "UART4_TXD", "UART4_RXD",
248		"UART5_TXD", "UART5_RXD", "CAN1_TX", "CAN1_RX", "CAN1_SR",
249			"CAN2_SR", "CAN2_TX", "CAN2_RX",
250		"", "", "DIP1_FB", "", "VCAM_EN", "ON1_CTRL", "ON2_CTRL",
251			"HITCH_IN_OUT",
252		"LIGHT_ON", "", "ETH_RESET", "CONTACT_IN", "BL_EN",
253			"BL_PWM", "ETH_INT", "ISB_LED";
254};
255
256&gpio5 {
257	gpio-line-names =
258		"", "", "", "", "", "", "", "",
259		"TSC_PENIRQ", "TSC_BUSY", "ECSPI2_MOSI", "ECSPI2_MISO",
260			"ECSPI2_SS0", "ECSPI2_SCLK", "", "",
261		"", "", "ITU656_CLK", "I2S_MCLK", "ITU656_PDN", "AUDIO_RESET",
262			"I2S_BITCLK", "I2S_DOUT",
263		"I2S_LRCLK", "I2S_DIN", "I2C1_SDA", "I2C1_SCL", "YACO_AUX_RX",
264			"YACO_AUX_TX", "ITU656_D0", "ITU656_D1";
265};
266
267&gpio6 {
268	gpio-line-names =
269		"ITU656_D2", "ITU656_D3", "ITU656_D4", "ITU656_D5",
270			"ITU656_D6", "ITU656_D7", "", "",
271		"", "", "", "", "", "", "", "",
272		"", "", "", "", "", "", "", "",
273		"", "", "", "", "", "", "", "";
274};
275
276&i2c1 {
277	keypad@70 {
278		compatible = "holtek,ht16k33";
279		pinctrl-names = "default";
280		pinctrl-0 = <&pinctrl_keypad>;
281		reg = <0x70>;
282		refresh-rate-hz = <20>;
283		debounce-delay-ms = <50>;
284		interrupts-extended = <&gpio4 5 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
285		keypad,num-rows = <12>;
286		keypad,num-columns = <3>;
287		linux,keymap = <
288			MATRIX_KEY(2, 0, KEY_F6)
289			MATRIX_KEY(3, 0, KEY_F8)
290			MATRIX_KEY(4, 0, KEY_F10)
291			MATRIX_KEY(5, 0, KEY_F4)
292			MATRIX_KEY(6, 0, KEY_F2)
293			MATRIX_KEY(2, 1, KEY_F5)
294			MATRIX_KEY(3, 1, KEY_F7)
295			MATRIX_KEY(4, 1, KEY_F9)
296			MATRIX_KEY(5, 1, KEY_F3)
297			MATRIX_KEY(6, 1, KEY_F1)
298		      >;
299	};
300};
301
302&iomuxc {
303	pinctrl_ecspi2: ecspi2grp {
304		fsl,pins = <
305			MX6QDL_PAD_DISP0_DAT16__ECSPI2_MOSI		0x100b1
306			MX6QDL_PAD_DISP0_DAT17__ECSPI2_MISO		0x100b1
307			MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12		0x100b1
308			MX6QDL_PAD_DISP0_DAT19__ECSPI2_SCLK		0x100b1
309		>;
310	};
311
312	pinctrl_enet: enetgrp {
313		fsl,pins = <
314			/* MX6QDL_ENET_PINGRP4 */
315			MX6QDL_PAD_ENET_MDC__ENET_MDC			0x1b0b0
316			MX6QDL_PAD_ENET_MDIO__ENET_MDIO			0x1b0b0
317			MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0		0x1b0b0
318			MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1		0x1b0b0
319			MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER		0x1b0b0
320			MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN		0x1b0b0
321			MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0		0x1b0b0
322			MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1		0x1b0b0
323			MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN		0x1b0b0
324			MX6QDL_PAD_GPIO_16__ENET_REF_CLK		0x1b0b0
325			/* Phy reset */
326			MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26		0x1b0b0
327			/* nINTRP */
328			MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30		0x1b0b0
329		>;
330	};
331
332	pinctrl_gpiokeys: gpiokeygrp {
333		fsl,pins = <
334			/* ROTARY_BTN */
335			MX6QDL_PAD_NANDF_D5__GPIO2_IO05			0x1b0b0
336			/* nON_SWITCH */
337			MX6QDL_PAD_EIM_CS0__GPIO2_IO23			0x1b0b0
338		>;
339	};
340
341	pinctrl_keypad: keypadgrp {
342		fsl,pins = <
343			MX6QDL_PAD_GPIO_19__GPIO4_IO05			0x1b0b0
344		>;
345	};
346
347	pinctrl_rotary_ch: rotarychgrp {
348		fsl,pins = <
349			MX6QDL_PAD_NANDF_D3__GPIO2_IO03			0x1b0b0
350			MX6QDL_PAD_NANDF_D4__GPIO2_IO04			0x1b0b0
351		>;
352	};
353
354	pinctrl_touchscreen: touchscreengrp {
355		fsl,pins = <
356			MX6QDL_PAD_DISP0_DAT14__GPIO5_IO08		0x1b0b0
357			MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09		0x1b0b0
358		>;
359	};
360};
361