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		zephyr,bt-hci = &bt_hci_uart;
23	};
24
25	oscen: oscen {
26		compatible = "regulator-fixed";
27		regulator-name = "oscen";
28		enable-gpios = <&gpioh 1 GPIO_ACTIVE_HIGH>;
29		regulator-boot-on;
30		status = "okay";
31	};
32
33	ethernet_phy_en: ethernet_phy_en {
34		compatible = "regulator-fixed";
35		regulator-name = "ethernet-phy-reset-release";
36		enable-gpios = <&gpioj 15 GPIO_ACTIVE_HIGH>;
37		regulator-boot-on;
38		status = "okay";
39	};
40
41	sdram1: sdram@c0000000 {
42		compatible = "zephyr,memory-region", "mmio-sram";
43		device_type = "memory";
44		reg = <0xc0000000 DT_SIZE_M(8)>;
45		zephyr,memory-region = "SDRAM1";
46		zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>;
47	};
48};
49
50&clk_hse {
51	clock-frequency = <DT_FREQ_M(25)>;
52	hse-bypass;
53	status = "okay";
54};
55
56&clk_hsi {
57	hsi-div = <1>;
58	status = "okay";
59};
60
61&pll {
62	div-m = <5>;
63	mul-n = <160>;
64	div-p = <2>;
65	div-q = <10>;
66	div-r = <2>;
67	clocks = <&clk_hse>;
68	status = "okay";
69};
70
71/** The power supply for the Portenta H7 is based on a ST PSU reference design.
72 *  The design specification from this reference design limits the maximum
73 *  clock speed to 400 MHz.
74 *        Refer: section 8.1 of the reference design guide.
75 */
76
77&rcc {
78	clocks = <&pll>;
79	clock-frequency = <DT_FREQ_M(400)>;
80};
81
82/* USART1 is enabled on M4 by default */
83&usart1 {
84	status = "disabled";
85};
86
87&i2c1 {
88	status = "okay";
89
90	pf1550: pmic@8 {
91		status = "okay";
92		reg = <0x8>;
93		compatible = "nxp,pf1550";
94
95		pmic_regulators: regulators {
96			status = "okay";
97			compatible = "nxp,pf1550-regulator";
98			pf1550_sw1: BUCK1 {
99				regulator-init-microvolt = <3000000>;
100				regulator-boot-on;
101			};
102			pf1550_sw2: BUCK2 {
103				regulator-init-microvolt = <3300000>;
104				regulator-boot-on;
105			};
106			pf1550_sw3: BUCK3 {
107				regulator-init-microvolt = <3300000>;
108				regulator-init-microamp = <2000000>;
109				regulator-boot-on;
110			};
111			pf1550_ldo1: LDO1 {
112				regulator-init-microvolt = <1000000>;
113				regulator-boot-on;
114			};
115			pf1550_ldo2: LDO2 {
116				regulator-init-microvolt = <1800000>;
117				regulator-boot-on;
118			};
119			pf1550_ldo3: LDO3 {
120				regulator-init-microvolt = <1200000>;
121				regulator-boot-on;
122			};
123		};
124
125		pmic_charger: charger {
126			status = "okay";
127			compatible = "nxp,pf1550-charger";
128			constant-charge-current-max-microamp = <100000>;
129			constant-charge-voltage-max-microvolt = <4200000>;
130			pf1550,int-gpios = <&gpiok 0 0>;
131			pf1550,led-behaviour = "manual-off";
132			pf1550,system-voltage-min-threshold-microvolt = <3500000>;
133			pf1550,thermistor-monitoring-mode = "thermistor";
134			pf1550,vbus-current-limit-microamp = <1500000>;
135		};
136	};
137};
138
139/* Only one should be enabled */
140&usbotg_fs {
141	status = "disabled";
142};
143
144&usbotg_hs {
145	status = "okay";
146};
147
148&flash0 {
149	partitions {
150		compatible = "fixed-partitions";
151		#address-cells = <1>;
152		#size-cells = <1>;
153
154		boot_partition: partition@0 {
155			label = "mcuboot";
156			reg = <0x00000000 0x00010000>;
157			read-only;
158		};
159		/*
160		 * The flash starting at 0x00010000 and ending at
161		 * 0x0001ffff (sectors 16-31) is reserved for use
162		 * by the application.
163		 */
164		scratch_partition: partition@10000 {
165			label = "image-scratch";
166			reg = <0x00010000 0x00030000>;
167		};
168		/* The arduino default bootloader occupies the address space 0x0 - 0x40000.
169		 * This way regardless of the user's choice to use the mcuboot bootloader,
170		 * applications will be located at 0x40000 which will be loaded by the
171		 * arduino bootloader.
172		 */
173		slot0_partition: partition@40000 {
174			label = "image-0";
175			reg = <0x00040000 0x00060000>;
176		};
177		slot1_partition: partition@A0000 {
178			label = "image-1";
179			reg = <0x000A0000 0x00060000>;
180		};
181	};
182};
183
184&uart7 {
185	pinctrl-0 = <&uart7_tx_pa15 &uart7_rx_pf6
186		     &uart7_cts_pf9 &uart7_rts_pf8>;
187	pinctrl-names = "default";
188	current-speed = <115200>;
189	hw-flow-control;
190	status = "okay";
191
192	bt_hci_uart: bt_hci_uart {
193		compatible = "zephyr,bt-hci-uart";
194		status = "okay";
195
196		murata-1dx {
197			compatible = "infineon,cyw43xxx-bt-hci";
198			bt-reg-on-gpios = <&gpioj 12 GPIO_ACTIVE_HIGH>;
199			bt-host-wake-gpios = <&gpioj 13 GPIO_ACTIVE_HIGH>;
200			bt-dev-wake-gpios = <&gpioj 14 GPIO_ACTIVE_HIGH>;
201		};
202	};
203};
204