1/*
2 * Copyright (c) 2020-2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#include "nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi"
7#include <zephyr/dt-bindings/sensor/ina230.h>
8
9/ {
10	chosen {
11		zephyr,console = &uart0;
12		zephyr,shell-uart = &uart0;
13		zephyr,uart-mcumgr = &uart0;
14		zephyr,bt-mon-uart = &uart0;
15		zephyr,bt-c2h-uart = &uart0;
16		zephyr,bt-hci = &bt_hci_ipc0;
17		watchdog0 = &wdt0;
18	};
19
20	gpio_fwd: nrf-gpio-forwarder {
21		compatible = "nordic,nrf-gpio-forwarder";
22		status = "okay";
23		uart {
24			gpios = <&gpio1 9 0>, <&gpio1 8 0>, <&gpio1 11 0>, <&gpio1 10 0>;
25		};
26	};
27
28	arduino_adc: analog-connector {
29		compatible = "arduino,uno-adc";
30		#io-channel-cells = <1>;
31		io-channel-map = <0 &adc 1>,	/* A0 = P0.4 = AIN1 */
32				 <1 &adc 2>,	/* A1 = P0.5 = AIN2 */
33				 <2 &adc 4>,	/* A2 = P0.6 = AIN4 */
34				 <3 &adc 5>,	/* A3 = P0.7 = AIN5 */
35				 <4 &adc 6>,	/* A4 = P0.25 = AIN6 */
36				 <5 &adc 7>;	/* A5 = P0.26 = AIN7 */
37	};
38
39	pmic {
40		compatible = "nordic,npm1100";
41		nordic,iset-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
42	};
43
44	board_id: board_id {
45		compatible = "voltage-divider";
46		io-channels = <&adc 0>;
47		output-ohms = <20000>;
48		full-ohms = <47000>;
49		power-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
50	};
51
52	pwmleds {
53		compatible = "pwm-leds";
54		rgb1_red_pwm_led: pwm_led_0 {
55			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
56		};
57		rgb1_green_pwm_led: pwm_led_1 {
58			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
59		};
60		rgb1_blue_pwm_led: pwm_led_2 {
61			pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
62		};
63	};
64
65	aliases {
66		pwm-led0 = &rgb1_red_pwm_led;
67		pwm-led1 = &rgb1_green_pwm_led;
68		pwm-led2 = &rgb1_blue_pwm_led;
69		red-pwm-led = &rgb1_red_pwm_led;
70		green-pwm-led = &rgb1_green_pwm_led;
71		blue-pwm-led = &rgb1_blue_pwm_led;
72	};
73};
74
75&vregmain {
76	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
77};
78
79&vregradio {
80	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
81};
82
83&vregh {
84	status = "okay";
85};
86
87&lfxo {
88	load-capacitors = "internal";
89	load-capacitance-picofarad = <7>;
90};
91
92&adc {
93	status = "okay";
94	#address-cells = <1>;
95	#size-cells = <0>;
96
97	channel@0 {
98		reg = <0>;
99		zephyr,gain = "ADC_GAIN_1_4";
100		zephyr,reference = "ADC_REF_VDD_1_4";
101		zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40)>;
102		zephyr,input-positive = <NRF_SAADC_AIN6>;
103		zephyr,resolution = <12>;
104		zephyr,oversampling = <8>;
105	};
106};
107
108&gpiote {
109	status = "okay";
110};
111
112&gpio0 {
113	status = "okay";
114
115	codec-interface {
116		gpio-hog;
117		gpios = <21 GPIO_ACTIVE_HIGH>;
118		/* low output to select on-board codec control */
119		output-low;
120	};
121};
122
123&gpio1 {
124	status = "okay";
125};
126
127&i2s0 {
128	compatible = "nordic,nrf-i2s";
129	status = "okay";
130	pinctrl-0 = <&i2s0_default>;
131	pinctrl-1 = <&i2s0_sleep>;
132	pinctrl-names = "default", "sleep";
133};
134
135&uart0 {
136	status = "okay";
137	current-speed = <115200>;
138	pinctrl-0 = <&uart0_default>;
139	pinctrl-1 = <&uart0_sleep>;
140	pinctrl-names = "default", "sleep";
141};
142
143arduino_serial: &uart1 {
144	compatible = "nordic,nrf-uarte";
145	current-speed = <115200>;
146	pinctrl-0 = <&uart1_default>;
147	pinctrl-1 = <&uart1_sleep>;
148	pinctrl-names = "default", "sleep";
149};
150
151arduino_i2c: &i2c1 {
152	compatible = "nordic,nrf-twim";
153	status = "okay";
154	pinctrl-0 = <&i2c1_default>;
155	pinctrl-1 = <&i2c1_sleep>;
156	pinctrl-names = "default", "sleep";
157
158	vbat_sensor: ina231@44 {
159		compatible = "ti,ina230";
160		reg = <0x44>;
161		adc-mode = "Bus and shunt voltage continuous";
162		vbus-conversion-time-us = <4156>;
163		vshunt-conversion-time-us = <4156>;
164		avg-count = <1024>;
165		current-lsb-microamps = <1>;
166		rshunt-micro-ohms = <510000>;
167	};
168
169	vdd1_codec_sensor: ina231@45 {
170		compatible = "ti,ina230";
171		reg = <0x45>;
172		adc-mode = "Bus and shunt voltage continuous";
173		vbus-conversion-time-us = <4156>;
174		vshunt-conversion-time-us = <4156>;
175		avg-count = <1024>;
176		current-lsb-microamps = <1>;
177		rshunt-micro-ohms = <2200000>;
178	};
179
180	vdd2_codec_sensor: ina231@41 {
181		compatible = "ti,ina230";
182		reg = <0x41>;
183		adc-mode = "Bus and shunt voltage continuous";
184		vbus-conversion-time-us = <4156>;
185		vshunt-conversion-time-us = <4156>;
186		avg-count = <1024>;
187		current-lsb-microamps = <1>;
188		rshunt-micro-ohms = <2200000>;
189	};
190
191	vdd2_nrf_sensor: ina231@40 {
192		compatible = "ti,ina230";
193		reg = <0x40>;
194		adc-mode = "Bus and shunt voltage continuous";
195		vbus-conversion-time-us = <4156>;
196		vshunt-conversion-time-us = <4156>;
197		avg-count = <1024>;
198		current-lsb-microamps = <1>;
199		rshunt-micro-ohms = <1000000>;
200	};
201};
202
203arduino_spi: &spi4 {
204	compatible = "nordic,nrf-spim";
205	status = "okay";
206	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>,
207		<&gpio0 11 GPIO_ACTIVE_LOW>, <&gpio0 17 GPIO_ACTIVE_LOW>;
208	pinctrl-0 = <&spi4_default>;
209	pinctrl-1 = <&spi4_sleep>;
210	pinctrl-names = "default", "sleep";
211	sdhc0: sdhc@1 {
212		compatible = "zephyr,sdhc-spi-slot";
213		reg = <1>;
214		status = "okay";
215		sdmmc {
216			compatible = "zephyr,sdmmc-disk";
217			disk-name = "SD";
218			status = "okay";
219		};
220
221		spi-max-frequency = <8000000>;
222	};
223
224	cs47l63: cs47l63@2 {
225		compatible = "cirrus,cs47l63";
226		reg = <2>;
227		spi-max-frequency = <8000000>;
228		irq-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
229		reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
230		gpio9-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
231	};
232};
233
234&pwm0 {
235	status = "okay";
236	pinctrl-0 = <&pwm0_default>;
237	pinctrl-1 = <&pwm0_sleep>;
238	pinctrl-names = "default", "sleep";
239};
240
241zephyr_udc0: &usbd {
242	compatible = "nordic,nrf-usbd";
243	status = "okay";
244
245	hs_0: hs_0 {
246		compatible = "usb-audio-hs";
247		mic-feature-mute;
248		mic-channel-l;
249		mic-channel-r;
250
251		hp-feature-mute;
252		hp-channel-l;
253		hp-channel-r;
254	};
255};
256
257/* Include default memory partition configuration file */
258#include <common/nordic/nrf5340_cpuapp_partition.dtsi>
259#include "nrf5340_audio_dk_nrf5340_shared.dtsi"
260