forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: ethernet: stm32: SRAM3 / MPU configuration
Fixes zephyrproject-rtos#29915. Implements the memory layout and MPU configuration for Ethernet buffers for STM32H7 controllers as recommended by ST. 16 KB of SRAM3 are are reserved for this. The first 256 B are for the RX/TX descriptors and configured as strongly ordered, shareable memory. The rest is for RX/TX buffers and configured as non cacheable memory. This configuration is automatically applied for H7 chips if the SRAM3 memory is enabled in the device tree. Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
- Loading branch information
Showing
5 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2020 Mario Jaun | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <devicetree.h> | ||
#include "../../common/cortex_m/arm_mpu_mem_cfg.h" | ||
|
||
static const struct arm_mpu_region mpu_regions[] = { | ||
MPU_REGION_ENTRY("FLASH", CONFIG_FLASH_BASE_ADDRESS, | ||
REGION_FLASH_ATTR(REGION_FLASH_SIZE)), | ||
MPU_REGION_ENTRY("SRAM", CONFIG_SRAM_BASE_ADDRESS, | ||
REGION_RAM_ATTR(REGION_SRAM_SIZE)), | ||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) && \ | ||
DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) | ||
MPU_REGION_ENTRY("SRAM3_ETH_BUF", | ||
DT_REG_ADDR(DT_NODELABEL(sram3)), | ||
REGION_RAM_NOCACHE_ATTR(REGION_16K)), | ||
MPU_REGION_ENTRY("SRAM3_ETH_DESC", | ||
DT_REG_ADDR(DT_NODELABEL(sram3)), | ||
REGION_PPB_ATTR(REGION_256B)), | ||
#endif | ||
}; | ||
|
||
const struct arm_mpu_config mpu_config = { | ||
.num_regions = ARRAY_SIZE(mpu_regions), | ||
.mpu_regions = mpu_regions, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2020 Mario Jaun | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) && DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) | ||
|
||
SECTION_DATA_PROLOGUE(eth_stm32,(NOLOAD),) | ||
{ | ||
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))); | ||
*(.eth_stm32_desc) | ||
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 256; | ||
*(.eth_stm32_buf) | ||
. = ABSOLUTE(DT_REG_ADDR(DT_NODELABEL(sram3))) + 16K; | ||
} GROUP_DATA_LINK_IN(SRAM3, SRAM3) | ||
|
||
#endif |