drivers: spi: spi_nrfx_spi(m|s): move ORC to DT

Specify the overrun character in Devicetree. Since 0xFF is the most
common value, DT property contains such default.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-06-20 15:45:28 +02:00 committed by Marti Bolivar
commit 3c6649f631
13 changed files with 47 additions and 57 deletions

View file

@ -52,15 +52,6 @@ config SPI_0_NRF_SPIS
Due to hardware limitations the implementation supports only simple
buffers (consisting of one part) located in RAM.
config SPI_0_NRF_ORC
hex "SPI Port 0 over-read character"
depends on SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.
config SPI_1_NRF_SPI
def_bool HAS_HW_NRF_SPI1
select NRFX_SPI1
@ -86,15 +77,6 @@ config SPI_1_NRF_SPIS
Due to hardware limitations the implementation supports only simple
buffers (consisting of one part) located in RAM.
config SPI_1_NRF_ORC
hex "SPI Port 1 over-read character"
depends on SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.
config SPI_2_NRF_SPI
def_bool HAS_HW_NRF_SPI2
select NRFX_SPI2
@ -120,15 +102,6 @@ config SPI_2_NRF_SPIS
Due to hardware limitations the implementation supports only simple
buffers (consisting of one part) located in RAM.
config SPI_2_NRF_ORC
hex "SPI Port 2 over-read character"
depends on SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.
config SPI_3_NRF_SPIM
def_bool HAS_HW_NRF_SPIM3
select NRFX_SPIM3
@ -144,15 +117,6 @@ config SPI_3_NRF_SPIS
Due to hardware limitations the implementation supports only simple
buffers (consisting of one part) located in RAM.
config SPI_3_NRF_ORC
hex "SPI Port 3 over-read character"
depends on SPI_3_NRF_SPIM || SPI_3_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.
config SPI_3_NRF_RX_DELAY
int "SPIM3 MISO sampling delay"
depends on SPI_3_NRF_SPIM && (SOC_NRF52833 || SOC_NRF52840)
@ -169,15 +133,6 @@ config SPI_4_NRF_SPIM
help
Enable nRF SPI Master with EasyDMA on port 4.
config SPI_4_NRF_ORC
hex "SPI Port 4 over-read character"
depends on SPI_4_NRF_SPIM
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.
config SPI_4_NRF_RX_DELAY
int "SPIM4 MISO sampling delay"
depends on SPI_4_NRF_SPIM && SOC_NRF5340_CPUAPP

View file

@ -321,7 +321,6 @@ static int spi_nrfx_pm_action(const struct device *dev,
*
* - NRFX_SPI_INSTANCE() requires an SoC instance number
* - soc-instance-numbered kconfig enables
* - ORC is a SoC-instance-numbered kconfig option instead of a DT property
*/
#define SPI(idx) DT_NODELABEL(spi##idx)
@ -389,7 +388,7 @@ static int spi_nrfx_pm_action(const struct device *dev,
.def_config = { \
SPI_NRFX_SPI_PIN_CFG(idx) \
.ss_pin = NRFX_SPI_PIN_NOT_USED, \
.orc = CONFIG_SPI_##idx##_NRF_ORC, \
.orc = SPI_PROP(idx, overrun_character), \
}, \
IF_ENABLED(CONFIG_PINCTRL, \
(.pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPI(idx)),)) \

View file

@ -572,7 +572,7 @@ static int spim_nrfx_pm_action(const struct device *dev,
.def_config = { \
SPI_NRFX_SPIM_PIN_CFG(idx) \
.ss_pin = NRFX_SPIM_PIN_NOT_USED, \
.orc = CONFIG_SPI_##idx##_NRF_ORC, \
.orc = SPIM_PROP(idx, overrun_character), \
SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \
}, \
COND_CODE_1(CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58, \

View file

@ -249,7 +249,6 @@ static int init_spis(const struct device *dev,
*
* - NRFX_SPIS_INSTANCE() requires an SoC instance number
* - soc-instance-numbered kconfig enables
* - ORC is a SoC-instance-numbered kconfig option instead of a DT property
*/
#define SPIS(idx) DT_NODELABEL(spi##idx)
@ -279,7 +278,7 @@ static int init_spis(const struct device *dev,
SPI_NRFX_SPIS_PIN_CFG(idx) \
.mode = NRF_SPIS_MODE_0, \
.bit_order = NRF_SPIS_BIT_ORDER_MSB_FIRST, \
.orc = CONFIG_SPI_##idx##_NRF_ORC, \
.orc = SPIS_PROP(idx, overrun_character), \
.def = SPIS_PROP(idx, def_char), \
}; \
IF_ENABLED(CONFIG_PINCTRL, ( \

View file

@ -19,6 +19,14 @@ properties:
Maximum data rate the SPI peripheral can be driven at, in Hz. This
property must be set at SoC level DTS files.
overrun-character:
type: int
default: 0xff
description: |
The overrun character (ORC) is used when all bytes from the TX buffer
are sent, but the transfer continues due to RX. Defaults to 0xff
(line high), the most common value used in SPI transfers.
sck-pin:
type: int
deprecated: true

View file

@ -1,5 +1,3 @@
CONFIG_SPI_1_NRF_ORC=0x00
CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_1"
CONFIG_SPI_LOOPBACK_CS_GPIO=y
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="GPIO_0"

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi1 {
overrun-character = <0x00>;
};

View file

@ -1,4 +1,3 @@
CONFIG_SPI_3_NRF_ORC=0x00
CONFIG_SPI_3_NRF_RX_DELAY=1
CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_3"

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi3 {
overrun-character = <0x00>;
};

View file

@ -1,5 +1,3 @@
CONFIG_SPI_1_NRF_ORC=0x00
CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_1"
CONFIG_SPI_LOOPBACK_CS_GPIO=y
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="GPIO_0"

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi1 {
overrun-character = <0x00>;
};

View file

@ -1,5 +1,3 @@
CONFIG_SPI_3_NRF_ORC=0x00
CONFIG_SPI_LOOPBACK_DRV_NAME="SPI_3"
CONFIG_SPI_LOOPBACK_CS_GPIO=y
CONFIG_SPI_LOOPBACK_CS_CTRL_GPIO_DRV_NAME="GPIO_0"

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi3 {
overrun-character = <0x00>;
};