1/*
2 * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6/dts-v1/;
7
8#include <espressif/esp32s3/esp32s3_fn8.dtsi>
9#include "m5stack_atoms3-pinctrl.dtsi"
10#include "grove_connectors.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
13#include <espressif/partitions_0x0_amp.dtsi>
14
15/ {
16	model = "M5Stack AtomS3 PROCPU";
17	compatible = "m5stack,atoms3";
18
19	chosen {
20		zephyr,sram = &sram1;
21		zephyr,console = &usb_serial;
22		zephyr,shell-uart = &usb_serial;
23		zephyr,flash = &flash0;
24		zephyr,code-partition = &slot0_partition;
25		zephyr,display = &st7789v;
26		zephyr,bt-hci = &esp32_bt_hci;
27	};
28
29	aliases {
30		sw0 = &user_button_0;
31		watchdog0 = &wdt0;
32		accel0 = &mpu6886;
33	};
34
35	gpio_keys {
36		compatible = "gpio-keys";
37
38		/* This is the button that's underneath the LCD display  */
39		user_button_0: button_0 {
40			label = "User button 0";
41			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; // G42
42			zephyr,code = <INPUT_KEY_0>;
43		};
44	};
45
46	/* Regulators */
47	lcd_backlight_en {
48		compatible = "regulator-fixed";
49		regulator-name = "lcd_backlight_enable";
50		enable-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
51		regulator-boot-on;
52	};
53
54	mipi_dbi {
55		compatible = "zephyr,mipi-dbi-spi";
56		spi-dev = <&spi2>;
57		dc-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;	     /* G33 */
58		reset-gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;    /* G34 */
59		write-only;
60		#address-cells = <1>;
61		#size-cells = <0>;
62
63		st7789v: st7789v@0 {
64			compatible = "sitronix,st7789v";
65			reg = <0>;
66			mipi-max-frequency = <27000000>;
67
68			width = <128>;
69			height = <128>;
70			x-offset = <2>;
71			y-offset = <1>;
72
73			vcom = <0x28>;
74			gctrl = <0x35>;
75			vrhs = <0x10>;
76			vdvs = <0x20>;
77			mdac = <0x00>;
78			gamma = <0x01>;
79			colmod = <0x55>;
80			lcm = <0x0c>;
81			porch-param = [0c 0c 00 33 33];
82			cmd2en-param = [5a 69 02 00];
83			pwctrl1-param = [a4 a1];
84			pvgam-param = [d0 00 02 07 0a 28 32 44 42 06 0e 12 14 17];
85			nvgam-param = [d0 00 02 07 0a 28 31 54 47 0e 1c 17 1b 1e];
86			ram-param = [00 E0];
87			rgb-param = [40 02 14];
88			mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
89		};
90
91	};
92
93};
94
95&usb_serial {
96	status = "okay";
97};
98
99&uart0 {
100	status = "okay";
101	current-speed = <115200>;
102	pinctrl-0 = <&uart0_default>;
103	pinctrl-names = "default";
104};
105
106&i2c0 {
107	status = "okay";
108	clock-frequency = <I2C_BITRATE_STANDARD>;
109	pinctrl-0 = <&i2c0_default>;
110	pinctrl-names = "default";
111
112	mpu6886: mpu6886@68 {
113		compatible = "invensense,mpu6050";
114		reg = <0x68>;
115		status = "okay";
116	};
117};
118
119&i2c1 {
120	status = "okay";
121	clock-frequency = <I2C_BITRATE_STANDARD>;
122	pinctrl-0 = <&i2c1_default>;
123	pinctrl-names = "default";
124};
125
126&trng0 {
127	status = "okay";
128};
129
130&spi2 {
131	#address-cells = <1>;
132	#size-cells = <0>;
133	status = "okay";
134	pinctrl-0 = <&spim2_default>;
135	pinctrl-names = "default";
136};
137
138&gpio0 {
139	status = "okay";
140};
141
142&gpio1 {
143	status = "okay";
144};
145
146&wdt0 {
147	status = "okay";
148};
149
150&timer0 {
151	status = "okay";
152};
153
154&timer1 {
155	status = "okay";
156};
157
158&esp32_bt_hci {
159	status = "okay";
160};
161