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