1# Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig SPI_NRFX
5	bool "nRF SPI nrfx drivers"
6	default y
7	depends on SOC_FAMILY_NORDIC_NRF
8	depends on MULTITHREADING
9	select PINCTRL
10	help
11	  Enable support for nrfx SPI drivers for nRF MCU series.
12
13if SPI_NRFX
14
15config SPI_NRFX_SPI
16	def_bool y
17	depends on DT_HAS_NORDIC_NRF_SPI_ENABLED
18	select NRFX_SPI0 if HAS_HW_NRF_SPI0
19	select NRFX_SPI1 if HAS_HW_NRF_SPI1
20	select NRFX_SPI2 if HAS_HW_NRF_SPI2
21
22config SPI_NRFX_SPIM
23	def_bool y
24	depends on DT_HAS_NORDIC_NRF_SPIM_ENABLED
25	select NRFX_SPIM0 if HAS_HW_NRF_SPIM0
26	select NRFX_SPIM1 if HAS_HW_NRF_SPIM1
27	select NRFX_SPIM2 if HAS_HW_NRF_SPIM2
28	select NRFX_SPIM3 if HAS_HW_NRF_SPIM3
29	select NRFX_SPIM4 if HAS_HW_NRF_SPIM4
30	select NRFX_SPIM00 if HAS_HW_NRF_SPIM00
31	select NRFX_SPIM20 if HAS_HW_NRF_SPIM20
32	select NRFX_SPIM21 if HAS_HW_NRF_SPIM21
33	select NRFX_SPIM22 if HAS_HW_NRF_SPIM22
34	select NRFX_SPIM30 if HAS_HW_NRF_SPIM30
35	select NRFX_SPIM120 if HAS_HW_NRF_SPIM120
36	select NRFX_SPIM121 if HAS_HW_NRF_SPIM121
37	select NRFX_SPIM130 if HAS_HW_NRF_SPIM130
38	select NRFX_SPIM131 if HAS_HW_NRF_SPIM131
39	select NRFX_SPIM132 if HAS_HW_NRF_SPIM132
40	select NRFX_SPIM133 if HAS_HW_NRF_SPIM133
41	select NRFX_SPIM134 if HAS_HW_NRF_SPIM134
42	select NRFX_SPIM135 if HAS_HW_NRF_SPIM135
43	select NRFX_SPIM136 if HAS_HW_NRF_SPIM136
44	select NRFX_SPIM137 if HAS_HW_NRF_SPIM137
45
46config SPI_NRFX_SPIS
47	def_bool y
48	depends on DT_HAS_NORDIC_NRF_SPIS_ENABLED
49	select SPI_SLAVE
50	select NRFX_SPIS0 if HAS_HW_NRF_SPIS0
51	select NRFX_SPIS1 if HAS_HW_NRF_SPIS1
52	select NRFX_SPIS2 if HAS_HW_NRF_SPIS2
53	select NRFX_SPIS3 if HAS_HW_NRF_SPIS3
54	select NRFX_SPIS00 if HAS_HW_NRF_SPIS00
55	select NRFX_SPIS20 if HAS_HW_NRF_SPIS20
56	select NRFX_SPIS21 if HAS_HW_NRF_SPIS21
57	select NRFX_SPIS22 if HAS_HW_NRF_SPIS22
58	select NRFX_SPIS30 if HAS_HW_NRF_SPIS30
59	select NRFX_SPIS120 if HAS_HW_NRF_SPIS120
60	select NRFX_SPIS130 if HAS_HW_NRF_SPIS130
61	select NRFX_SPIS131 if HAS_HW_NRF_SPIS131
62	select NRFX_SPIS132 if HAS_HW_NRF_SPIS132
63	select NRFX_SPIS133 if HAS_HW_NRF_SPIS133
64	select NRFX_SPIS134 if HAS_HW_NRF_SPIS134
65	select NRFX_SPIS135 if HAS_HW_NRF_SPIS135
66	select NRFX_SPIS136 if HAS_HW_NRF_SPIS136
67	select NRFX_SPIS137 if HAS_HW_NRF_SPIS137
68
69config SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58
70	depends on SOC_NRF52832
71	select NRFX_PPI
72	bool "Allow enabling the SPIM driver despite PAN 58"
73	help
74	  Allow enabling the nRF SPI Master with EasyDMA, despite
75	  Product Anomaly Notice 58 (SPIM: An additional byte is
76	  clocked out when RXD.MAXCNT == 1 and TXD.MAXCNT <= 1).
77	  Without this override, the SPI Master is only available
78	  without EasyDMA. Note that the 'SPIM' and 'SPIS' drivers
79	  use EasyDMA, while the 'SPI' driver does not.
80	  When used in conjunction with nRF SPIM Devicetree property
81	  'anomaly-58-workaround' a workaround can be enabled per SPIM
82	  instance.  If you are certain that transactions with
83	  RXD.MAXCNT == 1 and TXD.MAXCNT <= 1 will NOT be executed
84	  then nRF52832 PPI and GPIOTE resources can be saved by not
85	  enabling 'anomaly-58-workaround' via the Devicetree.
86
87config SPI_NRFX_RAM_BUFFER_SIZE
88	int "Size of RAM buffers for SPIM peripherals"
89	default 8
90	depends on SPI_NRFX_SPIM
91	help
92	  Because of using EasyDMA, SPIM peripherals cannot use transmit and
93	  receive buffers from all memory locations. They are restricted to
94	  buffers located in certain RAM memories only. Therefore, each SPIM
95	  driver instance needs to use an intermediate local RAM buffer,
96	  to transfer data in chunks not exceeding the size of that buffer,
97	  and to copy those chunks between the local buffer and the one
98	  specified in the transfer request if the latter is not accessible
99	  by EasyDMA.
100
101	  This option specifies the size in bytes of such local RAM buffers
102	  for both TX and RX paths. A size of 0 means that this feature should
103	  be disabled and the driver user must take care of not making transfer
104	  requests with buffers not accessible by EasyDMA since such transfers
105	  will fail.
106
107config SPI_NRFX_WAKE_TIMEOUT_US
108	int "Maximum time to wait for SPI slave to wake up"
109	default 200
110	help
111	  Maximum amount of time (in microseconds) that SPI master should wait
112	  for SPI slave to wake up after the WAKE line is asserted. Used only
113	  by instances that have the WAKE line configured (see the wake-gpios
114	  devicetree property).
115
116endif # SPI_NRFX
117