Skip to content

Commit d863343

Browse files
rahul-arasikerefabiobaltieri
authored andcommitted
boards: arduino: portenta_h7: Enable Ethernet and USB-HS Support.
Enable the mac node along with the necessary pinmuxing to enable the ethernet and usb hs peripheral. I additionally defined the `ethernet_phy_en` node the uses a fixed regulator to release the PHY reset. Additionally an usb_cdc_acm node was defined to enable serial over usb for the console. Signed-off-by: Rahul Arasikere <arasikere.rahul@gmail.com>
1 parent 68d0aae commit d863343

File tree

4 files changed

+117
-13
lines changed

4 files changed

+117
-13
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2024 Rahul Arasikere <arasikere.rahul@gmail.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_ARDUINO_PORTENTA_H7
5+
6+
if NETWORKING
7+
8+
config NET_L2_ETHERNET
9+
default y
10+
11+
endif # NETWORKING
12+
13+
if USB_DEVICE_STACK
14+
15+
config USB_DEVICE_PRODUCT
16+
default "Arduino SA Portenta H7"
17+
18+
config USB_DEVICE_PID
19+
default 0x035b
20+
21+
config USB_DEVICE_VID
22+
default 0x2341
23+
24+
config USB_DEVICE_INITIALIZE_AT_BOOT
25+
default y
26+
27+
if LOG
28+
29+
# Logger cannot use itself to log
30+
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
31+
default USB_CDC_ACM_LOG_LEVEL_OFF
32+
endchoice
33+
34+
# Set USB log level to error only
35+
choice USB_DEVICE_LOG_LEVEL_CHOICE
36+
default USB_DEVICE_LOG_LEVEL_ERR
37+
endchoice
38+
39+
endif # LOG
40+
41+
endif # USB_DEVICE_STACK
42+
43+
endif # BOARD_ARDUINO_PORTENTA_H7

boards/arduino/portenta_h7/arduino_portenta_h7-common.dtsi

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
};
2121
};
2222

23+
otghs_ulpi_phy: otghs_ulpis_phy {
24+
compatible = "usb-ulpi-phy";
25+
reset-gpios = < &gpioj 4 GPIO_ACTIVE_LOW >;
26+
#phy-cells = <0>;
27+
};
28+
2329
aliases {
2430
led0 = &red_led;
2531
led1 = &green_led;
@@ -115,12 +121,6 @@
115121
status = "okay";
116122
};
117123

118-
zephyr_udc0: &usbotg_fs {
119-
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
120-
pinctrl-names = "default";
121-
status = "disabled";
122-
};
123-
124124
&mailbox {
125125
status = "okay";
126126
};
@@ -171,11 +171,11 @@ zephyr_udc0: &usbotg_fs {
171171

172172
&quadspi {
173173
pinctrl-0 = < &quadspi_bk1_io0_pd11
174-
&quadspi_bk1_io1_pd12
175-
&quadspi_bk1_io2_pf7
176-
&quadspi_bk1_io3_pd13
177-
&quadspi_bk1_ncs_pg6
178-
&quadspi_clk_pf10 >;
174+
&quadspi_bk1_io1_pd12
175+
&quadspi_bk1_io2_pf7
176+
&quadspi_bk1_io3_pd13
177+
&quadspi_bk1_ncs_pg6
178+
&quadspi_clk_pf10 >;
179179
pinctrl-names = "default";
180180
status = "okay";
181181

@@ -208,3 +208,42 @@ zephyr_udc0: &usbotg_fs {
208208
};
209209
};
210210
};
211+
212+
&mac {
213+
pinctrl-0 = < &eth_ref_clk_pa1
214+
&eth_mdio_pa2
215+
&eth_crs_dv_pa7
216+
&eth_mdc_pc1
217+
&eth_rxd0_pc4
218+
&eth_rxd1_pc5
219+
&eth_tx_en_pg11
220+
&eth_txd1_pg12
221+
&eth_txd0_pg13 >;
222+
pinctrl-names = "default";
223+
};
224+
225+
zephyr_udc0: &usbotg_hs {
226+
pinctrl-0 = < &usb_otg_hs_ulpi_d0_pa3
227+
&usb_otg_hs_ulpi_ck_pa5
228+
&usb_otg_hs_ulpi_d1_pb0
229+
&usb_otg_hs_ulpi_d2_pb1
230+
&usb_otg_hs_ulpi_d7_pb5
231+
&usb_otg_hs_ulpi_d3_pb10
232+
&usb_otg_hs_ulpi_d4_pb11
233+
&usb_otg_hs_ulpi_d5_pb12
234+
&usb_otg_hs_ulpi_d6_pb13
235+
&usb_otg_hs_ulpi_stp_pc0
236+
&usb_otg_hs_ulpi_nxt_ph4
237+
&usb_otg_hs_ulpi_dir_pi11 >;
238+
pinctrl-names = "default";
239+
phys = < &otghs_ulpi_phy >;
240+
maximum-speed = "high-speed";
241+
/* Include the USB1ULPIEN | USB1OTGHSULPIEN clock enable bit */
242+
clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x6000000>,
243+
<&rcc STM32_SRC_HSI48 USB_SEL(3)>;
244+
num-bidir-endpoints = < 4 >;
245+
status = "okay";
246+
cdc_acm_uart0: cdc_acm_uart0 {
247+
compatible = "zephyr,cdc-acm-uart";
248+
};
249+
};

boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
/* HW resources are split between CM7 and CM4 */
1717
chosen {
18-
zephyr,console = &usart1;
19-
zephyr,shell-uart = &usart1;
18+
zephyr,console = &cdc_acm_uart0;
19+
zephyr,shell-uart = &cdc_acm_uart0;
20+
zephyr,cdc-acm-uart0 = &cdc_acm_uart0;
2021
zephyr,sram = &sram0;
2122
zephyr,flash = &flash0;
2223
zephyr,code-partition = &slot0_partition;
@@ -30,6 +31,14 @@
3031
status = "okay";
3132
};
3233

34+
ethernet_phy_en: ethernet_phy_en {
35+
compatible = "regulator-fixed";
36+
regulator-name = "ethernet-phy-reset-release";
37+
enable-gpios = <&gpioj 15 GPIO_ACTIVE_HIGH>;
38+
regulator-boot-on;
39+
status = "okay";
40+
};
41+
3342
sdram1: sdram@c0000000 {
3443
compatible = "zephyr,memory-region", "mmio-sram";
3544
device_type = "memory";
@@ -80,7 +89,16 @@
8089
status = "okay";
8190
};
8291

92+
/* Only one should be enabled */
8393
&usbotg_fs {
94+
status = "disabled";
95+
};
96+
97+
&usbotg_hs {
98+
status = "okay";
99+
};
100+
101+
&cdc_acm_uart0 {
84102
status = "okay";
85103
};
86104

boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ CONFIG_SERIAL=y
3030
# Enable console
3131
CONFIG_CONSOLE=y
3232
CONFIG_UART_CONSOLE=y
33+
CONFIG_UART_LINE_CTRL=y
3334

3435
# Enable regulator
3536
CONFIG_REGULATOR=y
3637
CONFIG_REGULATOR_FIXED=y
38+
39+
# Enable USB Stack
40+
CONFIG_USB_DEVICE_STACK=y

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy