1/*
2 * Copyright (c) 2024 Analog Devices, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <adi/max32/max32672.dtsi>
10#include <adi/max32/max32672-pinctrl.dtsi>
11#include <zephyr/dt-bindings/gpio/adi-max32-gpio.h>
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "Analog Devices MAX32672FTHR";
16	compatible = "adi,max32672fthr";
17
18	chosen {
19		zephyr,console = &uart0;
20		zephyr,shell-uart = &uart0;
21		zephyr,sram = &sram3;
22		zephyr,flash = &flash0;
23		zephyr,display = &ssd1306;
24	};
25
26	leds {
27		compatible = "gpio-leds";
28		led1: led_1 {
29			gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
30			label = "Red LED";
31		};
32		led2: led_2 {
33			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
34			label = "Green LED";
35		};
36		led3: led_3 {
37			gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
38			label = "Blue LED";
39		};
40	};
41
42	buttons {
43		compatible = "gpio-keys";
44		pb1: pb1 {
45			gpios = <&gpio0 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
46			label = "SW2";
47			zephyr,code = <INPUT_KEY_0>;
48		};
49	};
50
51	/* These aliases are provided for compatibility with samples */
52	aliases {
53		led0 = &led1;
54		led1 = &led2;
55		led2 = &led3;
56		sw0 = &pb1;
57		watchdog0 = &wdt0;
58	};
59
60	/* Used for accessing other pins */
61	feather_header: feather_connector {
62		compatible = "adafruit-feather-header";
63		#gpio-cells = <2>;
64		gpio-map-mask = <0xffffffff 0xffffffc0>;
65		gpio-map-pass-thru = <0 0x3f>;
66		gpio-map = <12 0 &gpio0 19 0>,  /* SDA */
67				<13 0 &gpio0 18 0>,  /* SCL */
68				<14 0 &gpio0 25 0>,  /* I2S LRCLK */
69				<15 0 &gpio0 24 0>,  /* I2S SDO */
70				<16 0 &gpio0 17 0>,   /* SPI1 SS */
71				<17 0 &gpio0 23 0>,   /* QEI */
72				<18 0 &gpio0 7 0>,   /* QEB */
73				<19 0 &gpio0 6 0>,   /* QEA */
74				<20 0 &gpio0 5 0>,   /* HFX CLK OUT */
75				/* 11 not connected */
76				<10 0 &gpio0 29 0>,  /* TX */
77				<9 0 &gpio0 28 0>,   /* RX */
78				<8 0 &gpio0 14 0>,   /* MISO */
79				<7 0 &gpio0 15 0>,   /* MOSI */
80				<6 0 &gpio0 16 0>,   /* SCK */
81				<5 0 &gpio0 26 0>,   /* I2S BCLK */
82				<4 0 &gpio0 27 0>,   /* I2S SDI */
83				<3 0 &gpio0 22 0>,   /* ADC_TRG */
84				<2 0 &gpio0 13 0>,   /* AIN5 */
85				<1 0 &gpio0 12 0>,   /* AIN4 */
86				<0 0 &gpio0 11 0>;   /* AIN3 */
87	};
88};
89
90&uart0 {
91	pinctrl-0 = <&uart0a_tx_p0_9 &uart0a_rx_p0_8>;
92	pinctrl-names = "default";
93	current-speed = <115200>;
94	data-bits = <8>;
95	parity = "none";
96	status = "okay";
97};
98
99&clk_ipo {
100	status = "okay";
101};
102
103/*
104 * ERTCO is required for counter RTC
105 */
106&clk_ertco {
107	status = "okay";
108};
109
110&gpio0 {
111	status = "okay";
112};
113
114&gpio1 {
115	status = "okay";
116};
117
118&trng {
119	status = "okay";
120};
121
122&i2c2 {
123	pinctrl-0 = <&i2c2a_scl_p0_18 &i2c2a_sda_p0_19>;
124	pinctrl-names = "default";
125	clock-frequency = <I2C_BITRATE_FAST>;
126	status = "okay";
127
128	ssd1306: ssd1306@3d {
129		compatible = "solomon,ssd1306fb";
130		reg = <0x3d>;
131		width = <128>;
132		height = <32>;
133		segment-offset = <0>;
134		page-offset = <0>;
135		display-offset = <0>;
136		multiplex-ratio = <31>;
137		segment-remap;
138		com-invdir;
139		com-sequential;
140		prechargep = <0x22>;
141		inversion-on;
142	};
143};
144
145&dma0 {
146	status = "okay";
147};
148
149&wdt0 {
150	status = "okay";
151};
152
153&spi1 {
154	status = "okay";
155	pinctrl-0 = <&spi1a_mosi_p0_15 &spi1a_miso_p0_14 &spi1a_sck_p0_16 &spi1a_ss0_p0_17>;
156	pinctrl-names = "default";
157};
158
159&rtc_counter {
160	status = "okay";
161};
162