From fe4540fb341cf330b37a81e3ad63b74dea44117e Mon Sep 17 00:00:00 2001 From: Thomas Decker Date: Wed, 17 Sep 2025 09:21:04 +0200 Subject: [PATCH 1/5] dts: arm: st: h7rs: Add ethernet node to dts Add ethernet node with mac and mdio subnodes to dts similar to h7-family. Signed-off-by: Thomas Decker --- dts/arm/st/h7rs/stm32h7rs.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dts/arm/st/h7rs/stm32h7rs.dtsi b/dts/arm/st/h7rs/stm32h7rs.dtsi index 24d5a7925aace..a415251783ecc 100644 --- a/dts/arm/st/h7rs/stm32h7rs.dtsi +++ b/dts/arm/st/h7rs/stm32h7rs.dtsi @@ -847,6 +847,29 @@ status = "disabled"; }; + ethernet@40028000 { + reg = <0x40028000 0x8000>; + compatible = "st,stm32-ethernet-controller"; + clock-names = "stm-eth"; + clocks = <&rcc STM32_CLOCK(AHB1, 15)>; + + mac: ethernet { + compatible = "st,stm32h7-ethernet", "st,stm32-ethernet"; + interrupts = <92 0>; + clock-names = "mac-clk-tx", "mac-clk-rx"; + clocks = <&rcc STM32_CLOCK(AHB1, 16)>, + <&rcc STM32_CLOCK(AHB1, 17)>; + status = "disabled"; + }; + + mdio: mdio { + compatible = "st,stm32-mdio"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + }; + usbotg_fs: usb@40080000 { compatible = "st,stm32-otgfs"; reg = <0x40080000 0x40000>; From dbf4335bed91158c633ce87ca3f8d6f18e292414 Mon Sep 17 00:00:00 2001 From: Thomas Decker Date: Mon, 8 Sep 2025 15:57:39 +0200 Subject: [PATCH 2/5] drivers: ethernet: stm32: Add support for SOC H7RS-Family Add SOC_SERIES_STM32H7RSX to applicable Kconfig parameters and enable use of .eth_stm32_desc and .eth_stm32_buf linker sections for ethernet dma. Signed-off-by: Thomas Decker --- drivers/ethernet/Kconfig.stm32_hal | 12 ++++++++++-- drivers/ethernet/eth_stm32_hal_priv.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/ethernet/Kconfig.stm32_hal b/drivers/ethernet/Kconfig.stm32_hal index 3fd26ab4adde0..5c7d260a84c24 100644 --- a/drivers/ethernet/Kconfig.stm32_hal +++ b/drivers/ethernet/Kconfig.stm32_hal @@ -26,7 +26,12 @@ choice ETH_STM32_HAL_API_VERSION config ETH_STM32_HAL_API_V2 bool "Use official STM32Cube HAL driver" - depends on SOC_SERIES_STM32H7X || SOC_SERIES_STM32H5X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32N6X + depends on SOC_SERIES_STM32F4X \ + || SOC_SERIES_STM32F7X \ + || SOC_SERIES_STM32H5X \ + || SOC_SERIES_STM32H7X \ + || SOC_SERIES_STM32H7RSX \ + || SOC_SERIES_STM32N6X select USE_STM32_HAL_ETH_EX if SOC_SERIES_STM32N6X help Use the official STM32Cube HAL driver instead of the legacy one. @@ -86,7 +91,10 @@ menuconfig PTP_CLOCK_STM32_HAL default y depends on PTP_CLOCK || NET_L2_PTP depends on ETH_STM32_HAL_API_V2 - depends on SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X || SOC_SERIES_STM32H5X + depends on SOC_SERIES_STM32F7X \ + || SOC_SERIES_STM32H5X \ + || SOC_SERIES_STM32H7X \ + || SOC_SERIES_STM32H7RSX help Enable STM32 PTP clock support. diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 3ee7f16d71519..80c52fc04db5b 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -33,7 +33,7 @@ extern const struct device *eth_stm32_phy_dev; DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define __eth_stm32_desc __dtcm_noinit_section #define __eth_stm32_buf __dtcm_noinit_section -#elif defined(CONFIG_SOC_SERIES_STM32H7X) +#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H7RSX) #define __eth_stm32_desc __attribute__((section(".eth_stm32_desc"))) #define __eth_stm32_buf __attribute__((section(".eth_stm32_buf"))) #elif defined(CONFIG_NOCACHE_MEMORY) From 2904f6dfcde2532dec1c82067d717e6c5fc5d171 Mon Sep 17 00:00:00 2001 From: Thomas Decker Date: Mon, 8 Sep 2025 15:54:33 +0200 Subject: [PATCH 3/5] soc: st: stm32: h7rs: Add memory region to MPU region list Add ethernet DMA buffer/descriptor region (sram2) and read only flash region 0x08FFF800 with unique device ID registers to MPU region list. The unique device ID is used to create a random mac address by the ethernet driver. Ethernet DMA buffer/descriptor memory section is also added to linker script. Signed-off-by: Thomas Decker --- soc/st/stm32/stm32h7rsx/CMakeLists.txt | 1 + soc/st/stm32/stm32h7rsx/mpu_regions.c | 14 ++++++++++++++ soc/st/stm32/stm32h7rsx/sections.ld | 20 ++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 soc/st/stm32/stm32h7rsx/sections.ld diff --git a/soc/st/stm32/stm32h7rsx/CMakeLists.txt b/soc/st/stm32/stm32h7rsx/CMakeLists.txt index 724ce9fb094fd..031c132ef9f48 100644 --- a/soc/st/stm32/stm32h7rsx/CMakeLists.txt +++ b/soc/st/stm32/stm32h7rsx/CMakeLists.txt @@ -6,6 +6,7 @@ zephyr_sources( ) zephyr_sources(mpu_regions.c) +zephyr_linker_sources(SECTIONS sections.ld) zephyr_include_directories(.) diff --git a/soc/st/stm32/stm32h7rsx/mpu_regions.c b/soc/st/stm32/stm32h7rsx/mpu_regions.c index 0e3339917536e..72995b85216e6 100644 --- a/soc/st/stm32/stm32h7rsx/mpu_regions.c +++ b/soc/st/stm32/stm32h7rsx/mpu_regions.c @@ -26,6 +26,20 @@ static const struct arm_mpu_region mpu_regions[] = { /* Region 3 */ MPU_REGION_ENTRY("SRAM_0", CONFIG_SRAM_BASE_ADDRESS, REGION_RAM_ATTR(REGION_SRAM_SIZE)), + + /* Region 4 - Ready only flash with unique device id */ + MPU_REGION_ENTRY("ID", 0x08FFF800, REGION_FLASH_ATTR(REGION_2K)), + +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac)) +#define sram_eth_node DT_NODELABEL(sram2) +#if DT_NODE_HAS_STATUS_OKAY(sram_eth_node) + /* Region 5 - Ethernet DMA buffer RAM */ + MPU_REGION_ENTRY("SRAM_ETH_BUF", DT_REG_ADDR(sram_eth_node), + REGION_RAM_NOCACHE_ATTR(REGION_16K)), + /* Region 6 - Ethernet DMA descriptor RAM (overlays the first 256B of SRAM_ETH_BUF)*/ + MPU_REGION_ENTRY("SRAM_ETH_DESC", DT_REG_ADDR(sram_eth_node), REGION_PPB_ATTR(REGION_256B)), +#endif +#endif }; const struct arm_mpu_config mpu_config = { diff --git a/soc/st/stm32/stm32h7rsx/sections.ld b/soc/st/stm32/stm32h7rsx/sections.ld new file mode 100644 index 0000000000000..7f1209682dcca --- /dev/null +++ b/soc/st/stm32/stm32h7rsx/sections.ld @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2020 Mario Jaun + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac)) +#define sram_eth_node DT_NODELABEL(sram2) +#if DT_NODE_HAS_STATUS_OKAY(sram_eth_node) +SECTION_DATA_PROLOGUE(eth_stm32,(NOLOAD),) +{ + . = ABSOLUTE(DT_REG_ADDR(sram_eth_node)); + *(.eth_stm32_desc) + . = ABSOLUTE(DT_REG_ADDR(sram_eth_node)) + 256; + *(.eth_stm32_buf) + . = ABSOLUTE(DT_REG_ADDR(sram_eth_node)) + 16K; +} GROUP_DATA_LINK_IN(LINKER_DT_NODE_REGION_NAME(sram_eth_node), LINKER_DT_NODE_REGION_NAME(sram_eth_node)) +#endif /* DT_NODE_HAS_STATUS_OKAY(sram_eth_node) */ + +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac)) */ From 1f24245ea99155702717da82857d0db6847987aa Mon Sep 17 00:00:00 2001 From: Thomas Decker Date: Fri, 5 Sep 2025 14:00:35 +0200 Subject: [PATCH 4/5] boards: st: nucleo_h7s3l8: Add ethernet Enable support for ethernet on nucleo_h7s3l8 board. Signed-off-by: Thomas Decker --- boards/st/nucleo_h7s3l8/doc/index.rst | 1 + boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts | 25 ++++++++++++++++++++++ boards/st/nucleo_h7s3l8/nucleo_h7s3l8.yaml | 1 + 3 files changed, 27 insertions(+) diff --git a/boards/st/nucleo_h7s3l8/doc/index.rst b/boards/st/nucleo_h7s3l8/doc/index.rst index 27a777e34d78a..16dcd1e8d8036 100644 --- a/boards/st/nucleo_h7s3l8/doc/index.rst +++ b/boards/st/nucleo_h7s3l8/doc/index.rst @@ -162,6 +162,7 @@ and a ST morpho connector. Board is configured as follows: - I2C : PB8, PB9 - SPI1 NSS/SCK/MISO/MOSI : PD14PA5/PA6/PB5 (Arduino SPI) - FDCAN1 RX/TX : PD0, PD1 +- ETH : A2, A7, B6, G4, G5, G6, G11, G12, G13 System Clock ------------ diff --git a/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts b/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts index 9e2324fbe9540..a7b3bb2ade792 100644 --- a/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts +++ b/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts @@ -175,6 +175,31 @@ status = "okay"; }; +&mac { + pinctrl-0 = <ð_rmii_rxd0_pg4 + ð_rmii_rxd1_pg5 + ð_rmii_ref_clk_pb6 + ð_rmii_crs_dv_pa7 + ð_rmii_tx_en_pg11 + ð_rmii_txd0_pg13 + ð_rmii_txd1_pg12>; + pinctrl-names = "default"; + phy-connection-type = "rmii"; + phy-handle = <ð_phy>; + status = "okay"; +}; + +&mdio { + pinctrl-0 = <ð_mdio_pa2 ð_mdc_pg6>; + pinctrl-names = "default"; + status = "okay"; + + eth_phy: ethernet-phy@0 { + compatible = "ethernet-phy"; + reg = <0x00>; + }; +}; + &flash0 { partitions { compatible = "fixed-partitions"; diff --git a/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.yaml b/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.yaml index 5b7624bc06f9c..7b20c79ebf399 100644 --- a/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.yaml +++ b/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.yaml @@ -15,4 +15,5 @@ supported: - octospi - can - canfd + - netif:eth vendor: st From ec482c16781ddfd84421208a72fde82e968ac7a9 Mon Sep 17 00:00:00 2001 From: Thomas Decker Date: Tue, 14 Oct 2025 15:43:38 +0200 Subject: [PATCH 5/5] boards: st: nucleo_h7s3l8: Fix format in doc/index.rst Fix wrong heading type in index.rst introduced with PR #95388 Signed-off-by: Thomas Decker --- boards/st/nucleo_h7s3l8/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/st/nucleo_h7s3l8/doc/index.rst b/boards/st/nucleo_h7s3l8/doc/index.rst index 16dcd1e8d8036..84562d6c77b5e 100644 --- a/boards/st/nucleo_h7s3l8/doc/index.rst +++ b/boards/st/nucleo_h7s3l8/doc/index.rst @@ -184,7 +184,7 @@ In order to test backup SRAM you may want to disconnect VBAT from VDD. You can do it by removing ``SB13`` jumper on the back side of the board. FDCAN -===== +----- The Nucleo H7S3L8 board does not have any onboard CAN transceiver. In order to use the FDCAN bus on this board, an external CAN bus transceiver must be