1# SPDX-License-Identifier: Apache-2.0
2
3config FLASH_NRF_FORCE_ALT
4	bool
5	depends on SOC_COMPATIBLE_NRF
6	help
7	  This option can be enabled to force an alternative implementation
8	  of the flash driver.
9
10menuconfig SOC_FLASH_NRF
11	bool "Nordic Semiconductor nRF flash driver"
12	default y
13	depends on DT_HAS_NORDIC_NRF51_FLASH_CONTROLLER_ENABLED || \
14		   DT_HAS_NORDIC_NRF52_FLASH_CONTROLLER_ENABLED || \
15		   DT_HAS_NORDIC_NRF53_FLASH_CONTROLLER_ENABLED || \
16		   DT_HAS_NORDIC_NRF91_FLASH_CONTROLLER_ENABLED
17	depends on !FLASH_NRF_FORCE_ALT
18	select FLASH_HAS_PAGE_LAYOUT
19	select FLASH_HAS_DRIVER_ENABLED
20	select FLASH_HAS_EXPLICIT_ERASE
21	select NRFX_NVMC
22	select MPU_ALLOW_FLASH_WRITE if ARM_MPU
23	help
24	  Enables Nordic Semiconductor nRF flash driver.
25
26if SOC_FLASH_NRF
27
28choice SOC_FLASH_NRF_RADIO_SYNC_CHOICE
29	prompt "Nordic nRFx flash driver synchronization"
30	default SOC_FLASH_NRF_RADIO_SYNC_TICKER if BT_LL_SW_SPLIT
31	default SOC_FLASH_NRF_RADIO_SYNC_NONE
32	help
33	  synchronization between flash memory driver and radio.
34
35config SOC_FLASH_NRF_RADIO_SYNC_TICKER
36	bool "Nordic nRFx flash driver synchronized with radio"
37	depends on BT_LL_SW_SPLIT
38	help
39	  Enable synchronization between flash memory driver and radio using
40	  BLE LL controller ticker API.
41
42config SOC_FLASH_NRF_RADIO_SYNC_NONE
43	bool "none"
44	help
45	  disable synchronization between flash memory driver and radio.
46endchoice
47
48config SOC_FLASH_NRF_PARTIAL_ERASE
49	bool "Nordic nRFx flash driver partial erase"
50	depends on HAS_HW_NRF_NVMC_PE
51	help
52	  Enable partial erase feature. Partial erase is performed in time
53	  slices instead of blocking MCU, for the time it is needed to
54	  complete operation over given area.
55	  This allows interrupting flash erase between operations
56	  to perform other task by MCU.
57	  This feature may also be used for better syncing flash erase
58	  operations, when compiled with SOC_FLASH_NRF_RADIO_SYNC_TICKER,
59	  with Bluetooth.
60
61config SOC_FLASH_NRF_PARTIAL_ERASE_MS
62	int "Partial erase timeout in MS"
63	depends on SOC_FLASH_NRF_PARTIAL_ERASE
64	default 3
65	help
66	  This is maximum time, in ms, that NVMC will use to erase part
67	  of Flash, before stopping to let CPU resume operation.
68	  Minimal timeout is 2ms maximum should not exceed half of
69	  FLASH_PAGE_ERASE_MAX_TIME_US im ms.
70
71config SOC_FLASH_NRF_TIMEOUT_MULTIPLIER
72	int "Multiplier for flash operation timeouts [x0.1]"
73	depends on !SOC_FLASH_NRF_RADIO_SYNC_NONE
74	default 15 if SOC_FLASH_NRF_PARTIAL_ERASE && SOC_FLASH_NRF_RADIO_SYNC_TICKER
75	default 10
76	help
77	  This is a multiplier that will be divided by 10 that is applied
78	  to the flash erase and write operations timeout. The base for
79	  the multiplication would allow erasing all nRF flash pages in
80	  blocking mode.
81
82config SOC_FLASH_NRF_UICR
83	bool "Access to UICR"
84	depends on !TRUSTED_EXECUTION_NONSECURE
85	help
86	  Enable operations on UICR. Once enabled UICR are written or read as
87	  ordinary flash memory. Erase is possible for whole UICR at once.
88
89config SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS
90	bool "8-bit write block size emulation"
91	help
92	  When this option is enabled writing chunks less than minimal write
93	  block size parameter (imposed by manufacturer) is possible but operation
94	  is more complex and requires basic user knowledge about NVMC controller.
95
96endif # SOC_FLASH_NRF
97