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	cs-gpios = <&gpio4 23 GPIO_ACTIVE_LOW>;
111	status = "okay";
112
113	pcf2127: rtc@0 {
114		compatible = "nxp,pcf2127";
115		reg = <0>;
116		spi-max-frequency = <2000000>;
117		reset-source;
118	};
119};
120
121&ecspi4 {
122	pinctrl-names = "default";
123	pinctrl-0 = <&pinctrl_ecspi4>;
124	cs-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>;
125	status = "okay";
126
127	/*
128	 * ST chip maximum SPI clock frequency is 33 MHz.
129	 *
130	 * TCG specification - Section 6.4.1 Clocking:
131	 * TPM shall support a SPI clock frequency range of 10-24 MHz.
132	 */
133	st33htph: tpm-tis@0 {
134		compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi";
135		reg = <0>;
136		spi-max-frequency = <24000000>;
137	};
138};
139
140&fec1 {
141	pinctrl-names = "default";
142	pinctrl-0 = <&pinctrl_enet1>;
143	phy-mode = "rmii";
144	phy-handle = <&ethphy>;
145	status = "okay";
146
147	/*
148	 * MDIO bus reset is used to generate PHY device reset before
149	 * Ethernet PHY type ID auto-detection. Otherwise this communication
150	 * fails as device does not answer when recommended reset circuit
151	 * is used.
152	 */
153	mdio {
154		#address-cells = <1>;
155		#size-cells = <0>;
156
157		reset-delay-us = <100000>;
158		reset-post-delay-us = <500000>;
159		reset-gpios = <&gpio7 15 GPIO_ACTIVE_LOW>;
160
161		/* Microchip/Micrel KSZ8081RNB */
162		ethphy: ethernet-phy@1 {
163			compatible = "ethernet-phy-ieee802.3-c22";
164			interrupt-parent = <&gpio1>;
165			interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
166			reg = <1>;
167		};
168	};
169};
170
171/*
172 * Detection signals for internal USB modules.
173 * Used for robust USB plug and play handling such as USB downstream port
174 * power-cycle and USB hub reset in case of misbehaving or crashed modules.
175 *
176 * SMPS - AC input monitor based on zero crossing.
177 * Used for last gasp notification.
178 */
179&gpio3 {
180	gpio-line-names = "", "", "", "", "", "", "", "",
181	"", "", "", "", "smps-ac-monitor", "", "usb-hub-reset", "",
182	"", "", "", "", "", "", "", "",
183	"", "module-b-detection", "", "module-a-detection", "", "", "", "";
184};
185
186/*
187 * Tamper IRQ trigger timestamp reading.
188 * Used for sealed cover opened/closed notification.
189 */
190&gpio5 {
191	gpio-line-names = "", "", "", "", "", "", "", "",
192	"", "", "", "", "rtc-tamper-irq", "", "", "",
193	"", "", "", "", "", "", "", "",
194	"", "", "", "", "", "", "", "";
195};
196
197&iomuxc {
198	pinctrl-names = "default";
199	pinctrl-0 = <&pinctrl_misc>;
200
201	pinctrl_ecspi2: ecspi2grp {
202		fsl,pins = <
203			MX7D_PAD_ECSPI2_MISO__ECSPI2_MISO		0x7c /* X2-15 */
204			MX7D_PAD_ECSPI2_MOSI__ECSPI2_MOSI		0x74 /* X2-18 */
205			MX7D_PAD_ECSPI2_SCLK__ECSPI2_SCLK		0x74 /* X2-13 */
206			MX7D_PAD_ECSPI2_SS0__GPIO4_IO23			0x74 /* X2-20 */
207			/* RTC - Tamper IRQ */
208			MX7D_PAD_SD2_CLK__GPIO5_IO12			0x3c /* X1-92 */
209		>;
210	};
211
212	pinctrl_ecspi4: ecspi4grp {
213		fsl,pins = <
214			MX7D_PAD_LCD_CLK__ECSPI4_MISO			0x7c /* X2-72 */
215			MX7D_PAD_LCD_ENABLE__ECSPI4_MOSI		0x74 /* X2-68 */
216			MX7D_PAD_LCD_HSYNC__ECSPI4_SCLK			0x74 /* X2-76 */
217			MX7D_PAD_LCD_VSYNC__GPIO3_IO3			0x74 /* X2-78 */
218		>;
219	};
220
221	pinctrl_enet1: enet1grp {
222		fsl,pins = <
223			MX7D_PAD_GPIO1_IO10__ENET1_MDIO			0x03 /* X2-48 */
224			MX7D_PAD_GPIO1_IO11__ENET1_MDC			0x03 /* X2-46 */
225			MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0	0x71 /* X2-53 */
226			MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1	0x71 /* X2-55 */
227			MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL	0x71 /* X2-61 */
228			MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0	0x79 /* X2-56 */
229			MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1	0x79 /* X2-58 */
230			MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL	0x79 /* X2-64 */
231			MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER		0x73 /* X2-52 */
232			/* PHY reset: SRE_FAST, DSE_X1 */
233			MX7D_PAD_ENET1_COL__GPIO7_IO15			0x00 /* X1-96 */
234			/* Clock from PHY to MAC: 100kPU */
235			MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1		0x70 /* X3-4 */
236			/* PHY interrupt: 100kPU, HYS */
237			MX7D_PAD_GPIO1_IO09__GPIO1_IO9			0x78 /* X1-80 */
238		>;
239	};
240
241	pinctrl_leds: ledsgrp {
242		fsl,pins = <
243			MX7D_PAD_LCD_DATA01__GPIO3_IO6			0x14 /* X2-82 */
244			MX7D_PAD_EPDC_BDR0__GPIO2_IO28			0x14 /* X1-82 */
245			MX7D_PAD_EPDC_BDR1__GPIO2_IO29			0x14 /* X1-84 */
246			MX7D_PAD_EPDC_PWR_COM__GPIO2_IO30		0x14 /* X1-86 */
247			MX7D_PAD_EPDC_PWR_STAT__GPIO2_IO31		0x14 /* X1-88 */
248			MX7D_PAD_UART2_TX_DATA__GPIO4_IO3		0x14 /* X1-90 */
249		>;
250	};
251
252	pinctrl_misc: miscgrp {
253		fsl,pins = <
254			/* Module A detection (low = present) */
255			MX7D_PAD_LCD_DATA22__GPIO3_IO27			0x7c /* X2-105 */
256			/* Module B detection (low = present) */
257			MX7D_PAD_LCD_DATA20__GPIO3_IO25			0x7c /* X2-103 */
258			/* SMPS - AC input monitor (high = failure) */
259			MX7D_PAD_LCD_DATA07__GPIO3_IO12			0x7c /* X2-88 */
260			/* USB - Hub reset */
261			MX7D_PAD_LCD_DATA09__GPIO3_IO14			0x74 /* X2-92 */
262		>;
263	};
264
265	pinctrl_restart: restartgrp {
266		fsl,pins = <
267			MX7D_PAD_ENET1_TX_CLK__GPIO7_IO12	0x74 /* X1-94 */
268		>;
269	};
270
271	pinctrl_uart4: uart4grp {
272		fsl,pins = <
273			MX7D_PAD_SAI2_TX_SYNC__UART4_DCE_RX	0x7e /* X3-14 */
274			MX7D_PAD_SAI2_TX_BCLK__UART4_DCE_TX	0x76 /* X3-16 */
275		>;
276	};
277};
278
279&iomuxc_lpsr {
280	pinctrl_usbotg2: usbotg2grp {
281		fsl,pins = <
282			MX7D_PAD_LPSR_GPIO1_IO06__USB_OTG2_OC	0x5c /* X3-11 */
283			MX7D_PAD_LPSR_GPIO1_IO07__GPIO1_IO7	0x59 /* X3-9 */
284		>;
285	};
286
287};
288
289&uart4 {
290	pinctrl-names = "default";
291	pinctrl-0 = <&pinctrl_uart4>;
292	assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
293	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
294};
295
296&usbotg2 {
297	pinctrl-names = "default";
298	pinctrl-0 = <&pinctrl_usbotg2>;
299	vbus-supply = <&reg_usb_otg2_vbus>;
300	srp-disable;
301	hnp-disable;
302	adp-disable;
303	over-current-active-low;
304	dr_mode = "host";
305	status = "okay";
306};
307
308/*
309 * External watchdog feature provided by pcf2127.
310 */
311&wdog1 {
312	status = "disabled";
313};
314