1/*
2 * Copyright (c) 2024 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/h7/stm32h7b0Xb.dtsi>
9#include <st/h7/stm32h7b0vbtx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
12
13/ {
14	model = "WeAct Studio MiniSTM32H7B0 Core Board";
15	compatible = "weact,mini-stm32h7b0";
16
17	chosen {
18		zephyr,console = &usb_cdc_acm_uart;
19		zephyr,shell-uart = &usb_cdc_acm_uart;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,display = &st7735r_160x80;
23	};
24
25	leds {
26		compatible = "gpio-leds";
27		user_led: led {
28			gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
29			label = "User LED";
30		};
31	};
32
33	gpio_keys {
34		compatible = "gpio-keys";
35		user_button: button {
36			label = "User PB";
37			gpios = <&gpioc 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
38			zephyr,code = <INPUT_KEY_0>;
39		};
40	};
41
42	mipi_dbi_st7735r_160x80 {
43		compatible = "zephyr,mipi-dbi-spi";
44		spi-dev = <&spi4>;
45		dc-gpios = <&gpioe 13 GPIO_ACTIVE_HIGH>;
46		#address-cells = <1>;
47		#size-cells = <0>;
48
49		st7735r_160x80: st7735r@0 {
50			compatible = "sitronix,st7735r";
51			mipi-max-frequency = <20000000>;
52			mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
53			reg = <0>;
54			width = <160>;
55			height = <80>;
56			inversion-on;
57			rgb-is-inverted;
58			x-offset = <1>;
59			y-offset = <26>;
60			pwctr1 = [A2 02 84];
61			pwctr2 = [C5];
62			pwctr3 = [0A 00];
63			pwctr4 = [8A 2A];
64			pwctr5 = [8A EE];
65			invctr = <7>;
66			frmctr1 = [01 2C 2D];
67			frmctr2 = [01 2C 2D];
68			frmctr3 = [01 2C 2D 01 2C 2D];
69			vmctr1 = <14>;
70			gamctrp1 = [02 1C 07 12 37 32 29 2D 29 25 2B 39 00 01 03 10];
71			gamctrn1 = [03 1D 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10];
72			colmod = <5>;
73			/* Set D3 (RGB) bit to 1. LV_COLOR_16_SWAP is enabled by default */
74			madctl = <120>; /* Set to <184> to rotate the image 180 degrees. */
75			caset = [00 01 00 a0];
76			raset = [00 1a 00 69];
77		};
78	};
79
80	aliases {
81		led0 = &user_led;
82		sw0 = &user_button;
83		watchdog0 = &iwdg;
84		sdhc0 = &sdmmc1;
85	};
86};
87
88&clk_lsi {
89	status = "okay";
90};
91
92&clk_hsi48 {
93	status = "okay";
94};
95
96&clk_hse {
97	clock-frequency = <DT_FREQ_M(25)>;
98	status = "okay";
99};
100
101&pll {
102	div-m = <5>;
103	mul-n = <112>;
104	div-p = <2>;
105	div-q = <2>;
106	div-r = <2>;
107	clocks = <&clk_hse>;
108	status = "okay";
109};
110
111&rcc {
112	clocks = <&pll>;
113	clock-frequency = <DT_FREQ_M(280)>;
114	d1cpre = <1>;
115	hpre = <2>;
116	d1ppre = <1>;
117	d2ppre1 = <1>;
118	d2ppre2 = <1>;
119	d3ppre = <1>;
120};
121
122&sdmmc1 {
123	pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9
124		     &sdmmc1_d2_pc10 &sdmmc1_d3_pc11
125		     &sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>;
126	pinctrl-names = "default";
127	cd-gpios = <&gpiod 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
128	status = "okay";
129};
130
131zephyr_udc0: &usbotg_hs {
132	pinctrl-0 = <&usb_otg_hs_dm_pa11 &usb_otg_hs_dp_pa12>;
133	pinctrl-names = "default";
134	status = "okay";
135
136	usb_cdc_acm_uart: cdc_acm_uart {
137		compatible = "zephyr,cdc-acm-uart";
138	};
139};
140
141
142&octospi1 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&octospim_p1_clk_pb2 &octospim_p1_ncs_pb6
145		&octospim_p1_io0_pd11 &octospim_p1_io1_pd12
146		&octospim_p1_io2_pe2 &octospim_p1_io3_pd13>;
147	status = "okay";
148
149	w25q64_qspi: ospi-nor-flash@90000000 {
150		compatible = "st,stm32-ospi-nor";
151		reg = <0x90000000 DT_SIZE_M(64)>; /* 64 Mbits */
152		ospi-max-frequency = <40000000>;
153		status = "okay";
154		spi-bus-width = <4>;
155		data-rate = <OSPI_STR_TRANSFER>;
156		writeoc = "PP_1_1_4";
157
158		partitions {
159			compatible = "fixed-partitions";
160			#address-cells = <1>;
161			#size-cells = <1>;
162			slot0_partition: partition@0 {
163				reg = <0x00000000 DT_SIZE_M(64)>;
164			};
165		};
166	};
167};
168
169&spi1 {
170	pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pd7>;
171	cs-gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
172	pinctrl-names = "default";
173	status = "okay";
174	w25q64_spi: spi-nor-flash@0 {
175		compatible = "jedec,spi-nor";
176		reg = <0>;
177		spi-max-frequency = <40000000>;
178		size = <DT_SIZE_M(64)>; /* 64 Mbits */
179		status = "okay";
180		jedec-id = [ef 40 17];
181		has-dpd;
182		t-enter-dpd = <3500>;
183		t-exit-dpd = <3500>;
184		partitions {
185			compatible = "fixed-partitions";
186			#address-cells = <1>;
187			#size-cells = <1>;
188			storage_partition: partition@0 {
189				label = "storage";
190				reg = <0x00000000 DT_SIZE_M(64)>;
191			};
192		};
193	};
194};
195
196&gpioe {
197	status = "okay";
198
199	lcd_led {
200		gpio-hog;
201		gpios = <10 GPIO_ACTIVE_LOW>;
202		output-high;
203	};
204};
205
206&spi4 {
207	pinctrl-0 = <&spi4_sck_pe12 &spi4_mosi_pe14>;
208	cs-gpios = <&gpioe 11 GPIO_ACTIVE_LOW>;
209	pinctrl-names = "default";
210	status = "okay";
211};
212
213&rng {
214	status = "okay";
215};
216
217&backup_sram {
218	status = "okay";
219};
220
221&iwdg1 {
222	status = "okay";
223};
224