1/*
2 * Copyright (c) 2024 Nikola Trifunovic <nikola@trifunovic.at>
3 * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
4 * Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org>
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8/dts-v1/;
9
10#include <espressif/esp32/esp32_pico_d4.dtsi>
11#include "m5stack_atom_lite-pinctrl.dtsi"
12#include "grove_connectors.dtsi"
13#include <zephyr/dt-bindings/input/input-event-codes.h>
14#include <zephyr/dt-bindings/led/led.h>
15#include <zephyr/dt-bindings/led/worldsemi_ws2812c.h>
16#include <espressif/partitions_0x1000_amp.dtsi>
17
18/ {
19	model = "M5Stack ATOM Lite PROCPU";
20	compatible = "m5stack,m5stack-atom-lite";
21
22	chosen {
23		zephyr,sram = &sram1;
24		zephyr,console = &uart0;
25		zephyr,shell-uart = &uart0;
26		zephyr,flash = &flash0;
27		zephyr,code-partition = &slot0_partition;
28		zephyr,bt-hci = &esp32_bt_hci;
29	};
30
31	aliases {
32		sw0 = &user_button_0;
33		watchdog0 = &wdt0;
34		i2c-0 = &i2c0;
35		led-strip = &status_rgb_led;
36	};
37
38	leds {
39		compatible = "gpio-leds";
40
41		ir_led: led_0 {
42			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
43			label = "Infrared LED";
44		};
45	};
46
47	gpio_keys {
48		compatible = "gpio-keys";
49
50		user_button_0: button_0 {
51			label = "User button 0";
52			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; // G39
53			zephyr,code = <INPUT_KEY_0>;
54		};
55	};
56};
57
58&uart0 {
59	status = "okay";
60	current-speed = <115200>;
61	pinctrl-0 = <&uart0_default>;
62	pinctrl-names = "default";
63};
64
65&i2c0 {
66	status = "okay";
67	clock-frequency = <I2C_BITRATE_FAST>;
68	pinctrl-0 = <&i2c0_default>;
69	pinctrl-names = "default";
70	sda-gpios = <&gpio0 25 GPIO_OPEN_DRAIN>;
71	scl-gpios = <&gpio0 21 GPIO_OPEN_DRAIN>;
72};
73
74&i2c1 {
75	status = "okay";
76	clock-frequency = <I2C_BITRATE_FAST>;
77	pinctrl-0 = <&i2c1_default>;
78	pinctrl-names = "default";
79	sda-gpios = <&gpio0 26 GPIO_OPEN_DRAIN>;
80	scl-gpios = <&gpio1 0 GPIO_OPEN_DRAIN>;
81};
82
83&timer0 {
84	status = "okay";
85};
86
87&timer1 {
88	status = "okay";
89};
90
91&timer2 {
92	status = "okay";
93};
94
95&timer3 {
96	status = "okay";
97};
98
99&trng0 {
100	status = "okay";
101};
102
103&spi2 {
104	#address-cells = <1>;
105	#size-cells = <0>;
106	pinctrl-0 = <&spim2_default>;
107	pinctrl-names = "default";
108};
109
110/* used for SK6812 */
111&spi3 {
112	#address-cells = <1>;
113	#size-cells = <0>;
114	status = "okay";
115	line-idle-low;
116	pinctrl-0 = <&spim3_ws2812_led>;
117	pinctrl-names = "default";
118
119	status_rgb_led: ws2812@0 {
120		compatible = "worldsemi,ws2812-spi";
121		reg = <0>;
122		spi-max-frequency = <WS2812C_SPI_FREQ>;
123
124		chain-length = <1>;
125		color-mapping = <LED_COLOR_ID_GREEN>,
126				<LED_COLOR_ID_RED>,
127				<LED_COLOR_ID_BLUE>;
128		spi-one-frame = <WS2812C_ONE_FRAME>;
129		spi-zero-frame = <WS2812C_ZERO_FRAME>;
130	};
131};
132
133&gpio0 {
134	status = "okay";
135};
136
137&gpio1 {
138	status = "okay";
139};
140
141&wdt0 {
142	status = "okay";
143};
144
145&esp32_bt_hci {
146	status = "okay";
147};
148
149&wifi {
150	status = "okay";
151};
152