1/*
2 * Copyright (c) 2023 Panasonic Industrial Devices Europe GmbH
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#include "pan1783_nrf5340_cpuapp_common-pinctrl.dtsi"
7#include <zephyr/dt-bindings/input/input-event-codes.h>
8
9/ {
10
11	chosen {
12		zephyr,console = &uart0;
13		zephyr,shell-uart = &uart0;
14		zephyr,uart-mcumgr = &uart0;
15		zephyr,bt-mon-uart = &uart0;
16		zephyr,bt-c2h-uart = &uart0;
17		zephyr,bt-hci = &bt_hci_ipc0;
18		nordic,802154-spinel-ipc = &ipc0;
19		zephyr,ieee802154 = &ieee802154;
20	};
21
22	leds {
23		compatible = "gpio-leds";
24		evb_led1: evb_led_1 {
25			gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
26			label = "LED1 on EVB";
27		};
28		evb_led2: evb_led_2 {
29			gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
30			label = "LED2 on EVB";
31		};
32		evb_led3: evb_led_3 {
33			gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
34			label = "LED3 on EVB";
35		};
36		evb_led4: evb_led_4 {
37			gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
38			label = "LED4 on EVB";
39		};
40	};
41
42	pwmleds {
43		compatible = "pwm-leds";
44		pwm_evb_led1: pwm_evb_led_1 {
45			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
46		};
47	};
48
49	buttons {
50		compatible = "gpio-keys";
51		evb_sw1: evb_sw_1 {
52			gpios = <&gpio0 23 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
53			label = "SW1 on EVB";
54			zephyr,code = <INPUT_KEY_0>;
55		};
56		evb_sw2: evb_sw_2 {
57			gpios = <&gpio0 24 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
58			label = "SW2 on EVB";
59			zephyr,code = <INPUT_KEY_1>;
60		};
61		evb_sw3: evb_sw_3 {
62			gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
63			label = "SW3 on EVB";
64			zephyr,code = <INPUT_KEY_2>;
65		};
66		evb_sw4: evb_sw_4 {
67			gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
68			label = "SW4 on EVB";
69			zephyr,code = <INPUT_KEY_3>;
70		};
71	};
72
73	mikrobus_header: mikrobus-connector {
74		compatible = "mikro-bus";
75		#gpio-cells = <2>;
76		gpio-map-mask = <0xffffffff 0xffffffc0>;
77		gpio-map-pass-thru = <0 0x3f>;
78		gpio-map =	<0 0 &gpio0 4 0>,	/* AN */
79				/* Not a GPIO*/		/* RST */
80				<2 0 &gpio1 12 0>,	/* CS */
81				<3 0 &gpio1 15 0>,	/* SCK */
82				<4 0 &gpio1 14 0>,	/* MISO */
83				<5 0 &gpio1 13 0>,	/* MOSI */
84							/* +3.3V */
85							/* GND */
86				<6 0 &gpio1 7 0>,	/* PWM */
87				<7 0 &gpio1 4 0>,	/* INT */
88				<8 0 &gpio1 0 0>,	/* RX */
89				<9 0 &gpio1 1 0>,	/* TX */
90				<10 0 &gpio1 3 0>,	/* SCL */
91				<11 0 &gpio1 2 0>;	/* SDA */
92							/* +5V */
93							/* GND */
94	};
95
96	arduino_header: connector {
97		compatible = "arduino-header-r3";
98		#gpio-cells = <2>;
99		gpio-map-mask = <0xffffffff 0xffffffc0>;
100		gpio-map-pass-thru = <0 0x3f>;
101		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
102			   <1 0 &gpio0 5 0>,	/* A1 */
103			   <2 0 &gpio0 6 0>,	/* A2 */
104			   <3 0 &gpio0 7 0>,	/* A3 */
105			   <4 0 &gpio0 25 0>,	/* A4 */
106			   <5 0 &gpio0 26 0>,	/* A5 */
107			   <6 0 &gpio1 0 0>,	/* D0 */
108			   <7 0 &gpio1 1 0>,	/* D1 */
109			   <8 0 &gpio1 4 0>,	/* D2 */
110			   <9 0 &gpio1 5 0>,	/* D3 */
111			   <10 0 &gpio1 6 0>,	/* D4 */
112			   <11 0 &gpio1 7 0>,	/* D5 */
113			   <12 0 &gpio1 8 0>,	/* D6 */
114			   <13 0 &gpio1 9 0>,	/* D7 */
115			   <14 0 &gpio1 10 0>,	/* D8 */
116			   <15 0 &gpio1 11 0>,	/* D9 */
117			   <16 0 &gpio1 12 0>,	/* D10 */
118			   <17 0 &gpio1 13 0>,	/* D11 */
119			   <18 0 &gpio1 14 0>,	/* D12 */
120			   <19 0 &gpio1 15 0>,	/* D13 */
121			   <20 0 &gpio1 2 0>,	/* D14 */
122			   <21 0 &gpio1 3 0>;	/* D15 */
123	};
124
125	arduino_adc: analog-connector {
126		compatible = "arduino,uno-adc";
127		#io-channel-cells = <1>;
128		io-channel-map = <0 &adc 0>,	/* A0 = P0.4 = AIN0 */
129				 <1 &adc 1>,	/* A1 = P0.5 = AIN1 */
130				 <2 &adc 2>,	/* A2 = P0.6 = AIN2 */
131				 <3 &adc 3>,	/* A3 = P0.7 = AIN3 */
132				 <4 &adc 4>,	/* A4 = P0.25 = AIN4 */
133				 <5 &adc 5>;	/* A5 = P0.26 = AIN5 */
134	};
135
136	gpio_fwd: nrf-gpio-forwarder {
137		compatible = "nordic,nrf-gpio-forwarder";
138		status = "disabled";
139		uart {
140			gpios = <&gpio0 20 0>, <&gpio0 22 0>, <&gpio0 11 0>, <&gpio0 10 0>;
141		};
142	};
143
144	/* These aliases are provided for compatibility with samples */
145	aliases {
146		led0 = &evb_led1;
147		led1 = &evb_led2;
148		led2 = &evb_led3;
149		led3 = &evb_led4;
150		pwm-led0 = &pwm_evb_led1;
151		sw0 = &evb_sw1;
152		sw1 = &evb_sw2;
153		sw2 = &evb_sw3;
154		sw3 = &evb_sw4;
155		bootloader-led0 = &evb_led1;
156		mcuboot-button0 = &evb_sw1;
157		mcuboot-led0 = &evb_led1;
158		watchdog0 = &wdt0;
159	};
160};
161
162&vregmain {
163	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
164};
165
166&vregradio {
167	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
168};
169
170&vregh {
171	status = "okay";
172};
173
174&lfxo {
175	load-capacitors = "internal";
176	load-capacitance-picofarad = <7>;
177};
178
179&adc {
180	status = "okay";
181};
182
183&gpiote {
184	status = "okay";
185};
186
187&gpio0 {
188	status = "okay";
189};
190
191&gpio1 {
192	status = "okay";
193};
194
195&i2c1 {
196	compatible = "nordic,nrf-twim";
197	status = "okay";
198	pinctrl-0 = <&i2c1_default>;
199	pinctrl-1 = <&i2c1_sleep>;
200	pinctrl-names = "default", "sleep";
201};
202
203&uart0 {
204	status = "okay";
205	current-speed = <115200>;
206	pinctrl-0 = <&uart0_default>;
207	pinctrl-1 = <&uart0_sleep>;
208	pinctrl-names = "default", "sleep";
209};
210
211&pwm0 {
212	status = "okay";
213	pinctrl-0 = <&pwm0_default>;
214	pinctrl-1 = <&pwm0_sleep>;
215	pinctrl-names = "default", "sleep";
216};
217
218&qspi {
219	status = "okay";
220	pinctrl-0 = <&qspi_default>;
221	pinctrl-1 = <&qspi_sleep>;
222	pinctrl-names = "default", "sleep";
223	mx25r64: mx25r6435f@0 {
224		compatible = "nordic,qspi-nor";
225		reg = <0>;
226		/* MX25R64 supports only pp and pp4io */
227		writeoc = "pp4io";
228		/* MX25R64 supports all readoc options */
229		readoc = "read4io";
230		sck-frequency = <8000000>;
231		jedec-id = [ c2 28 17  ];
232		sfdp-bfp = [
233			e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
234			ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
235			10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
236			30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
237		];
238		size = <67108864>;
239		has-dpd;
240		t-enter-dpd = <10000>;
241		t-exit-dpd = <35000>;
242	};
243};
244
245arduino_serial: &uart1 {
246	compatible = "nordic,nrf-uarte";
247	current-speed = <115200>;
248	pinctrl-0 = <&uart1_default>;
249	pinctrl-1 = <&uart1_sleep>;
250	pinctrl-names = "default", "sleep";
251};
252
253arduino_i2c: &i2c1 {};
254
255arduino_spi: &spi4 {
256	compatible = "nordic,nrf-spim";
257	status = "okay";
258	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
259	pinctrl-0 = <&spi4_default>;
260	pinctrl-1 = <&spi4_sleep>;
261	pinctrl-names = "default", "sleep";
262};
263
264&ieee802154 {
265	status = "okay";
266};
267
268zephyr_udc0: &usbd {
269	compatible = "nordic,nrf-usbd";
270	status = "okay";
271};
272
273/* Include default memory partition configuration file */
274#include <common/nordic/nrf5340_cpuapp_partition.dtsi>
275