stm32h7/otg: move sanity checks to common header file for use USBDEV and USBHOST

This commit is contained in:
raiden00pl 2023-05-09 11:53:17 +02:00 committed by Xiang Xiao
parent 62076fb7b9
commit eee25ea1eb
2 changed files with 19 additions and 16 deletions

View File

@ -29,11 +29,30 @@
#include <stdint.h>
#include <arch/board/board.h>
#include "chip.h"
#include "stm32_rcc.h"
#include "hardware/stm32_otg.h"
#if defined(CONFIG_STM32H7_OTGFS) || defined(CONFIG_STM32H7_OTGHS)
#if (STM32_RCC_D2CCIP2R_USBSRC == RCC_D2CCIP2R_USBSEL_HSI48) && \
!defined(CONFIG_STM32H7_HSI48)
# error board.h selected HSI48 as USB clock source, but HSI48 is not \
enabled. Enable STM32H7_HSI48
#endif
#if defined(CONFIG_STM32H7_OTGHS) && !defined(CONFIG_STM32H7_OTGHS_FS) && \
defined(CONFIG_STM32H7_OTGHS_NO_ULPI)
# error OTG HS selected but no ULPI enabled
#endif
#if defined(CONFIG_STM32H7_OTGHS_EXTERNAL_ULPI) && \
!defined(CONFIG_STM32H7_SYSCFG_IOCOMPENSATION)
# error External ULPI needs IOCOMPENSATION enabled
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

View File

@ -54,22 +54,6 @@
#if defined(CONFIG_USBDEV) && (defined(CONFIG_STM32H7_OTGFS) || \
defined(CONFIG_STM32H7_OTGHS))
#if (STM32_RCC_D2CCIP2R_USBSRC == RCC_D2CCIP2R_USBSEL_HSI48) && \
!defined(CONFIG_STM32H7_HSI48)
# error board.h selected HSI48 as USB clock source, but HSI48 is not \
enabled. Enable STM32H7_HSI48
#endif
#if defined(CONFIG_STM32H7_OTGHS) && !defined(CONFIG_STM32H7_OTGHS_FS) && \
defined(CONFIG_STM32H7_OTGHS_NO_ULPI)
# error OTG HS selected but no ULPI enabled
#endif
#if defined(CONFIG_STM32H7_OTGHS_EXTERNAL_ULPI) && \
!defined(CONFIG_STM32H7_SYSCFG_IOCOMPENSATION)
# error External ULPI needs IOCOMPENSATION enabled
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/