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	};
58
59	/* Used for accessing other pins */
60	feather_header: feather_connector {
61		compatible = "adafruit-feather-header";
62		#gpio-cells = <2>;
63		gpio-map-mask = <0xffffffff 0xffffffc0>;
64		gpio-map-pass-thru = <0 0x3f>;
65		gpio-map = <12 0 &gpio0 19 0>,  /* SDA */
66				<13 0 &gpio0 18 0>,  /* SCL */
67				<14 0 &gpio0 25 0>,  /* I2S LRCLK */
68				<15 0 &gpio0 24 0>,  /* I2S SDO */
69				<16 0 &gpio0 17 0>,   /* SPI1 SS */
70				<17 0 &gpio0 23 0>,   /* QEI */
71				<18 0 &gpio0 7 0>,   /* QEB */
72				<19 0 &gpio0 6 0>,   /* QEA */
73				<20 0 &gpio0 5 0>,   /* HFX CLK OUT */
74				/* 11 not connected */
75				<10 0 &gpio0 29 0>,  /* TX */
76				<9 0 &gpio0 28 0>,   /* RX */
77				<8 0 &gpio0 14 0>,   /* MISO */
78				<7 0 &gpio0 15 0>,   /* MOSI */
79				<6 0 &gpio0 16 0>,   /* SCK */
80				<5 0 &gpio0 26 0>,   /* I2S BCLK */
81				<4 0 &gpio0 27 0>,   /* I2S SDI */
82				<3 0 &gpio0 22 0>,   /* ADC_TRG */
83				<2 0 &gpio0 13 0>,   /* AIN5 */
84				<1 0 &gpio0 12 0>,   /* AIN4 */
85				<0 0 &gpio0 11 0>;   /* AIN3 */
86	};
87};
88
89&uart0 {
90	pinctrl-0 = <&uart0a_tx_p0_9 &uart0a_rx_p0_8>;
91	pinctrl-names = "default";
92	current-speed = <115200>;
93	data-bits = <8>;
94	parity = "none";
95	status = "okay";
96};
97
98&clk_ipo {
99	status = "okay";
100};
101
102&gpio0 {
103	status = "okay";
104};
105
106&gpio1 {
107	status = "okay";
108};
109
110&trng {
111	status = "okay";
112};
113
114&i2c2 {
115	pinctrl-0 = <&i2c2a_scl_p0_18 &i2c2a_sda_p0_19>;
116	pinctrl-names = "default";
117	clock-frequency = <I2C_BITRATE_FAST>;
118	status = "okay";
119
120	ssd1306: ssd1306@3d {
121		compatible = "solomon,ssd1306fb";
122		reg = <0x3d>;
123		width = <128>;
124		height = <32>;
125		segment-offset = <0>;
126		page-offset = <0>;
127		display-offset = <0>;
128		multiplex-ratio = <31>;
129		segment-remap;
130		com-invdir;
131		com-sequential;
132		prechargep = <0x22>;
133		inversion-on;
134	};
135};
136