1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree Source for Kamstrup OMNIA Flex Concentrator.
4 *
5 * Copyright (C) 2020 Kamstrup A/S
6 * Author: Bruno Thomsen <bruno.thomsen@gmail.com>
7 */
8
9/dts-v1/;
10
11#include "imx7d-tqma7.dtsi"
12
13/* One I2C device on TQMa7 SoM is not mounted */
14/delete-node/ &ds1339;
15
16/ {
17	model = "Kamstrup OMNIA Flex Concentrator";
18	compatible = "kam,imx7d-flex-concentrator", "fsl,imx7d";
19
20	memory@80000000 {
21		device_type = "memory";
22		/* 1024 MB - TQMa7D board configuration */
23		reg = <0x80000000 0x40000000>;
24	};
25
26	reg_usb_otg2_vbus: regulator-usb-otg2-vbus {
27		compatible = "regulator-fixed";
28		regulator-name = "VBUS_USBOTG2";
29		regulator-min-microvolt = <5000000>;
30		regulator-max-microvolt = <5000000>;
31		gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
32		enable-active-high;
33	};
34
35	reg_vref_1v8: regulator-vref-1v8 {
36		compatible = "regulator-fixed";
37		regulator-name = "VCC1V8_REF";
38		regulator-min-microvolt = <1800000>;
39		regulator-max-microvolt = <1800000>;
40		regulator-always-on;
41		vin-supply = <&sw2_reg>;
42	};
43
44	/*
45	 * Human Machine Interface consists of 4 dual red/green LEDs.
46	 * hmi-a:green is controlled directly by the switch-mode power supply.
47	 * hmi-a:red is not used.
48	 */
49	gpio-leds {
50		compatible = "gpio-leds";
51		pinctrl-names = "default";
52		pinctrl-0 = <&pinctrl_leds>;
53
54		led-0 {
55			label = "hmi-b:red:heartbeat-degraded";
56			gpios = <&gpio3 6 GPIO_ACTIVE_HIGH>;
57		};
58
59		led-1 {
60			label = "hmi-b:green:heartbeat-running";
61			gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
62			linux,default-trigger = "heartbeat";
63		};
64
65		led-2 {
66			label = "hmi-c:red:mesh-error";
67			gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>;
68		};
69
70		led-3 {
71			label = "hmi-c:green:mesh-activity";
72			gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>;
73		};
74
75		led-4 {
76			label = "hmi-d:red:omnia-error";
77			gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>;
78		};
79
80		led-5 {
81			label = "hmi-d:green:omnia-activity";
82			gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
83		};
84	};
85
86	/*
87	 * Errata e10574 board restart workaround.
88	 */
89	gpio-restart {
90		pinctrl-names = "default";
91		pinctrl-0 = <&pinctrl_restart>;
92		compatible = "gpio-restart";
93		gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
94		priority = <200>;
95	};
96};
97
98/*
99 * Analog signals
100 * ADC1_IN0: SMPS - 5V output monitor (voltage divider: 1/0.2806)
101 */
102&adc1 {
103	vref-supply = <&reg_vref_1v8>;
104	status = "okay";
105};
106
107&ecspi2 {
108	pinctrl-names = "default";
109	pinctrl-0 = <&pinctrl_ecspi2>;
110	num-chipselects = <1>;
111	cs-gpios = <&gpio4 23 GPIO_ACTIVE_LOW>;
112	status = "okay";
113
114	pcf2127: rtc@0 {
115		compatible = "nxp,pcf2127";
116		reg = <0>;
117		spi-max-frequency = <2000000>;
118		reset-source;
119	};
120};
121
122&ecspi4 {
123	pinctrl-names = "default";
124	pinctrl-0 = <&pinctrl_ecspi4>;
125	num-chipselects = <1>;
126	cs-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>;
127	status = "okay";
128
129	/*
130	 * ST chip maximum SPI clock frequency is 33 MHz.
131	 *
132	 * TCG specification - Section 6.4.1 Clocking:
133	 * TPM shall support a SPI clock frequency range of 10-24 MHz.
134	 */
135	st33htph: tpm-tis@0 {
136		compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi";
137		reg = <0>;
138		spi-max-frequency = <24000000>;
139	};
140};
141
142&fec1 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&pinctrl_enet1>;
145	phy-mode = "rmii";
146	phy-handle = <&ethphy>;
147	status = "okay";
148
149	/*
150	 * MDIO bus reset is used to generate PHY device reset before
151	 * Ethernet PHY type ID auto-detection. Otherwise this communication
152	 * fails as device does not answer when recommended reset circuit
153	 * is used.
154	 */
155	mdio {
156		#address-cells = <1>;
157		#size-cells = <0>;
158
159		reset-delay-us = <100000>;
160		reset-post-delay-us = <500000>;
161		reset-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>;
162
163		/* Microchip/Micrel KSZ8081RNB */
164		ethphy: ethernet-phy@1 {
165			compatible = "ethernet-phy-ieee802.3-c22";
166			interrupt-parent = <&gpio1>;
167			interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
168			reg = <1>;
169		};
170	};
171};
172
173/*
174 * Detection signals for internal USB modules.
175 * Used for robust USB plug and play handling such as USB downstream port
176 * power-cycle and USB hub reset in case of misbehaving or crashed modules.
177 *
178 * SMPS - AC input monitor based on zero crossing.
179 * Used for last gasp notification.
180 */
181&gpio3 {
182	gpio-line-names = "", "", "", "", "", "", "", "",
183	"", "", "", "", "smps-ac-monitor", "", "usb-hub-reset", "",
184	"", "", "", "", "", "", "", "",
185	"", "module-b-detection", "", "module-a-detection", "", "", "", "";
186};
187
188/*
189 * Tamper IRQ trigger timestamp reading.
190 * Used for sealed cover opened/closed notification.
191 */
192&gpio5 {
193	gpio-line-names = "", "", "", "", "", "", "", "",
194	"", "", "", "", "rtc-tamper-irq", "", "", "",
195	"", "", "", "", "", "", "", "",
196	"", "", "", "", "", "", "", "";
197};
198
199&iomuxc {
200	pinctrl-names = "default";
201	pinctrl-0 = <&pinctrl_misc>;
202
203	pinctrl_ecspi2: ecspi2grp {
204		fsl,pins = <
205			MX7D_PAD_ECSPI2_MISO__ECSPI2_MISO		0x7c /* X2-15 */
206			MX7D_PAD_ECSPI2_MOSI__ECSPI2_MOSI		0x74 /* X2-18 */
207			MX7D_PAD_ECSPI2_SCLK__ECSPI2_SCLK		0x74 /* X2-13 */
208			MX7D_PAD_ECSPI2_SS0__GPIO4_IO23			0x74 /* X2-20 */
209			/* RTC - Tamper IRQ */
210			MX7D_PAD_SD2_CLK__GPIO5_IO12			0x3c /* X1-92 */
211		>;
212	};
213
214	pinctrl_ecspi4: ecspi4grp {
215		fsl,pins = <
216			MX7D_PAD_LCD_CLK__ECSPI4_MISO			0x7c /* X2-72 */
217			MX7D_PAD_LCD_ENABLE__ECSPI4_MOSI		0x74 /* X2-68 */
218			MX7D_PAD_LCD_HSYNC__ECSPI4_SCLK			0x74 /* X2-76 */
219			MX7D_PAD_LCD_VSYNC__GPIO3_IO3			0x74 /* X2-78 */
220		>;
221	};
222
223	pinctrl_enet1: enet1grp {
224		fsl,pins = <
225			MX7D_PAD_GPIO1_IO10__ENET1_MDIO			0x03 /* X2-48 */
226			MX7D_PAD_GPIO1_IO11__ENET1_MDC			0x03 /* X2-46 */
227			MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0	0x71 /* X2-53 */
228			MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1	0x71 /* X2-55 */
229			MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL	0x71 /* X2-61 */
230			MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0	0x79 /* X2-56 */
231			MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1	0x79 /* X2-58 */
232			MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL	0x79 /* X2-64 */
233			MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER		0x73 /* X2-52 */
234			/* PHY reset: SRE_FAST, DSE_X1 */
235			MX7D_PAD_ENET1_COL__GPIO7_IO15			0x00 /* X1-96 */
236			/* Clock from PHY to MAC: 100kPU */
237			MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1		0x70 /* X3-4 */
238			/* PHY interrupt: 100kPU, HYS */
239			MX7D_PAD_GPIO1_IO09__GPIO1_IO9			0x78 /* X1-80 */
240		>;
241	};
242
243	pinctrl_leds: ledsgrp {
244		fsl,pins = <
245			MX7D_PAD_LCD_DATA01__GPIO3_IO6			0x14 /* X2-82 */
246			MX7D_PAD_EPDC_BDR0__GPIO2_IO28			0x14 /* X1-82 */
247			MX7D_PAD_EPDC_BDR1__GPIO2_IO29			0x14 /* X1-84 */
248			MX7D_PAD_EPDC_PWR_COM__GPIO2_IO30		0x14 /* X1-86 */
249			MX7D_PAD_EPDC_PWR_STAT__GPIO2_IO31		0x14 /* X1-88 */
250			MX7D_PAD_UART2_TX_DATA__GPIO4_IO3		0x14 /* X1-90 */
251		>;
252	};
253
254	pinctrl_misc: miscgrp {
255		fsl,pins = <
256			/* Module A detection (low = present) */
257			MX7D_PAD_LCD_DATA22__GPIO3_IO27			0x7c /* X2-105 */
258			/* Module B detection (low = present) */
259			MX7D_PAD_LCD_DATA20__GPIO3_IO25			0x7c /* X2-103 */
260			/* SMPS - AC input monitor (high = failure) */
261			MX7D_PAD_LCD_DATA07__GPIO3_IO12			0x7c /* X2-88 */
262			/* USB - Hub reset */
263			MX7D_PAD_LCD_DATA09__GPIO3_IO14			0x74 /* X2-92 */
264		>;
265	};
266
267	pinctrl_restart: restartgrp {
268		fsl,pins = <
269			MX7D_PAD_ENET1_TX_CLK__GPIO7_IO12	0x74 /* X1-94 */
270		>;
271	};
272
273	pinctrl_uart4: uart4grp {
274		fsl,pins = <
275			MX7D_PAD_SAI2_TX_SYNC__UART4_DCE_RX	0x7e /* X3-14 */
276			MX7D_PAD_SAI2_TX_BCLK__UART4_DCE_TX	0x76 /* X3-16 */
277		>;
278	};
279};
280
281&iomuxc_lpsr {
282	pinctrl_usbotg2: usbotg2grp {
283		fsl,pins = <
284			MX7D_PAD_LPSR_GPIO1_IO06__USB_OTG2_OC	0x5c /* X3-11 */
285			MX7D_PAD_LPSR_GPIO1_IO07__GPIO1_IO7	0x59 /* X3-9 */
286		>;
287	};
288
289};
290
291&uart4 {
292	pinctrl-names = "default";
293	pinctrl-0 = <&pinctrl_uart4>;
294	assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
295	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
296};
297
298&usbotg2 {
299	pinctrl-names = "default";
300	pinctrl-0 = <&pinctrl_usbotg2>;
301	vbus-supply = <&reg_usb_otg2_vbus>;
302	srp-disable;
303	hnp-disable;
304	adp-disable;
305	over-current-active-low;
306	dr_mode = "host";
307	status = "okay";
308};
309
310/*
311 * External watchdog feature provided by pcf2127.
312 */
313&wdog1 {
314	status = "disabled";
315};
316