1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright 2020 Gateworks Corporation
4 */
5
6#include <dt-bindings/gpio/gpio.h>
7#include <dt-bindings/leds/common.h>
8#include <dt-bindings/phy/phy-imx8-pcie.h>
9
10/ {
11	aliases {
12		ethernet1 = &eth1;
13		usb0 = &usbotg1;
14		usb1 = &usbotg2;
15	};
16
17	led-controller {
18		compatible = "gpio-leds";
19		pinctrl-names = "default";
20		pinctrl-0 = <&pinctrl_gpio_leds>;
21
22		led-0 {
23			function = LED_FUNCTION_STATUS;
24			color = <LED_COLOR_ID_GREEN>;
25			gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>;
26			default-state = "on";
27			linux,default-trigger = "heartbeat";
28		};
29
30		led-1 {
31			function = LED_FUNCTION_STATUS;
32			color = <LED_COLOR_ID_RED>;
33			gpios = <&gpio5 4 GPIO_ACTIVE_HIGH>;
34			default-state = "off";
35		};
36	};
37
38	pcie0_refclk: pcie0-refclk {
39		compatible = "fixed-clock";
40		#clock-cells = <0>;
41		clock-frequency = <100000000>;
42	};
43
44	pps {
45		compatible = "pps-gpio";
46		pinctrl-names = "default";
47		pinctrl-0 = <&pinctrl_pps>;
48		gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
49		status = "okay";
50	};
51
52	reg_1p8v: regulator-1p8v {
53		compatible = "regulator-fixed";
54		regulator-name = "1P8V";
55		regulator-min-microvolt = <1800000>;
56		regulator-max-microvolt = <1800000>;
57		regulator-always-on;
58	};
59
60	reg_3p3v: regulator-3p3v {
61		compatible = "regulator-fixed";
62		regulator-name = "3P3V";
63		regulator-min-microvolt = <3300000>;
64		regulator-max-microvolt = <3300000>;
65		regulator-always-on;
66	};
67
68	reg_usb_otg1_vbus: regulator-usb-otg1 {
69		pinctrl-names = "default";
70		pinctrl-0 = <&pinctrl_reg_usb1_en>;
71		compatible = "regulator-fixed";
72		regulator-name = "usb_otg1_vbus";
73		gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
74		enable-active-high;
75		regulator-min-microvolt = <5000000>;
76		regulator-max-microvolt = <5000000>;
77	};
78
79	reg_usb_otg2_vbus: regulator-usb-otg2 {
80		pinctrl-names = "default";
81		pinctrl-0 = <&pinctrl_reg_usb2_en>;
82		compatible = "regulator-fixed";
83		regulator-name = "usb_otg2_vbus";
84		gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>;
85		enable-active-high;
86		regulator-min-microvolt = <5000000>;
87		regulator-max-microvolt = <5000000>;
88	};
89
90	reg_wifi_en: regulator-wifi-en {
91		pinctrl-names = "default";
92		pinctrl-0 = <&pinctrl_reg_wl>;
93		compatible = "regulator-fixed";
94		regulator-name = "wl";
95		gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
96		startup-delay-us = <100>;
97		enable-active-high;
98		regulator-min-microvolt = <3300000>;
99		regulator-max-microvolt = <3300000>;
100	};
101};
102
103/* off-board header */
104&ecspi2 {
105	pinctrl-names = "default";
106	pinctrl-0 = <&pinctrl_spi2>;
107	cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
108	status = "okay";
109};
110
111&gpio1 {
112	gpio-line-names = "rs485_term", "mipi_gpio4", "", "",
113		"", "", "pci_usb_sel", "dio0",
114		"", "dio1", "", "", "", "", "", "",
115		"", "", "", "", "", "", "", "",
116		"", "", "", "", "", "", "", "";
117};
118
119&gpio4 {
120	gpio-line-names = "rs485_en", "mipi_gpio3", "rs485_hd", "mipi_gpio2",
121		"mipi_gpio1", "", "", "pci_wdis#",
122		"", "", "", "", "", "", "", "",
123		"", "", "", "", "", "", "", "",
124		"", "", "", "", "", "", "", "";
125};
126
127&i2c2 {
128	clock-frequency = <400000>;
129	pinctrl-names = "default";
130	pinctrl-0 = <&pinctrl_i2c2>;
131	status = "okay";
132
133	accelerometer@19 {
134		pinctrl-names = "default";
135		pinctrl-0 = <&pinctrl_accel>;
136		compatible = "st,lis2de12";
137		reg = <0x19>;
138		st,drdy-int-pin = <1>;
139		interrupt-parent = <&gpio4>;
140		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
141		interrupt-names = "INT1";
142	};
143};
144
145/* off-board header */
146&i2c3 {
147	clock-frequency = <400000>;
148	pinctrl-names = "default";
149	pinctrl-0 = <&pinctrl_i2c3>;
150	status = "okay";
151};
152
153&pcie_phy {
154	fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_INPUT>;
155	fsl,clkreq-unsupported;
156	clocks = <&pcie0_refclk>;
157	clock-names = "ref";
158	status = "okay";
159};
160
161&pcie0 {
162	pinctrl-names = "default";
163	pinctrl-0 = <&pinctrl_pcie0>;
164	reset-gpio = <&gpio4 6 GPIO_ACTIVE_LOW>;
165	clocks = <&clk IMX8MM_CLK_PCIE1_ROOT>, <&clk IMX8MM_CLK_PCIE1_AUX>,
166		 <&pcie0_refclk>;
167	clock-names = "pcie", "pcie_aux", "pcie_bus";
168	assigned-clocks = <&clk IMX8MM_CLK_PCIE1_AUX>,
169			  <&clk IMX8MM_CLK_PCIE1_CTRL>;
170	assigned-clock-rates = <10000000>, <250000000>;
171	assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_50M>,
172				 <&clk IMX8MM_SYS_PLL2_250M>;
173	status = "okay";
174
175	pcie@0,0 {
176		reg = <0x0000 0 0 0 0>;
177		#address-cells = <1>;
178		#size-cells = <0>;
179
180		pcie@1,0 {
181			reg = <0x0000 0 0 0 0>;
182			#address-cells = <1>;
183			#size-cells = <0>;
184
185			pcie@2,4 {
186				reg = <0x2000 0 0 0 0>;
187				#address-cells = <1>;
188				#size-cells = <0>;
189
190				eth1: pcie@6,0 {
191					reg = <0x0000 0 0 0 0>;
192					#address-cells = <1>;
193					#size-cells = <0>;
194
195					local-mac-address = [00 00 00 00 00 00];
196				};
197			};
198		};
199	};
200};
201
202/* off-board header */
203&sai3 {
204	pinctrl-names = "default";
205	pinctrl-0 = <&pinctrl_sai3>;
206	assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
207	assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
208	assigned-clock-rates = <24576000>;
209	status = "okay";
210};
211
212/* GPS */
213&uart1 {
214	pinctrl-names = "default";
215	pinctrl-0 = <&pinctrl_uart1>;
216	status = "okay";
217};
218
219/* bluetooth HCI */
220&uart3 {
221	pinctrl-names = "default";
222	pinctrl-0 = <&pinctrl_uart3>, <&pinctrl_bten>;
223	cts-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>;
224	rts-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
225	status = "okay";
226
227	bluetooth {
228		compatible = "brcm,bcm4330-bt";
229		shutdown-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
230	};
231};
232
233/* RS232 */
234&uart4 {
235	pinctrl-names = "default";
236	pinctrl-0 = <&pinctrl_uart4>;
237	status = "okay";
238};
239
240&usbotg1 {
241	dr_mode = "otg";
242	over-current-active-low;
243	vbus-supply = <&reg_usb_otg1_vbus>;
244	status = "okay";
245};
246
247&usbotg2 {
248	dr_mode = "host";
249	disable-over-current;
250	vbus-supply = <&reg_usb_otg2_vbus>;
251	status = "okay";
252};
253
254/* SDIO WiFi */
255&usdhc1 {
256	pinctrl-names = "default";
257	pinctrl-0 = <&pinctrl_usdhc1>;
258	bus-width = <4>;
259	non-removable;
260	vmmc-supply = <&reg_wifi_en>;
261	status = "okay";
262};
263
264/* microSD */
265&usdhc2 {
266	pinctrl-names = "default", "state_100mhz", "state_200mhz";
267	pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
268	pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
269	pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
270	cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
271	bus-width = <4>;
272	vmmc-supply = <&reg_3p3v>;
273	status = "okay";
274};
275
276&iomuxc {
277	pinctrl-names = "default";
278	pinctrl-0 = <&pinctrl_hog>;
279
280	pinctrl_hog: hoggrp {
281		fsl,pins = <
282			MX8MM_IOMUXC_SPDIF_TX_GPIO5_IO3		0x40000041 /* PLUG_TEST */
283			MX8MM_IOMUXC_GPIO1_IO06_GPIO1_IO6	0x40000041 /* PCI_USBSEL */
284			MX8MM_IOMUXC_SAI1_RXD5_GPIO4_IO7	0x40000041 /* PCIE_WDIS# */
285			MX8MM_IOMUXC_GPIO1_IO07_GPIO1_IO7	0x40000041 /* DIO0 */
286			MX8MM_IOMUXC_GPIO1_IO09_GPIO1_IO9	0x40000041 /* DIO1 */
287			MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0	0x40000104 /* RS485_TERM */
288			MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0	0x40000104 /* RS485 */
289			MX8MM_IOMUXC_SAI1_RXD0_GPIO4_IO2	0x40000104 /* RS485_HALF */
290		>;
291	};
292
293	pinctrl_accel: accelgrp {
294		fsl,pins = <
295			MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5	0x159
296		>;
297	};
298
299	pinctrl_bten: btengrp {
300		fsl,pins = <
301			MX8MM_IOMUXC_GPIO1_IO03_GPIO1_IO3	0x41
302		>;
303	};
304
305	pinctrl_gpio_leds: gpioledgrp {
306		fsl,pins = <
307			MX8MM_IOMUXC_SPDIF_EXT_CLK_GPIO5_IO5	0x19
308			MX8MM_IOMUXC_SPDIF_RX_GPIO5_IO4		0x19
309		>;
310	};
311
312	pinctrl_i2c3: i2c3grp {
313		fsl,pins = <
314			MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL		0x400001c3
315			MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA		0x400001c3
316		>;
317	};
318
319	pinctrl_pcie0: pcie0grp {
320		fsl,pins = <
321			MX8MM_IOMUXC_SAI1_RXD4_GPIO4_IO6	0x41
322		>;
323	};
324
325	pinctrl_pps: ppsgrp {
326		fsl,pins = <
327			MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15	0x41
328		>;
329	};
330
331	pinctrl_reg_wl: regwlgrp {
332		fsl,pins = <
333			MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5	0x41
334		>;
335	};
336
337	pinctrl_reg_usb1_en: regusb1grp {
338		fsl,pins = <
339			MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12	0x41
340			MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC	0x41
341		>;
342	};
343
344	pinctrl_reg_usb2_en: regusb2grp {
345		fsl,pins = <
346			MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8	0x41
347		>;
348	};
349
350	pinctrl_sai3: sai3grp {
351		fsl,pins = <
352			MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC     0xd6
353			MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK      0xd6
354			MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK        0xd6
355			MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0     0xd6
356			MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0	0xd6
357		>;
358	};
359
360	pinctrl_spi2: spi2grp {
361		fsl,pins = <
362			MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK	0xd6
363			MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI	0xd6
364			MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO	0xd6
365			MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13	0xd6
366		>;
367	};
368
369	pinctrl_uart1: uart1grp {
370		fsl,pins = <
371			MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX	0x140
372			MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX	0x140
373		>;
374	};
375
376	pinctrl_uart3: uart3grp {
377		fsl,pins = <
378			MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX	0x140
379			MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX	0x140
380			MX8MM_IOMUXC_ECSPI1_MISO_GPIO5_IO8	0x140
381			MX8MM_IOMUXC_ECSPI1_SS0_GPIO5_IO9	0x140
382		>;
383	};
384
385	pinctrl_uart4: uart4grp {
386		fsl,pins = <
387			MX8MM_IOMUXC_UART4_RXD_UART4_DCE_RX	0x140
388			MX8MM_IOMUXC_UART4_TXD_UART4_DCE_TX	0x140
389		>;
390	};
391
392	pinctrl_usdhc1: usdhc1grp {
393		fsl,pins = <
394			MX8MM_IOMUXC_SD1_CLK_USDHC1_CLK		0x190
395			MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD		0x1d0
396			MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0	0x1d0
397			MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1	0x1d0
398			MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2	0x1d0
399			MX8MM_IOMUXC_SD1_DATA3_USDHC1_DATA3	0x1d0
400		>;
401	};
402
403	pinctrl_usdhc2: usdhc2grp {
404		fsl,pins = <
405			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK		0x190
406			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD		0x1d0
407			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0	0x1d0
408			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1	0x1d0
409			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2	0x1d0
410			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3	0x1d0
411		>;
412	};
413
414	pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
415		fsl,pins = <
416			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK		0x194
417			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD		0x1d4
418			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0	0x1d4
419			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1	0x1d4
420			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2	0x1d4
421			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3	0x1d4
422		>;
423	};
424
425	pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
426		fsl,pins = <
427			MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK		0x196
428			MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD		0x1d6
429			MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0	0x1d6
430			MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1	0x1d6
431			MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2	0x1d6
432			MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3	0x1d6
433		>;
434	};
435
436	pinctrl_usdhc2_gpio: usdhc2gpiogrp {
437		fsl,pins = <
438			MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12	0x1c4
439			MX8MM_IOMUXC_SD2_RESET_B_USDHC2_RESET_B	0x1d0
440			MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0x1d0
441		>;
442	};
443};
444