1// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
2/*
3 * Copyright 2019-2021 TQ-Systems GmbH
4 */
5
6/dts-v1/;
7
8#include "imx8mq-tqma8mq.dtsi"
9#include "mba8mx.dtsi"
10
11/ {
12	model = "TQ-Systems GmbH i.MX8MQ TQMa8MQ on MBa8Mx";
13	compatible = "tq,imx8mq-tqma8mq-mba8mx", "tq,imx8mq-tqma8mq", "fsl,imx8mq";
14
15	aliases {
16		eeprom0 = &eeprom3;
17		mmc0 = &usdhc1;
18		mmc1 = &usdhc2;
19		rtc0 = &pcf85063;
20		rtc1 = &snvs_rtc;
21	};
22
23	extcon_usbotg: extcon-usbotg0 {
24		compatible = "linux,extcon-usb-gpio";
25		pinctrl-names = "default";
26		pinctrl-0 = <&pinctrl_usbcon0>;
27		id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
28	};
29
30	pcie0_refclk: pcie0-refclk {
31		compatible = "fixed-clock";
32		#clock-cells = <0>;
33		clock-frequency = <100000000>;
34	};
35
36	pcie1_refclk: pcie1-refclk {
37		compatible = "fixed-clock";
38		#clock-cells = <0>;
39		clock-frequency = <100000000>;
40	};
41
42	reg_otg_vbus: regulator-otg-vbus {
43		compatible = "regulator-fixed";
44		pinctrl-names = "default";
45		pinctrl-0 = <&pinctrl_regotgvbus>;
46		regulator-name = "MBA8MQ_OTG_VBUS";
47		regulator-min-microvolt = <5000000>;
48		regulator-max-microvolt = <5000000>;
49		gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
50		enable-active-high;
51	};
52
53	reg_usdhc2_vmmc: regulator-vmmc {
54		compatible = "regulator-fixed";
55		regulator-name = "VSD_3V3";
56		regulator-min-microvolt = <3300000>;
57		regulator-max-microvolt = <3300000>;
58		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
59		enable-active-high;
60	};
61};
62
63&btn2 {
64	gpios = <&gpio3 17 GPIO_ACTIVE_LOW>;
65};
66
67&gpio_leds {
68	led3 {
69		label = "led3";
70		gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
71	};
72};
73
74&i2c1 {
75	expander2: gpio@25 {
76		compatible = "nxp,pca9555";
77		reg = <0x25>;
78		gpio-controller;
79		#gpio-cells = <2>;
80		vcc-supply = <&reg_vcc_3v3>;
81		pinctrl-names = "default";
82		pinctrl-0 = <&pinctrl_expander>;
83		interrupt-parent = <&gpio1>;
84		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
85		interrupt-controller;
86		#interrupt-cells = <2>;
87
88		mpcie-rst-hog {
89			gpio-hog;
90			gpios = <13 0>;
91			output-high;
92			line-name = "MPCIE_RST#";
93		};
94	};
95};
96
97&irqsteer {
98	status = "okay";
99};
100
101&led2 {
102	gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
103};
104
105&pcie0 {
106	reset-gpio = <&expander0 14 GPIO_ACTIVE_LOW>;
107	clocks = <&clk IMX8MQ_CLK_PCIE1_ROOT>,
108		 <&pcie0_refclk>,
109		 <&clk IMX8MQ_CLK_PCIE1_PHY>,
110		 <&clk IMX8MQ_CLK_PCIE1_AUX>;
111	epdev_on-supply = <&reg_vcc_3v3>;
112	hard-wired = <1>;
113	status = "okay";
114};
115
116/*
117 * miniPCIe, also usable for cards with USB. Therefore configure the reset as
118 * static gpio hog.
119 */
120&pcie1 {
121	clocks = <&clk IMX8MQ_CLK_PCIE2_ROOT>,
122		 <&pcie1_refclk>,
123		 <&clk IMX8MQ_CLK_PCIE2_PHY>,
124		 <&clk IMX8MQ_CLK_PCIE2_AUX>;
125	epdev_on-supply = <&reg_vcc_3v3>;
126	hard-wired = <1>;
127	status = "okay";
128};
129
130&sai3 {
131	assigned-clocks = <&clk IMX8MQ_CLK_SAI3>;
132	assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1_OUT>;
133	clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";
134	clocks = <&clk IMX8MQ_CLK_SAI3_IPG>, <&clk IMX8MQ_CLK_DUMMY>,
135		<&clk IMX8MQ_CLK_SAI3_ROOT>, <&clk IMX8MQ_CLK_DUMMY>,
136		<&clk IMX8MQ_CLK_DUMMY>, <&clk IMX8MQ_AUDIO_PLL1_OUT>,
137		<&clk IMX8MQ_AUDIO_PLL2_OUT>;
138};
139
140&tlv320aic3x04 {
141	clock-names = "mclk";
142	clocks = <&clk IMX8MQ_CLK_SAI3_ROOT>;
143};
144
145&uart1 {
146	assigned-clocks = <&clk IMX8MQ_CLK_UART1>;
147	assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>;
148};
149
150&uart2 {
151	assigned-clocks = <&clk IMX8MQ_CLK_UART2>;
152	assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>;
153};
154
155/* console */
156&uart3 {
157	assigned-clocks = <&clk IMX8MQ_CLK_UART3>;
158	assigned-clock-parents = <&clk IMX8MQ_CLK_25M>;
159};
160
161&usb3_phy0 {
162	vbus-supply = <&reg_otg_vbus>;
163	status = "okay";
164};
165
166&usb_dwc3_0 {
167	/* we implement dual role but not full featured OTG */
168	extcon = <&extcon_usbotg>;
169	hnp-disable;
170	srp-disable;
171	adp-disable;
172	/* OC not supported due to non matching active polarity */
173	disable-over-current;
174	dr_mode = "otg";
175	status = "okay";
176};
177
178&usb3_phy1 {
179	status = "okay";
180};
181
182&usb_dwc3_1 {
183	status = "okay";
184	dr_mode = "host";
185};
186
187&wdog1 {
188	pinctrl-names = "default";
189	pinctrl-0 = <&pinctrl_wdog>;
190	fsl,ext-reset-output;
191	status = "okay";
192};
193
194&iomuxc {
195	pinctrl_ecspi1: ecspi1grp {
196		fsl,pins = <MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK	0x0000004e>,
197			   <MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI	0x0000004e>,
198			   <MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO	0x0000004e>,
199			   <MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9		0x0000004e>;
200	};
201
202	pinctrl_ecspi2: ecspi2grp {
203		fsl,pins = <MX8MQ_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK	0x0000004e>,
204			   <MX8MQ_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI	0x0000004e>,
205			   <MX8MQ_IOMUXC_ECSPI2_MISO_ECSPI2_MISO	0x0000004e>,
206			   <MX8MQ_IOMUXC_ECSPI2_SS0_GPIO5_IO13		0x0000004e>;
207	};
208
209	pinctrl_expander: expandergrp {
210		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9		0xd6>;
211	};
212
213	pinctrl_fec1: fec1grp {
214		fsl,pins = <MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC		0x3>,
215			   <MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO		0x23>,
216			   <MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3	0x1f>,
217			   <MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2	0x1f>,
218			   <MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1	0x1f>,
219			   <MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0	0x1f>,
220			   <MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3	0x91>,
221			   <MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2	0x91>,
222			   <MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1	0x91>,
223			   <MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0	0x91>,
224			   <MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC	0x1f>,
225			   <MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC	0x91>,
226			   <MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL	0x91>,
227			   <MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL	0x1f>;
228	};
229
230	pinctrl_gpiobutton: gpiobuttongrp {
231		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO05_GPIO1_IO5		0x41>,
232			   <MX8MQ_IOMUXC_GPIO1_IO07_GPIO1_IO7		0x41>,
233			   <MX8MQ_IOMUXC_NAND_WE_B_GPIO3_IO17		0x41>;
234	};
235
236	pinctrl_gpioled: gpioledgrp {
237		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO00_GPIO1_IO0		0x41>,
238			   <MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8		0x41>,
239			   <MX8MQ_IOMUXC_NAND_READY_B_GPIO3_IO16	0x41>;
240	};
241
242	pinctrl_i2c2: i2c2grp {
243		fsl,pins = <MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL		0x40000067>,
244			   <MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA		0x40000067>;
245	};
246
247	pinctrl_i2c2_gpio: i2c2gpiogrp {
248		fsl,pins = <MX8MQ_IOMUXC_I2C2_SCL_GPIO5_IO16		0x40000067>,
249			   <MX8MQ_IOMUXC_I2C2_SDA_GPIO5_IO17		0x40000067>;
250	};
251
252	pinctrl_i2c3: i2c3grp {
253		fsl,pins = <MX8MQ_IOMUXC_I2C3_SCL_I2C3_SCL		0x40000067>,
254			   <MX8MQ_IOMUXC_I2C3_SDA_I2C3_SDA		0x40000067>;
255	};
256
257	pinctrl_i2c3_gpio: i2c3gpiogrp {
258		fsl,pins = <MX8MQ_IOMUXC_I2C3_SCL_GPIO5_IO18		0x40000067>,
259			   <MX8MQ_IOMUXC_I2C3_SDA_GPIO5_IO19		0x40000067>;
260	};
261
262	pinctrl_pwm3: pwm3grp {
263		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO14_PWM3_OUT		0x16>;
264	};
265
266	pinctrl_pwm4: pwm4grp {
267		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO15_PWM4_OUT		0x16>;
268	};
269
270	pinctrl_regotgvbus: reggotgvbusgrp {
271		/* USB1 OTG PWR as GPIO */
272		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO12_GPIO1_IO12		0x06>;
273	};
274
275	pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
276		fsl,pins = <MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19		0xc1>;
277	};
278
279	pinctrl_sai3: sai3grp {
280		fsl,pins = <MX8MQ_IOMUXC_SAI3_MCLK_SAI3_MCLK		0xd6>,
281			   <MX8MQ_IOMUXC_SAI3_RXC_SAI3_RX_BCLK		0xd6>,
282			   <MX8MQ_IOMUXC_SAI3_RXFS_SAI3_RX_SYNC		0xd6>,
283			   <MX8MQ_IOMUXC_SAI3_RXD_SAI3_RX_DATA0		0xd6>,
284			   <MX8MQ_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC		0xd6>,
285			   <MX8MQ_IOMUXC_SAI3_TXD_SAI3_TX_DATA0		0xd6>,
286			   <MX8MQ_IOMUXC_SAI3_TXC_SAI3_TX_BCLK		0xd6>;
287	};
288
289	pinctrl_uart1: uart1grp {
290		fsl,pins = <MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX		0x79>,
291			   <MX8MQ_IOMUXC_UART1_TXD_UART1_DCE_TX		0x79>;
292	};
293
294	pinctrl_uart2: uart2grp {
295		fsl,pins = <MX8MQ_IOMUXC_UART2_RXD_UART2_DCE_RX		0x79>,
296			   <MX8MQ_IOMUXC_UART2_TXD_UART2_DCE_TX		0x79>;
297	};
298
299	pinctrl_uart3: uart3grp {
300		fsl,pins = <MX8MQ_IOMUXC_UART3_RXD_UART3_DCE_RX		0x79>,
301			   <MX8MQ_IOMUXC_UART3_TXD_UART3_DCE_TX		0x79>;
302	};
303
304	pinctrl_uart4: uart4grp {
305		fsl,pins = <MX8MQ_IOMUXC_UART4_RXD_UART4_DCE_RX		0x79>,
306			   <MX8MQ_IOMUXC_UART4_TXD_UART4_DCE_TX		0x79>;
307	};
308
309	pinctrl_usbcon0: usb0congrp {
310		/* ID: floating / high: device, low: host -> use PU */
311		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO10_GPIO1_IO10		0xe6>;
312	};
313
314	pinctrl_usdhc2: usdhc2grp {
315		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x83>,
316			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc3>,
317			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc3>,
318			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc3>,
319			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc3>,
320			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc3>,
321			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
322	};
323
324	pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
325		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x85>,
326			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc5>,
327			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc5>,
328			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc5>,
329			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc5>,
330			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc5>,
331			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
332	};
333
334	pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
335		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x9f>,
336			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc7>,
337			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc7>,
338			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc7>,
339			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc7>,
340			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc7>,
341			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
342	};
343
344	pinctrl_usdhc2_gpio: usdhc2-gpiogrp {
345		fsl,pins = <MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12		0x41>;
346	};
347};
348