drivers: ethernet: stm32: Put DMA buffer to DTCM section

For STM32F7 MCU the actual implementation doesn't work when the
DMA buffers are placed in the SRAM.
This might be a problem with caches.
To overcome this problem, the buffer is moved to the DTCM.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
Alexander Wachter 2019-06-27 14:50:51 +02:00 committed by Carles Cufí
commit 0fbaaa1350
2 changed files with 21 additions and 0 deletions

View file

@ -37,6 +37,14 @@ config ETH_STM32_HAL_RX_THREAD_PRIO
help
RX thread priority
config ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER
bool "Use DTCM for DMA buffers"
default y
depends on SOC_SERIES_STM32F7X
help
When this option is activated, the buffers for DMA transfer are
moved from SRAM to the DTCM (Data Tightly Coupled Memory).
config ETH_STM32_HAL_PHY_ADDRESS
int "Phy address"
default 0

View file

@ -26,10 +26,23 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include "eth_stm32_hal_priv.h"
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
!defined(DT_DTCM_BASE_ADDRESS)
#error DTCM for DMA buffer is activated but DT_DTCM_BASE_ADDRESS is not present
#endif
#if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \
defined(DT_DTCM_BASE_ADDRESS)
static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __dtcm_noinit_section;
static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __dtcm_noinit_section;
static u8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __dtcm_noinit_section;
static u8_t dma_tx_buffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __dtcm_noinit_section;
#else
static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __aligned(4);
static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __aligned(4);
static u8_t dma_rx_buffer[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __aligned(4);
static u8_t dma_tx_buffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __aligned(4);
#endif /* CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER */
static inline void disable_mcast_filter(ETH_HandleTypeDef *heth)
{