1# Copyright 2024 NXP
2# SPDX-License-Identifier: Apache-2.0
3
4DT_CHOSEN_Z_FLASH := zephyr,flash
5DT_COMPAT_FLEXSPI := nxp,imx-flexspi
6
7DT_CHOSEN_FLASH_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH))
8DT_CHOSEN_FLASH_PARENT := $(dt_node_parent,$(DT_CHOSEN_FLASH_NODE))
9
10DT_FLASH_PARENT_IS_FLEXSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_FLEXSPI))
11DT_FLASH_HAS_SIZE_PROP := $(dt_node_has_prop,$(DT_CHOSEN_FLASH_NODE),size)
12
13config FLASH_BASE_ADDRESS
14	default $(dt_node_reg_addr_hex,$(DT_CHOSEN_FLASH_PARENT),1) \
15		if $(DT_FLASH_PARENT_IS_FLEXSPI)
16	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
17
18config FLASH_SIZE
19	default $(dt_node_int_prop_int,$(DT_CHOSEN_FLASH_NODE),size,Kb) \
20		if $(DT_FLASH_HAS_SIZE_PROP)
21	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K)
22
23config FLASH_MCUX_FLEXSPI_XIP
24	bool
25	default $(DT_FLASH_PARENT_IS_FLEXSPI)
26	select XIP
27	help
28	  Allows REfor the soc to safely initialize the clocks for the
29	  FlexSpi when planning to execute code in FlexSpi Memory.
30
31if FLASH_MCUX_FLEXSPI_XIP && MEMC_MCUX_FLEXSPI
32
33config CODE_DATA_RELOCATION_SRAM
34	default y if !CPU_CORTEX_M7
35
36config CODE_DATA_RELOCATION
37	default y if CPU_CORTEX_M7
38
39config FLASH_MCUX_FLEXSPI_XIP_MEM
40	string
41	prompt "Flexspi drivers memory location"
42	default "RAM"
43	help
44	  Select the location to run the FlexSPI drivers when using
45	  the flash API.
46
47endif
48