drivers: nrfx: Add Kconfig checks for mutually exclusive peripherals
In Nordic SoCs, SPI and TWI peripherals with the same instance number share certain resources and therefore cannot be used at the same time (in nRF91 Series this limitation concerns UART peripherals as well). This patch adds Kconfig checks ensuring that only one of such mutually exclusive peripherals can be enabled. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
cc185bc02b
commit
257c28a200
3 changed files with 62 additions and 32 deletions
|
@ -17,11 +17,13 @@ menuconfig I2C_NRFX
|
|||
|
||||
if I2C_NRFX
|
||||
|
||||
# In most Nordic SoCs the SPI and TWI peripherals with the same instance
|
||||
# number share certain resources and cannot be used at the same time.
|
||||
# In nRF52810 there are only single instances of these peripherals and
|
||||
# they are arranged in a different way so this limitation does not apply.
|
||||
if I2C_0 && (!SPI_0 || SOC_NRF52810)
|
||||
# In most Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
# In nRF52810 though, there are only single instances of these peripherals
|
||||
# and they are arranged in a different way, so this limitation does not apply.
|
||||
if I2C_0 && (SOC_NRF52810 || \
|
||||
(!SPI_0 && !(SOC_SERIES_NRF91X && UART_0_NRF_UARTE)))
|
||||
|
||||
choice I2C_0_NRF_TYPE
|
||||
prompt "I2C Port 0 Driver type"
|
||||
|
@ -44,10 +46,12 @@ config I2C_0_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
endif # I2C_0 && (!SPI_0 || SOC_NRF52810)
|
||||
endif # I2C_0 && (SOC_NRF52810 || ...
|
||||
|
||||
# Nordic TWIx1 and SPIx1 instances can not be used at the same time.
|
||||
if I2C_1 && !SPI_1
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
if I2C_1 && !SPI_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)
|
||||
|
||||
choice I2C_1_NRF_TYPE
|
||||
prompt "I2C Port 1 Driver type"
|
||||
|
@ -70,10 +74,12 @@ config I2C_1_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
endif # I2C_1 && !SPI_1
|
||||
endif # I2C_1 && !SPI_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)
|
||||
|
||||
# Nordic TWIx2 and SPIx2 instances can not be used at the same time.
|
||||
if I2C_2 && !SPI_2
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
if I2C_2 && !SPI_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)
|
||||
|
||||
choice I2C_2_NRF_TYPE
|
||||
prompt "I2C Port 2 Driver type"
|
||||
|
@ -89,10 +95,12 @@ config I2C_2_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
endif # I2C_2 && !SPI_2
|
||||
endif # I2C_2 && !SPI_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)
|
||||
|
||||
# Nordic TWIx3 and SPIx3 instances can not be used at the same time.
|
||||
if I2C_3 && !SPI_3
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series SoCs this limitation concerns UART peripherals as well).
|
||||
if I2C_3 && !SPI_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)
|
||||
|
||||
choice I2C_3_NRF_TYPE
|
||||
prompt "I2C Port 3 Driver type"
|
||||
|
@ -108,6 +116,6 @@ config I2C_3_NRF_TWIM
|
|||
|
||||
endchoice
|
||||
|
||||
endif # I2C_3 && !SPI_3
|
||||
endif # I2C_3 && !SPI_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)
|
||||
|
||||
endif #I2C_NRFX
|
||||
|
|
|
@ -33,7 +33,10 @@ config UART_0_NRF_UART
|
|||
|
||||
config UART_0_NRF_UARTE
|
||||
bool "nRF UARTE 0"
|
||||
depends on HAS_HW_NRF_UARTE0
|
||||
# In nRF91 Series SoCs, UART peripherals share certain resources with
|
||||
# SPI and TWI peripherals having the same instance number, and therefore
|
||||
# these cannot be used simultaneously.
|
||||
depends on HAS_HW_NRF_UARTE0 && !(SOC_SERIES_NRF91X && (SPI_0 || I2C_0))
|
||||
select NRF_UARTE_PERIPHERAL
|
||||
help
|
||||
Enable nRF UART with EasyDMA on port 0.
|
||||
|
@ -74,7 +77,10 @@ endif # UART_0_NRF_UART || UART_0_NRF_UARTE
|
|||
# ----------------- port 1 -----------------
|
||||
config UART_1_NRF_UARTE
|
||||
bool "nRF UARTE 1"
|
||||
depends on HAS_HW_NRF_UARTE1
|
||||
# In nRF91 Series SoCs, UART peripherals share certain resources with
|
||||
# SPI and TWI peripherals having the same instance number, and therefore
|
||||
# these cannot be used simultaneously.
|
||||
depends on HAS_HW_NRF_UARTE1 && !(SOC_SERIES_NRF91X && (SPI_1 || I2C_1))
|
||||
select NRF_UARTE_PERIPHERAL
|
||||
help
|
||||
Enable nRF UART with EasyDMA on port 1.
|
||||
|
@ -113,7 +119,10 @@ endif # UART_1_NRF_UARTE
|
|||
# ----------------- port 2 -----------------
|
||||
config UART_2_NRF_UARTE
|
||||
bool "nRF UARTE 2"
|
||||
depends on HAS_HW_NRF_UARTE2
|
||||
# In nRF91 Series SoCs, UART peripherals share certain resources with
|
||||
# SPI and TWI peripherals having the same instance number, and therefore
|
||||
# these cannot be used simultaneously.
|
||||
depends on HAS_HW_NRF_UARTE2 && !(SOC_SERIES_NRF91X && (SPI_2 || I2C_2))
|
||||
select NRF_UARTE_PERIPHERAL
|
||||
help
|
||||
Enable nRF UART with EasyDMA on port 2.
|
||||
|
@ -152,7 +161,10 @@ endif # UART_2_NRF_UARTE
|
|||
# ----------------- port 3 -----------------
|
||||
config UART_3_NRF_UARTE
|
||||
bool "nRF UARTE 3"
|
||||
depends on HAS_HW_NRF_UARTE3
|
||||
# In nRF91 Series SoCs, UART peripherals share certain resources with
|
||||
# SPI and TWI peripherals having the same instance number, and therefore
|
||||
# these cannot be used simultaneously.
|
||||
depends on HAS_HW_NRF_UARTE3 && !(SOC_SERIES_NRF91X && (SPI_3 || I2C_3))
|
||||
select NRF_UARTE_PERIPHERAL
|
||||
help
|
||||
Enable nRF UART with EasyDMA on port 3.
|
||||
|
|
|
@ -14,11 +14,13 @@ menuconfig SPI_NRFX
|
|||
|
||||
if SPI_NRFX
|
||||
|
||||
# In most Nordic SoCs the SPI and TWI peripherals with the same instance
|
||||
# number share certain resources and cannot be used at the same time.
|
||||
# In nRF52810 there are only single instances of these peripherals and
|
||||
# they are arranged in a different way so this limitation does not apply.
|
||||
if SPI_0 && (!I2C_0 || SOC_NRF52810)
|
||||
# In most Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
# In nRF52810 though, there are only single instances of these peripherals
|
||||
# and they are arranged in a different way, so this limitation does not apply.
|
||||
if SPI_0 && (SOC_NRF52810 || \
|
||||
(!I2C_0 && !(SOC_SERIES_NRF91X && UART_0_NRF_UARTE)))
|
||||
|
||||
choice
|
||||
prompt "SPI Port 0 Driver type"
|
||||
|
@ -63,10 +65,12 @@ config SPI_0_NRF_ORC
|
|||
|
||||
endif # SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS
|
||||
|
||||
endif # SPI_0 && (!I2C_0 || SOC_NRF52810)
|
||||
endif # SPI_0 && (SOC_NRF52810 || ...
|
||||
|
||||
# Nordic TWIx1 and SPIx1 instances can not be used at the same time.
|
||||
if SPI_1 && !I2C_1
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
if SPI_1 && !I2C_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)
|
||||
|
||||
choice
|
||||
prompt "SPI Port 1 Driver type"
|
||||
|
@ -111,9 +115,12 @@ config SPI_1_NRF_ORC
|
|||
|
||||
endif # SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS
|
||||
|
||||
endif # SPI_1 && !I2C_1
|
||||
endif # SPI_1 && !I2C_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)
|
||||
|
||||
if SPI_2
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
if SPI_2 && !I2C_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)
|
||||
|
||||
choice
|
||||
prompt "SPI Port 2 Driver type"
|
||||
|
@ -158,9 +165,12 @@ config SPI_2_NRF_ORC
|
|||
|
||||
endif # SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS
|
||||
|
||||
endif # SPI_2
|
||||
endif # SPI_2 && !I2C_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)
|
||||
|
||||
if SPI_3
|
||||
# In Nordic SoCs, SPI and TWI peripherals with the same instance number
|
||||
# share certain resources and therefore cannot be used at the same time
|
||||
# (in nRF91 Series this limitation concerns UART peripherals as well).
|
||||
if SPI_3 && !I2C_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)
|
||||
|
||||
choice
|
||||
prompt "SPI Port 3 Driver type"
|
||||
|
@ -206,7 +216,7 @@ config SPI_3_NRF_RX_DELAY
|
|||
edge of SCK (leading or trailing, depending on the CPHA setting used)
|
||||
until the input serial data on MISO is actually sampled.
|
||||
|
||||
endif # SPI_3
|
||||
endif # SPI_3 && !I2C_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)
|
||||
|
||||
if NRFX_SPIM
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue