1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Device Tree file for the Kontron SMARC-sAL28 board.
4 *
5 * Copyright (C) 2021 Michael Walle <michael@walle.cc>
6 *
7 */
8
9/dts-v1/;
10#include "fsl-ls1028a.dtsi"
11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14
15/ {
16	model = "Kontron SMARC-sAL28";
17	compatible = "kontron,sl28", "fsl,ls1028a";
18
19	aliases {
20		crypto = &crypto;
21		serial0 = &duart0;
22		serial1 = &duart1;
23		serial2 = &lpuart1;
24		spi0 = &fspi;
25		spi1 = &dspi2;
26		mmc0 = &esdhc1;
27		mmc1 = &esdhc;
28		rtc0 = &rtc;
29		rtc1 = &ftm_alarm0;
30	};
31
32	buttons0 {
33		compatible = "gpio-keys";
34
35		power-button {
36			interrupts-extended = <&sl28cpld_intc
37					       4 IRQ_TYPE_EDGE_BOTH>;
38			linux,code = <KEY_POWER>;
39			label = "Power";
40		};
41
42		sleep-button {
43			interrupts-extended = <&sl28cpld_intc
44					       5 IRQ_TYPE_EDGE_BOTH>;
45			linux,code = <KEY_SLEEP>;
46			label = "Sleep";
47		};
48	};
49
50	buttons1 {
51		compatible = "gpio-keys-polled";
52		poll-interval = <200>;
53
54		lid-switch {
55			linux,input-type = <EV_SW>;
56			linux,code = <SW_LID>;
57			gpios = <&sl28cpld_gpio3 4 GPIO_ACTIVE_LOW>;
58			label = "Lid";
59		};
60	};
61
62	chosen {
63		stdout-path = "serial0:115200n8";
64	};
65};
66
67&can0 {
68	status = "okay";
69};
70
71&dspi2 {
72	status = "okay";
73};
74
75&duart0 {
76	status = "okay";
77};
78
79&duart1 {
80	status = "okay";
81};
82
83&enetc_mdio_pf3 {
84	phy0: ethernet-phy@5 {
85		reg = <0x5>;
86		eee-broken-1000t;
87		eee-broken-100tx;
88	};
89};
90
91&enetc_port0 {
92	phy-handle = <&phy0>;
93	phy-mode = "sgmii";
94	managed = "in-band-status";
95	nvmem-cells = <&base_mac_address 0>;
96	nvmem-cell-names = "mac-address";
97	status = "okay";
98};
99
100&esdhc {
101	sd-uhs-sdr104;
102	sd-uhs-sdr50;
103	sd-uhs-sdr25;
104	sd-uhs-sdr12;
105	status = "okay";
106};
107
108&esdhc1 {
109	mmc-hs200-1_8v;
110	mmc-hs400-1_8v;
111	bus-width = <8>;
112	status = "okay";
113};
114
115&fspi {
116	status = "okay";
117
118	flash@0 {
119		compatible = "jedec,spi-nor";
120		m25p,fast-read;
121		spi-max-frequency = <133000000>;
122		reg = <0>;
123		/* The following setting enables 1-1-2 (CMD-ADDR-DATA) mode */
124		spi-rx-bus-width = <2>; /* 2 SPI Rx lines */
125		spi-tx-bus-width = <1>; /* 1 SPI Tx line */
126
127		partitions {
128			compatible = "fixed-partitions";
129			#address-cells = <1>;
130			#size-cells = <1>;
131
132			partition@0 {
133				reg = <0x000000 0x010000>;
134				label = "rcw";
135				read-only;
136			};
137
138			partition@10000 {
139				reg = <0x010000 0x1d0000>;
140				label = "failsafe bootloader";
141				read-only;
142			};
143
144			partition@200000 {
145				reg = <0x200000 0x010000>;
146				label = "configuration store";
147			};
148
149			partition@210000 {
150				reg = <0x210000 0x1d0000>;
151				label = "bootloader";
152			};
153
154			partition@3e0000 {
155				reg = <0x3e0000 0x020000>;
156				label = "bootloader environment";
157			};
158		};
159
160		otp-1 {
161			compatible = "user-otp";
162
163			nvmem-layout {
164				compatible = "kontron,sl28-vpd";
165
166				serial_number: serial-number {
167				};
168
169				base_mac_address: base-mac-address {
170					#nvmem-cell-cells = <1>;
171				};
172			};
173		};
174	};
175};
176
177&ftm_alarm0 {
178	status = "okay";
179};
180
181&gpio1 {
182	gpio-line-names =
183		"", "", "", "", "", "", "", "",
184		"", "", "", "", "", "", "", "",
185		"", "", "", "", "", "", "TDO", "TCK",
186		"", "", "", "", "", "", "", "";
187};
188
189&gpio2 {
190	gpio-line-names =
191		"", "", "", "", "", "", "TMS", "TDI",
192		"", "", "", "", "", "", "", "",
193		"", "", "", "", "", "", "", "",
194		"", "", "", "", "", "", "", "";
195};
196
197&i2c0 {
198	status = "okay";
199
200	rtc: rtc@32 {
201		compatible = "microcrystal,rv8803";
202		reg = <0x32>;
203	};
204
205	sl28cpld@4a {
206		compatible = "kontron,sl28cpld";
207		reg = <0x4a>;
208		#address-cells = <1>;
209		#size-cells = <0>;
210
211		watchdog@4 {
212			compatible = "kontron,sl28cpld-wdt";
213			reg = <0x4>;
214			kontron,assert-wdt-timeout-pin;
215		};
216
217		hwmon@b {
218			compatible = "kontron,sl28cpld-fan";
219			reg = <0xb>;
220		};
221
222		sl28cpld_pwm0: pwm@c {
223			compatible = "kontron,sl28cpld-pwm";
224			reg = <0xc>;
225			#pwm-cells = <2>;
226		};
227
228		sl28cpld_pwm1: pwm@e {
229			compatible = "kontron,sl28cpld-pwm";
230			reg = <0xe>;
231			#pwm-cells = <2>;
232		};
233
234		sl28cpld_gpio0: gpio@10 {
235			compatible = "kontron,sl28cpld-gpio";
236			reg = <0x10>;
237			interrupts-extended = <&gpio2 6
238					       IRQ_TYPE_EDGE_FALLING>;
239
240			gpio-controller;
241			#gpio-cells = <2>;
242			gpio-line-names =
243				"GPIO0_CAM0_PWR_N", "GPIO1_CAM1_PWR_N",
244				"GPIO2_CAM0_RST_N", "GPIO3_CAM1_RST_N",
245				"GPIO4_HDA_RST_N", "GPIO5_PWM_OUT",
246				"GPIO6_TACHIN", "GPIO7";
247
248			interrupt-controller;
249			#interrupt-cells = <2>;
250		};
251
252		sl28cpld_gpio1: gpio@15 {
253			compatible = "kontron,sl28cpld-gpio";
254			reg = <0x15>;
255			interrupts-extended = <&gpio2 6
256					       IRQ_TYPE_EDGE_FALLING>;
257
258			gpio-controller;
259			#gpio-cells = <2>;
260			gpio-line-names =
261				"GPIO8", "GPIO9", "GPIO10", "GPIO11",
262				"", "", "", "";
263
264			interrupt-controller;
265			#interrupt-cells = <2>;
266		};
267
268		sl28cpld_gpio2: gpio@1a {
269			compatible = "kontron,sl28cpld-gpo";
270			reg = <0x1a>;
271
272			gpio-controller;
273			#gpio-cells = <2>;
274			gpio-line-names =
275				"LCD0 voltage enable",
276				"LCD0 backlight enable",
277				"eMMC reset", "LVDS bridge reset",
278				"LVDS bridge power-down",
279				"SDIO power enable",
280				"", "";
281		};
282
283		sl28cpld_gpio3: gpio@1b {
284			compatible = "kontron,sl28cpld-gpi";
285			reg = <0x1b>;
286
287			gpio-controller;
288			#gpio-cells = <2>;
289			gpio-line-names =
290				"Power button", "Force recovery", "Sleep",
291				"Battery low", "Lid state", "Charging",
292				"Charger present", "";
293		};
294
295		sl28cpld_intc: interrupt-controller@1c {
296			compatible = "kontron,sl28cpld-intc";
297			reg = <0x1c>;
298			interrupts-extended = <&gpio2 6
299					       IRQ_TYPE_EDGE_FALLING>;
300
301			interrupt-controller;
302			#interrupt-cells = <2>;
303		};
304	};
305
306	eeprom@50 {
307		compatible = "atmel,24c32";
308		reg = <0x50>;
309		pagesize = <32>;
310	};
311};
312
313&i2c3 {
314	status = "okay";
315};
316
317&i2c4 {
318	status = "okay";
319
320	eeprom@50 {
321		compatible = "atmel,24c32";
322		reg = <0x50>;
323		pagesize = <32>;
324	};
325};
326
327&lpuart1 {
328	status = "okay";
329};
330
331&mscc_felix_port4 {
332	dsa-tag-protocol = "ocelot-8021q";
333};
334
335&mscc_felix_port5 {
336	dsa-tag-protocol = "ocelot-8021q";
337};
338
339&usb0 {
340	status = "okay";
341};
342
343&usb1 {
344	dr_mode = "host";
345	status = "okay";
346};
347