1/*
2 * Copyright (c) 2022 Benjamin Björnsson <benjamin.bjornsson@gmail.com>.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/h7/stm32h747Xi_m7.dtsi>
9#include <st/h7/stm32h747xihx-pinctrl.dtsi>
10#include "arduino_portenta_h7-common.dtsi"
11#include <../boards/common/usb/cdc_acm_serial.dtsi>
12
13/ {
14	model = "Arduino Portenta H7 board";
15	compatible = "arduino,portenta-h7";
16
17	/* HW resources are split between CM7 and CM4 */
18	chosen {
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,code-partition = &slot0_partition;
22	};
23
24	oscen: oscen {
25		compatible = "regulator-fixed";
26		regulator-name = "oscen";
27		enable-gpios = <&gpioh 1 GPIO_ACTIVE_HIGH>;
28		regulator-boot-on;
29		status = "okay";
30	};
31
32	ethernet_phy_en: ethernet_phy_en {
33		compatible = "regulator-fixed";
34		regulator-name = "ethernet-phy-reset-release";
35		enable-gpios = <&gpioj 15 GPIO_ACTIVE_HIGH>;
36		regulator-boot-on;
37		status = "okay";
38	};
39
40	sdram1: sdram@c0000000 {
41		compatible = "zephyr,memory-region", "mmio-sram";
42		device_type = "memory";
43		reg = <0xc0000000 DT_SIZE_M(8)>;
44		zephyr,memory-region = "SDRAM1";
45		zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>;
46	};
47};
48
49&clk_hse {
50	clock-frequency = <DT_FREQ_M(25)>;
51	hse-bypass;
52	status = "okay";
53};
54
55&clk_hsi {
56	hsi-div = <1>;
57	status = "okay";
58};
59
60&pll {
61	div-m = <5>;
62	mul-n = <160>;
63	div-p = <2>;
64	div-q = <10>;
65	div-r = <2>;
66	clocks = <&clk_hse>;
67	status = "okay";
68};
69
70/** The power supply for the Portenta H7 is based on a ST PSU reference design.
71 *  The design specification from this reference design limits the maximum
72 *  clock speed to 400 MHz.
73 *        Refer: section 8.1 of the reference design guide.
74 */
75
76&rcc {
77	clocks = <&pll>;
78	clock-frequency = <DT_FREQ_M(400)>;
79};
80
81/* USART1 is enabled on M4 by default */
82&usart1 {
83	status = "disabled";
84};
85
86&i2c1 {
87	status = "okay";
88};
89
90/* Only one should be enabled */
91&usbotg_fs {
92	status = "disabled";
93};
94
95&usbotg_hs {
96	status = "okay";
97};
98
99&flash0 {
100	partitions {
101		compatible = "fixed-partitions";
102		#address-cells = <1>;
103		#size-cells = <1>;
104
105		boot_partition: partition@0 {
106			label = "mcuboot";
107			reg = <0x00000000 0x00010000>;
108			read-only;
109		};
110		/*
111		 * The flash starting at 0x00010000 and ending at
112		 * 0x0001ffff (sectors 16-31) is reserved for use
113		 * by the application.
114		 */
115		scratch_partition: partition@10000 {
116			label = "image-scratch";
117			reg = <0x00010000 0x00030000>;
118		};
119		/* The arduino default bootloader occupies the address space 0x0 - 0x40000.
120		 * This way regardless of the user's choice to use the mcuboot bootloader,
121		 * applications will be located at 0x40000 which will be loaded by the
122		 * arduino bootloader.
123		 */
124		slot0_partition: partition@40000 {
125			label = "image-0";
126			reg = <0x00040000 0x00060000>;
127		};
128		slot1_partition: partition@A0000 {
129			label = "image-1";
130			reg = <0x000A0000 0x00060000>;
131		};
132	};
133};
134