# Copyright (c) 2025 STMicroelectronics
# SPDX-License-Identifier: Apache-2.0
#
# Kconfig options for STM32 family-wide code
#
# The following options are used to enable or configure
# code in `soc/st/stm32/common` which is shared between
# multiple STM32 series.
#

config STM32_BACKUP_SRAM
	bool "STM32 Backup SRAM"
	default y
	depends on DT_HAS_ST_STM32_BACKUP_SRAM_ENABLED
	help
	  Enable support for STM32 backup SRAM.

config STM32_BACKUP_SRAM_INIT_PRIORITY
	int "STM32 Backup SRAM init priority"
	default APPLICATION_INIT_PRIORITY
	depends on STM32_BACKUP_SRAM
	help
	  STM32 Backup SRAM device initialization priority.

config STM32_ENABLE_DEBUG_SLEEP_STOP
	bool "Allow debugger attach in stop/sleep Mode"
	default y if DEBUG
	help
	  Some STM32 parts disable the DBGMCU in sleep/stop modes because
	  of power consumption. As a side-effects this prevents
	  debuggers from attaching w/o resetting the target. This
	  effectively destroys the use-case of `west attach`. Also
	  SEGGER RTT and similar technologies need this.

config SWJ_ANALOG_PRIORITY
	int "SWJ DP port to analog routine initialization priority"
	default 49
	help
	  Initialization priority of the routine within the PRE_KERNEL1 level.
	  This priority must be greater than GPIO_INIT_PRIORITY and lower than
	  UART_INIT_PRIORITY.

config STM32_WKUP_PINS
	bool "STM32 PWR Wake-up Pins"
	depends on DT_HAS_ST_STM32_PWR_ENABLED
	help
	  Enable support for STM32 PWR wake-up pins.

config STM32_BACKUP_PROTECTION
	bool "SoC has backup domain protection access"
	help
	  Enabled for SoCs for which access protection to backup domain
	  resources needs to be explicitly handled.

config STM32_IOCELL
	bool "STM32 I/O cell"
	default y
	depends on DT_HAS_ST_STM32_IOCELL_ENABLED
	help
	  Enable support for STM32 I/O compensation cell and HSLV configuration

config STM32_IOCELL_PRIORITY
	int "STM32 I/O cell initialization priority"
	default 50
	help
	  Initialization priority of the routine within the EARLY level.

config STM32_IOCELL_CHECK_ENABLE
	bool "STM32 I/O cell check"
	default y
	depends on LOG
	depends on DT_HAS_ST_STM32_IOCELL_ENABLED
	help
	  Enables logging of I/O cell driver. This can be useful for reporting
	  discrepancy between device-tree configuration and value stored in
	  device OTP/option bytes

config STM32_XSPIM
	bool "STM32 XSPI Manager"
	select USE_STM32_HAL_XSPI
	default y if DT_HAS_ST_STM32_XSPIM_ENABLED
	help
	  Enables support for XSPI Manager.

if STM32_XSPIM

module = STM32_XSPIM
module-str = stm32_xpsim
source "subsys/logging/Kconfig.template.log_config"

endif # STM32_XSPIM
