Linux preempt-rt

Check our new training course

Real-Time Linux with PREEMPT_RT

Check our new training course
with Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

# Kconfig - nrf5 series MDK SPI support
#
# Copyright (c) 2017, Intel Corp.
# Copyright (c) 2016-2017, Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
#

# TODO add nrf51 master

menuconfig SPI_NRF5
	bool "nRF5 SPI drivers"
	depends on SPI && SOC_FAMILY_NRF5 && GPIO_NRF5_P0
	default n
	help
	  Enable support for nRF5 MCU series SPI drivers. Peripherals
	  with the same instance id can not be used together, e.g., SPIM0 and I2C_0
	  (TWIM0) and SPIS0. You may need to disable I2C_0 or I2C_1.

if SPI_NRF5

# nordic twiX0, spiX0, spi0 instances can not be used at the same time
if SPI_0 && !I2C_0

choice
	prompt "SPI Port 0 Driver type"
	optional

# TODO: rename to SPIM0_NRF5 when nRF51 SPIM driver is available.
config SPIM0_NRF52
	bool "nRF52 SPIM0"
	depends on SOC_SERIES_NRF52X
	help
	  nRF52 SPI Master with EasyDMA on port 0

# On nRF51, SPI0 is SPIM-only.
config SPIS0_NRF52
	bool "nRF52 SPIS0"
	depends on SOC_SERIES_NRF52X
	help
	  nRF51 and nRF52 SPI Slave with EasyDMA on port 0

endchoice

if SPIM0_NRF52

config SPIM0_NRF52_GPIO_SCK_PIN
	int "SCK pin number"
	range 0 31
	help
	  GPIO pin number for SCK

config SPIM0_NRF52_GPIO_MOSI_PIN
	int "MOSI pin number"
	range 0 31
	help
	  GPIO pin number to use for MOSI

config SPIM0_NRF52_GPIO_MISO_PIN
	int "MISO pin number"
	range 0 31
	help
	  GPIO pin number for MISO

config SPIM0_NRF52_GPIO_SS_PIN_0
	int "CS0 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM0_NRF52_GPIO_SS_PIN_1
	int "CS1 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM0_NRF52_GPIO_SS_PIN_2
	int "CS2 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM0_NRF52_GPIO_SS_PIN_3
	int "CS3 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM0_NRF52_ORC
	hex "Over Read Character"
	default 0x00
	range 0x00 0xff
	help
	  This option configures what value to send when the TX char count is
	  less than the RX count.

endif # SPIM0_NRF52

if SPIS0_NRF52

config SPIS0_NRF52_GPIO_SCK_PIN
	int "SCK pin number"
	range 0 31
	help
	  GPIO pin number for SCK

config SPIS0_NRF52_GPIO_MOSI_PIN
	int "MOSI pin number"
	range 0 31
	help
	  GPIO pin number for MOSI

config SPIS0_NRF52_GPIO_MISO_PIN
	int "MISO pin number"
	range 0 31
	help
	  GPIO pin number for MISO

config SPIS0_NRF52_GPIO_CSN_PIN
	int "CSN pin number"
	range 0 255
	default 255
	help
	  GPIO pin number for slave select (chip select). Not used value
	  is 255 (0xff).

config SPIS0_NRF52_DEF
	hex "Default character"
	default 0
	help
	  Default character. Character clocked out in case of an ignored
	  transaction.

endif # SPIS0_NRF5

endif # SPI_0 && !I2C_0

# nordic twiX1, spiX1, spi1 instances can not be use at the same time
if SPI_1 && !I2C_1

choice
	prompt "SPI Port 1 Driver type"
	optional

config SPIM1_NRF52
	bool "nRF52 SPIM1"
	depends on SOC_SERIES_NRF52X
	help
	  nRF52 SPI Master with EasyDMA on port 0

config SPIS1_NRF5
	bool "nRF5 SPIS1"
	depends on (SOC_SERIES_NRF52X || SOC_SERIES_NRF51X)
	help
	  nRF51 and nRF52 SPI Slave with EasyDMA on port 1

endchoice

if SPIM1_NRF52

config SPIM1_NRF52_GPIO_SCK_PIN
	int "SCK pin number"
	range 0 31
	help
	  GPIO pin number for SCK

config SPIM1_NRF52_GPIO_MOSI_PIN
	int "MOSI pin number"
	range 0 31
	help
	  GPIO pin number to use for MOSI

config SPIM1_NRF52_GPIO_MISO_PIN
	int "MISO pin number"
	range 0 31
	help
	  GPIO pin number for MISO

config SPIM1_NRF52_GPIO_SS_PIN_0
	int "CS0 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM1_NRF52_GPIO_SS_PIN_1
	int "CS1 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM1_NRF52_GPIO_SS_PIN_2
	int "CS2 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM1_NRF52_GPIO_SS_PIN_3
	int "CS3 pin number"
	range 0 255
	default 255
	help
	  Slave Select (Chip Select) gpio pin number for line n. Not used value
	  is 255 (0xff).

config SPIM1_NRF52_ORC
	hex "Over Read Character"
	default 0x00
	range 0x00 0xff
	help
	  This option configures what value to send when the TX char count is
	  less than the RX count.

endif # SPIM1_NRF52

if SPIS1_NRF5

config SPIS1_NRF5_GPIO_SCK_PIN
	int "SCK pin number"
	range 0 31
	help
	  GPIO pin number for SCK

config SPIS1_NRF5_GPIO_MOSI_PIN
	int "MOSI pin number"
	range 0 31
	help
	  GPIO pin number for MOSI

config SPIS1_NRF5_GPIO_MISO_PIN
	int "MISO pin number"
	range 0 31
	help
	  GPIO pin number for MISO

config SPIS1_NRF5_GPIO_CSN_PIN
	int "CSN pin number"
	range 0 255
	default 255
	help
	  GPIO pin number for slave select (chip select). Not used value
	  is 255 (0xff).

config SPIS1_NRF5_DEF
	hex "Default character"
	default 0
	help
	  Default character. Character clocked out in case of an ignored
	  transaction.

endif # SPIS1_NRF5

endif # SPI_1 && !I2C_1

# hidden compile options
config SPIM_NRF52
	bool
	depends on !I2C_0 || !I2C_1
	default y if (SPIM0_NRF52 || SPIM1_NRF52)

config SPIS_NRF5
	bool
	depends on !I2C_0 || !I2C_1
	default y if (SPIS0_NRF52 || SPIS1_NRF5)

endif # SPI_NRF5