From ee3faa408d493ea2d2c93da64db6c5a800e0efa4 Mon Sep 17 00:00:00 2001 From: adustm Date: Thu, 22 Dec 2016 17:23:55 +0100 Subject: [PATCH] fix for #3387 need to disable the data cache for Ethernet to use the DMA descriptors if they are located in SRAM1 and SRAM2 --- .../TARGET_STM32F7/TARGET_DISCO_F746NG/stm32f7_eth_init.c | 4 +++- .../TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c | 4 +++- .../TARGET_STM32F7/TARGET_F746_F756/stm32f7_eth_init.c | 2 ++ .../TARGET_STM32F7/TARGET_NUCLEO_F767ZI/stm32f7_eth_init.c | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/stm32f7_eth_init.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/stm32f7_eth_init.c index 1d9856f644..cecd67239a 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/stm32f7_eth_init.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/stm32f7_eth_init.c @@ -7,6 +7,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) { GPIO_InitTypeDef GPIO_InitStructure; if (heth->Instance == ETH) { + /* Disable DCache for STM32F7 family */ + SCB_DisableDCache(); /* Enable GPIOs clocks */ __HAL_RCC_GPIOA_CLK_ENABLE(); @@ -78,4 +80,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) /* Disable the Ethernet global Interrupt */ NVIC_DisableIRQ(ETH_IRQn); } -} \ No newline at end of file +} diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c index a3fd1b54f4..1d2f5ca184 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F769NI/stm32f7_eth_init.c @@ -7,6 +7,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) { GPIO_InitTypeDef GPIO_InitStructure; if (heth->Instance == ETH) { + /* Disable DCache for STM32F7 family */ + SCB_DisableDCache(); /* Enable GPIOs clocks */ __HAL_RCC_GPIOA_CLK_ENABLE(); @@ -84,4 +86,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) /* Disable the Ethernet global Interrupt */ NVIC_DisableIRQ(ETH_IRQn); } -} \ No newline at end of file +} diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/stm32f7_eth_init.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/stm32f7_eth_init.c index fc393c5711..2c93885c12 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/stm32f7_eth_init.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_F746_F756/stm32f7_eth_init.c @@ -7,6 +7,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) { GPIO_InitTypeDef GPIO_InitStructure; if (heth->Instance == ETH) { + /* Disable DCache for STM32F7 family */ + SCB_DisableDCache(); /* Enable GPIOs clocks */ __HAL_RCC_GPIOA_CLK_ENABLE(); diff --git a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/stm32f7_eth_init.c b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/stm32f7_eth_init.c index fc393c5711..758ae1cbb3 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/stm32f7_eth_init.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/stm32f7_eth_init.c @@ -7,6 +7,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* heth) { GPIO_InitTypeDef GPIO_InitStructure; if (heth->Instance == ETH) { + /* Disable DCache for STM32F7 family */ + SCB_DisableDCache(); /* Enable GPIOs clocks */ __HAL_RCC_GPIOA_CLK_ENABLE(); @@ -84,4 +86,4 @@ void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth) /* Disable the Ethernet global Interrupt */ NVIC_DisableIRQ(ETH_IRQn); } -} \ No newline at end of file +}