-
Notifications
You must be signed in to change notification settings - Fork 8.4k
boards: st: stm32h7s78_dk: add Ethernet support #99296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,5 @@ supported: | |
| - octospi | ||
| - usbd | ||
| - memc | ||
| - netif:eth | ||
| vendor: st | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,4 +17,5 @@ supported: | |
| - octospi | ||
| - usbd | ||
| - memc | ||
| - netif:eth | ||
| vendor: st | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,13 +54,15 @@ | |
| reg = <0x24000000 DT_SIZE_K(456)>; | ||
| compatible = "zephyr,memory-region", "mmio-sram"; | ||
| zephyr,memory-region = "SRAM0"; | ||
| #memory-region-cells = <0>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be removed. We don't expect one to reference
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| }; | ||
|
|
||
| /* System data RAM accessible over AHB bus: SRAM1 in D2 domain */ | ||
| sram1: memory@30000000 { | ||
| reg = <0x30000000 DT_SIZE_K(16)>; | ||
| compatible = "zephyr,memory-region", "mmio-sram"; | ||
| zephyr,memory-region = "SRAM1"; | ||
| #memory-region-cells = <0>; | ||
| zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM)>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the change made in #97731, won't
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes it will create 2 overlaying mpu regions for |
||
| }; | ||
|
|
||
|
|
@@ -69,6 +71,7 @@ | |
| compatible = "zephyr,memory-region", "mmio-sram"; | ||
| reg = <0x30004000 DT_SIZE_K(16)>; | ||
| zephyr,memory-region = "SRAM2"; | ||
| #memory-region-cells = <0>; | ||
| /* Disable SRAM2 by default to avoid unintended access. | ||
| * To enable it, explicitly define zephyr,memory-attr | ||
| * to configure MPU attributes. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,8 +30,10 @@ static const struct arm_mpu_region mpu_regions[] = { | |||||
| /* 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(DT_NODELABEL(mac)) && \ | ||||||
| DT_NODE_HAS_PROP(DT_NODELABEL(mac), memory_regions) | ||||||
| #define sram_eth_node DT_PHANDLE(DT_NODELABEL(mac), memory_regions) | ||||||
|
|
||||||
| #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), | ||||||
|
|
@@ -42,6 +44,12 @@ static const struct arm_mpu_region mpu_regions[] = { | |||||
| #endif | ||||||
| }; | ||||||
|
|
||||||
| #ifdef sram_eth_node | ||||||
| BUILD_ASSERT(!DT_SAME_NODE(sram_eth_node, DT_CHOSEN(zephyr_sram)), | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||
| "Remove property memory-regions from 'mac' node " | ||||||
| "to locate ethernet buffers in system RAM."); | ||||||
| #endif | ||||||
|
|
||||||
| const struct arm_mpu_config mpu_config = { | ||||||
| .num_regions = ARRAY_SIZE(mpu_regions), | ||||||
| .mpu_regions = mpu_regions, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright (c) 2025 Benjamin Klaric <benjamin.klaric01@gmail.com> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| &sram2 { | ||
| zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM)>; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &mac { | ||
| /* | ||
| * mac is disabled for this test since the ethernet driver that gets | ||
| * enabled by this node consumes the sram1 node thus failing this test | ||
| */ | ||
| status = "disabled"; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use
sram2to preserve to previous configuration?Otherwise, the commit message should tell that h7rs based device ethnet buffers are now in
sram1(AXI SRAM1) by default instead ofsram2(AXI SRAM2).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sram1 and sram2 are AHB, sram0 is AXI sram (called sram 1-4 in the datasheet/rm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sram2is disabled by default. That is why I opted to usesram1.I can switch to using
sram2but that requires the node to be enabled by default. Otherwise an introduction of a fallback is needed (tosram1).What should I do here?
I will update the commit message in any case. Thanks @TD-JBL for clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the sram2 is disabled to have users enable it on purpose:
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_RAM)>mpu_regions.cconfigure the mpu-region for it.I don't mind changing this behaviour, maybe have it already enabled... not sure whats be best way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that preserving behavior is that important for a dev board