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	dr_mode = "otg";
173	status = "okay";
174};
175
176&usb3_phy1 {
177	status = "okay";
178};
179
180&usb_dwc3_1 {
181	status = "okay";
182	dr_mode = "host";
183};
184
185&wdog1 {
186	pinctrl-names = "default";
187	pinctrl-0 = <&pinctrl_wdog>;
188	fsl,ext-reset-output;
189	status = "okay";
190};
191
192&iomuxc {
193	pinctrl_ecspi1: ecspi1grp {
194		fsl,pins = <MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK	0x0000004e>,
195			   <MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI	0x0000004e>,
196			   <MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO	0x0000004e>,
197			   <MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9		0x0000004e>;
198	};
199
200	pinctrl_ecspi2: ecspi2grp {
201		fsl,pins = <MX8MQ_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK	0x0000004e>,
202			   <MX8MQ_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI	0x0000004e>,
203			   <MX8MQ_IOMUXC_ECSPI2_MISO_ECSPI2_MISO	0x0000004e>,
204			   <MX8MQ_IOMUXC_ECSPI2_SS0_GPIO5_IO13		0x0000004e>;
205	};
206
207	pinctrl_expander: expandergrp {
208		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9		0xd6>;
209	};
210
211	pinctrl_fec1: fec1grp {
212		fsl,pins = <MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC		0x3>,
213			   <MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO		0x23>,
214			   <MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3	0x1f>,
215			   <MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2	0x1f>,
216			   <MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1	0x1f>,
217			   <MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0	0x1f>,
218			   <MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3	0x91>,
219			   <MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2	0x91>,
220			   <MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1	0x91>,
221			   <MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0	0x91>,
222			   <MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC	0x1f>,
223			   <MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC	0x91>,
224			   <MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL	0x91>,
225			   <MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL	0x1f>;
226	};
227
228	pinctrl_gpiobutton: gpiobuttongrp {
229		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO05_GPIO1_IO5		0x41>,
230			   <MX8MQ_IOMUXC_GPIO1_IO07_GPIO1_IO7		0x41>,
231			   <MX8MQ_IOMUXC_NAND_WE_B_GPIO3_IO17		0x41>;
232	};
233
234	pinctrl_gpioled: gpioledgrp {
235		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO00_GPIO1_IO0		0x41>,
236			   <MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8		0x41>,
237			   <MX8MQ_IOMUXC_NAND_READY_B_GPIO3_IO16	0x41>;
238	};
239
240	pinctrl_i2c2: i2c2grp {
241		fsl,pins = <MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL		0x40000067>,
242			   <MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA		0x40000067>;
243	};
244
245	pinctrl_i2c2_gpio: i2c2gpiogrp {
246		fsl,pins = <MX8MQ_IOMUXC_I2C2_SCL_GPIO5_IO16		0x40000067>,
247			   <MX8MQ_IOMUXC_I2C2_SDA_GPIO5_IO17		0x40000067>;
248	};
249
250	pinctrl_i2c3: i2c3grp {
251		fsl,pins = <MX8MQ_IOMUXC_I2C3_SCL_I2C3_SCL		0x40000067>,
252			   <MX8MQ_IOMUXC_I2C3_SDA_I2C3_SDA		0x40000067>;
253	};
254
255	pinctrl_i2c3_gpio: i2c3gpiogrp {
256		fsl,pins = <MX8MQ_IOMUXC_I2C3_SCL_GPIO5_IO18		0x40000067>,
257			   <MX8MQ_IOMUXC_I2C3_SDA_GPIO5_IO19		0x40000067>;
258	};
259
260	pinctrl_pwm3: pwm3grp {
261		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO14_PWM3_OUT		0x16>;
262	};
263
264	pinctrl_pwm4: pwm4grp {
265		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO15_PWM4_OUT		0x16>;
266	};
267
268	pinctrl_regotgvbus: reggotgvbusgrp {
269		/* USB1 OTG PWR as GPIO */
270		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO12_GPIO1_IO12		0x06>;
271	};
272
273	pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
274		fsl,pins = <MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19		0xc1>;
275	};
276
277	pinctrl_sai3: sai3grp {
278		fsl,pins = <MX8MQ_IOMUXC_SAI3_MCLK_SAI3_MCLK		0xd6>,
279			   <MX8MQ_IOMUXC_SAI3_RXC_SAI3_RX_BCLK		0xd6>,
280			   <MX8MQ_IOMUXC_SAI3_RXFS_SAI3_RX_SYNC		0xd6>,
281			   <MX8MQ_IOMUXC_SAI3_RXD_SAI3_RX_DATA0		0xd6>,
282			   <MX8MQ_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC		0xd6>,
283			   <MX8MQ_IOMUXC_SAI3_TXD_SAI3_TX_DATA0		0xd6>,
284			   <MX8MQ_IOMUXC_SAI3_TXC_SAI3_TX_BCLK		0xd6>;
285	};
286
287	pinctrl_uart1: uart1grp {
288		fsl,pins = <MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX		0x79>,
289			   <MX8MQ_IOMUXC_UART1_TXD_UART1_DCE_TX		0x79>;
290	};
291
292	pinctrl_uart2: uart2grp {
293		fsl,pins = <MX8MQ_IOMUXC_UART2_RXD_UART2_DCE_RX		0x79>,
294			   <MX8MQ_IOMUXC_UART2_TXD_UART2_DCE_TX		0x79>;
295	};
296
297	pinctrl_uart3: uart3grp {
298		fsl,pins = <MX8MQ_IOMUXC_UART3_RXD_UART3_DCE_RX		0x79>,
299			   <MX8MQ_IOMUXC_UART3_TXD_UART3_DCE_TX		0x79>;
300	};
301
302	pinctrl_uart4: uart4grp {
303		fsl,pins = <MX8MQ_IOMUXC_UART4_RXD_UART4_DCE_RX		0x79>,
304			   <MX8MQ_IOMUXC_UART4_TXD_UART4_DCE_TX		0x79>;
305	};
306
307	pinctrl_usbcon0: usb0congrp {
308		/* ID: floating / high: device, low: host -> use PU */
309		fsl,pins = <MX8MQ_IOMUXC_GPIO1_IO10_GPIO1_IO10		0xe6>;
310	};
311
312	pinctrl_usdhc2: usdhc2grp {
313		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x83>,
314			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc3>,
315			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc3>,
316			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc3>,
317			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc3>,
318			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc3>,
319			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
320	};
321
322	pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp {
323		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x85>,
324			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc5>,
325			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc5>,
326			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc5>,
327			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc5>,
328			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc5>,
329			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
330	};
331
332	pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp {
333		fsl,pins = <MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK		0x9f>,
334			   <MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD		0xc7>,
335			   <MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0		0xc7>,
336			   <MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1		0xc7>,
337			   <MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2		0xc7>,
338			   <MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3		0xc7>,
339			   <MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT	0xc1>;
340	};
341
342	pinctrl_usdhc2_gpio: usdhc2-gpiogrp {
343		fsl,pins = <MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12		0x41>;
344	};
345};
346