1# Copyright 2024 NXP
2# SPDX-License-Identifier: Apache-2.0
3
4DT_CHOSEN_Z_FLASH := zephyr,flash
5DT_COMPAT_XSPI := nxp,xspi
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_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_XSPI))
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_XSPI)
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
21config FLASH_MCUX_XSPI_XIP
22	bool
23	default $(DT_FLASH_PARENT_IS_XSPI)
24	select XIP
25	help
26	  Allows the soc to safely initialize the clocks for the
27	  XSpi when planning to execute code in XSpi Memory.
28
29if FLASH_MCUX_XSPI_XIP
30
31config CODE_DATA_RELOCATION_SRAM
32	default y
33
34config FLASH_MCUX_XSPI_XIP_MEM
35	string
36	prompt "Xspi drivers memory location"
37	default "RAM"
38	help
39	  Select the location to run the XSPI drivers when using
40	  the flash API.
41
42endif
43