Skip to content

[nrf fromlist] drivers: spi: spi_nrfx_spi: remove multithreading dependency #2907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ config SPI_SHELL

config SPI_ASYNC
bool "Asynchronous call support"
depends on MULTITHREADING
select POLL
help
This option enables the asynchronous API calls.
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/Kconfig.nrfx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ menuconfig SPI_NRFX
bool "nRF SPI nrfx drivers"
default y
depends on SOC_FAMILY_NORDIC_NRF
depends on MULTITHREADING
select GPIO
select PINCTRL
help
Enable support for nrfx SPI drivers for nRF MCU series.
Expand Down
52 changes: 50 additions & 2 deletions drivers/spi/spi_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@

struct spi_context {
const struct spi_config *config;
#ifdef CONFIG_MULTITHREADING
const struct spi_config *owner;
#endif
const struct gpio_dt_spec *cs_gpios;
size_t num_cs_gpios;

#ifdef CONFIG_MULTITHREADING
struct k_sem lock;
struct k_sem sync;
#else
/* An atomic flag that signals completed transfer
* when threads are not enabled.
*/
atomic_t ready;
#endif /* CONFIG_MULTITHREADING */
int sync_status;

#ifdef CONFIG_SPI_ASYNC
Expand Down Expand Up @@ -105,6 +114,7 @@
void *callback_data,
const struct spi_config *spi_cfg)
{
#ifdef CONFIG_MULTITHREADING
bool already_locked = (spi_cfg->operation & SPI_LOCK_ON) &&
(k_sem_count_get(&ctx->lock) == 0) &&
(ctx->owner == spi_cfg);
Expand All @@ -113,6 +123,7 @@
k_sem_take(&ctx->lock, K_FOREVER);
ctx->owner = spi_cfg;
}
#endif /* CONFIG_MULTITHREADING */

#ifdef CONFIG_SPI_ASYNC
ctx->asynchronous = asynchronous;
Expand All @@ -130,6 +141,7 @@
*/
static inline void spi_context_release(struct spi_context *ctx, int status)
{
#ifdef CONFIG_MULTITHREADING
#ifdef CONFIG_SPI_SLAVE
if (status >= 0 && (ctx->config->operation & SPI_LOCK_ON)) {
return;
Expand All @@ -147,6 +159,7 @@
k_sem_give(&ctx->lock);
}
#endif /* CONFIG_SPI_ASYNC */
#endif /* CONFIG_MULTITHREADING */
}

static inline size_t spi_context_total_tx_len(struct spi_context *ctx);
Expand All @@ -172,29 +185,57 @@

if (wait) {
k_timeout_t timeout;
uint32_t timeout_ms;

/* Do not use any timeout in the slave mode, as in this case
* it is not known when the transfer will actually start and
* what the frequency will be.
*/
if (IS_ENABLED(CONFIG_SPI_SLAVE) && spi_context_is_slave(ctx)) {
timeout = K_FOREVER;
timeout_ms = UINT32_MAX;
} else {
uint32_t tx_len = spi_context_total_tx_len(ctx);
uint32_t rx_len = spi_context_total_rx_len(ctx);
uint32_t timeout_ms;

timeout_ms = MAX(tx_len, rx_len) * 8 * 1000 /
ctx->config->frequency;
timeout_ms += CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE;

timeout = K_MSEC(timeout_ms);
}

#ifdef CONFIG_MULTITHREADING
if (k_sem_take(&ctx->sync, timeout)) {
LOG_ERR("Timeout waiting for transfer complete");
return -ETIMEDOUT;
}
#else
if (timeout_ms == UINT32_MAX) {
/* In slave mode, we wait indefinitely, so we can go idle. */
unsigned int key = irq_lock();

while (!atomic_get(&ctx->ready)) {
k_cpu_atomic_idle(key);
key = irq_lock();
}

ctx->ready = 0;
irq_unlock(key);
} else {
const uint32_t tms = k_uptime_get_32();

while (!atomic_get(&ctx->ready) && (k_uptime_get_32() - tms < timeout_ms)) {
k_busy_wait(1);
}

if (!ctx->ready) {
LOG_ERR("Timeout waiting for transfer complete");
return -ETIMEDOUT;
}

ctx->ready = 0;
}
#endif /* CONFIG_MULTITHREADING */
status = ctx->sync_status;
}

Expand Down Expand Up @@ -238,10 +279,15 @@
ctx->owner = NULL;
k_sem_give(&ctx->lock);
}

}

Check notice on line 283 in drivers/spi/spi_context.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_context.h:283 -
#else
ctx->sync_status = status;
#ifdef CONFIG_MULTITHREADING
k_sem_give(&ctx->sync);
#else
atomic_set(&ctx->ready, 1);
#endif /* CONFIG_MULTITHREADING */
#endif /* CONFIG_SPI_ASYNC */
}

Expand Down Expand Up @@ -315,10 +361,12 @@
/* Forcing CS to go to inactive status */
_spi_context_cs_control(ctx, false, true);

#ifdef CONFIG_MULTITHREADING
if (!k_sem_count_get(&ctx->lock)) {
ctx->owner = NULL;
k_sem_give(&ctx->lock);
}
#endif /* CONFIG_MULTITHREADING */
}

/*
Expand Down
10 changes: 8 additions & 2 deletions drivers/spi/spi_nrfx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@
finish_transaction(dev, -ETIMEDOUT);

/* Clean up the driver state. */
#ifdef CONFIG_MULTITHREADING
k_sem_reset(&dev_data->ctx.sync);
#else
dev_data->ctx.ready = 0;
#endif /* CONFIG_MULTITHREADING */
}

spi_context_cs_control(&dev_data->ctx, false);
Expand Down Expand Up @@ -431,9 +435,11 @@
IRQ_CONNECT(DT_IRQN(SPI(idx)), DT_IRQ(SPI(idx), priority), \
nrfx_isr, nrfx_spi_##idx##_irq_handler, 0); \
} \
static struct spi_nrfx_data spi_##idx##_data = { \

Check notice on line 438 in drivers/spi/spi_nrfx_spi.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spi.c:438 -#define SPI_NRFX_SPI_DEFINE(idx) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPI(idx)); \ - static void irq_connect##idx(void) \ - { \ - IRQ_CONNECT(DT_IRQN(SPI(idx)), DT_IRQ(SPI(idx), priority), \ - nrfx_isr, nrfx_spi_##idx##_irq_handler, 0); \ - } \ +#define SPI_NRFX_SPI_DEFINE(idx) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPI(idx)); \ + static void irq_connect##idx(void) \ + { \ + IRQ_CONNECT(DT_IRQN(SPI(idx)), DT_IRQ(SPI(idx), priority), nrfx_isr, \ + nrfx_spi_##idx##_irq_handler, 0); \ + } \
SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx), \
SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx), \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) \
SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPI(idx), ctx) \
.dev = DEVICE_DT_GET(SPI(idx)), \
.busy = false, \
Expand Down Expand Up @@ -467,7 +473,7 @@
&spi_##idx##z_config, \
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \
&spi_nrfx_driver_api)

Check notice on line 476 in drivers/spi/spi_nrfx_spi.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spi.c:476 - }; \ - PINCTRL_DT_DEFINE(SPI(idx)); \ - static const struct spi_nrfx_config spi_##idx##z_config = { \ - .spi = { \ - .p_reg = (NRF_SPI_Type *)DT_REG_ADDR(SPI(idx)), \ - .drv_inst_idx = NRFX_SPI##idx##_INST_IDX, \ - }, \ - .def_config = { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .ss_pin = NRFX_SPI_PIN_NOT_USED, \ - .orc = SPI_PROP(idx, overrun_character), \ - }, \ - .irq_connect = irq_connect##idx, \ - .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPI(idx)), \ - .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPI(idx), wake_gpios, \ - WAKE_PIN_NOT_USED), \ - .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPI(idx)), \ - }; \ - BUILD_ASSERT(!DT_NODE_HAS_PROP(SPI(idx), wake_gpios) || \ - !(DT_GPIO_FLAGS(SPI(idx), wake_gpios) & GPIO_ACTIVE_LOW), \ - "WAKE line must be configured as active high"); \ - PM_DEVICE_DT_DEFINE(SPI(idx), spi_nrfx_pm_action); \ - SPI_DEVICE_DT_DEFINE(SPI(idx), \ - spi_nrfx_init, \ - PM_DEVICE_DT_GET(SPI(idx)), \ - &spi_##idx##_data, \ - &spi_##idx##z_config, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_nrfx_driver_api) + }; \ + PINCTRL_DT_DEFINE(SPI(idx)); \ + static const struct spi_nrfx_config spi_##idx##z_config = { \ + .spi = \ + { \ + .p_reg = (NRF_SPI_Type *)DT_REG_ADDR(SPI(idx)), \ + .drv_inst_idx = NRFX_SPI##idx##_INST_IDX, \ + }, \ + .def_config = \ + { \ + .skip_gpio_cfg = true, \ + .skip_psel_cfg = true, \ + .ss_pin = NRFX_SPI_PIN_NOT_USED, \ + .orc = SPI_PROP(idx, overrun_character), \ + }, \ + .irq_connect = irq_connect##idx, \ + .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPI(idx)), \ + .wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPI(idx), wake_gpios, WAKE_PIN_NOT_USED), \ + .wake_gpiote = WAKE_GPIOTE_INSTANCE(SPI(idx)), \ + }; \ + BUILD_ASSERT(!DT_NODE_HAS_PROP(SPI(idx), wake_gpios) || \ + !(DT_GPIO_FLAGS(SPI(idx), wake_gpios) & GPIO_ACTIVE_LOW), \ + "WAKE line must be configured as active high"); \ + PM_DEVICE_DT_DEFINE(SPI(idx), spi_nrfx_pm_action); \ + SPI_DEVICE_DT_DEFINE(SPI(idx), spi_nrfx_init, PM_DEVICE_DT_GET(SPI(idx)), \ + &spi_##idx##_data, &spi_##idx##z_config, POST_KERNEL, \ + CONFIG_SPI_INIT_PRIORITY, &spi_nrfx_driver_api)
#ifdef CONFIG_HAS_HW_NRF_SPI0
SPI_NRFX_SPI_DEFINE(0);
#endif
Expand Down
10 changes: 8 additions & 2 deletions drivers/spi/spi_nrfx_spim.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,11 @@
finish_transaction(dev, -ETIMEDOUT);

/* Clean up the driver state. */
#ifdef CONFIG_MULTITHREADING
k_sem_reset(&dev_data->ctx.sync);
#else
dev_data->ctx.ready = 0;
#endif /* CONFIG_MULTITHREADING */
#ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58
anomaly_58_workaround_clear(dev_data);
#endif
Expand Down Expand Up @@ -804,8 +808,10 @@
[CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \
SPIM_MEMORY_SECTION(idx);)) \
static struct spi_nrfx_data spi_##idx##_data = { \
SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx), \
SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx), \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) \
SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPIM(idx), ctx) \
IF_ENABLED(SPI_BUFFER_IN_RAM, \
(.tx_buffer = spim_##idx##_tx_buffer, \
Expand Down Expand Up @@ -858,7 +864,7 @@
&spi_##idx##z_config, \
POST_KERNEL, SPIM_INIT_PRIORITY(idx), \
&spi_nrfx_driver_api)

Check notice on line 867 in drivers/spi/spi_nrfx_spim.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spim.c:867 -#define SPI_NRFX_SPIM_DEFINE(idx) \ - NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \ - static void irq_connect##idx(void) \ - { \ - IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), \ - nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \ - } \ +#define SPI_NRFX_SPIM_DEFINE(idx) \ + NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \ + static void irq_connect##idx(void) \ + { \ + IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), nrfx_isr, \ + nrfx_spim_##idx##_irq_handler, 0); \ + } \ IF_ENABLED(SPI_BUFFER_IN_RAM, \ (static uint8_t spim_##idx##_tx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ SPIM_MEMORY_SECTION(idx); \ static uint8_t spim_##idx##_rx_buffer \ [CONFIG_SPI_NRFX_RAM_BUFFER_SIZE] \ - SPIM_MEMORY_SECTION(idx);)) \ - static struct spi_nrfx_data spi_##idx##_data = { \ + SPIM_MEMORY_SECTION(idx);)) \ + static struct spi_nrfx_data spi_##idx##_data = { \ IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ - IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPIM(idx), ctx) \ - IF_ENABLED(SPI_BUFFER_IN_RAM, \ + (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ + IF_ENABLED(CONFIG_MULTITHREADING, \ + (SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) SPI_CONTEXT_CS_GPIOS_INITIALIZE(SPIM(idx), \ + ctx) \ + IF_ENABLED(SPI_BUFFER_IN_RAM, \ (.tx_buffer = spim_##idx##_tx_buffer, \ - .rx_buffer = spim_##idx##_rx_buffer,)) \ - .dev = DEVICE_DT_GET(SPIM(idx)), \ - .busy = false, \ - }; \ - PINCTRL_DT_DEFINE(SPIM(idx)); \ - static const struct spi_nrfx_config spi_##idx##z_config = { \ - .spim = { \ - .p_reg = (NRF_SPIM_Type *)DT_REG_ADDR(SPIM(idx)), \ - .drv_inst_idx = NRFX_SPIM##idx##_INST_IDX, \ - }, \ - .max_freq = SPIM_PROP(idx, max_frequency), \ - .def_config = { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .ss_pin = NRF_SPIM_PIN_NOT_CONNECTED, \ - .orc = SPIM_PROP(idx, overrun_character), \ - SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \ - }, \ - .irq_connect = irq_connect##idx, \ - .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPIM(idx)), \ - .max_chunk_len = BIT_MASK(SPIM_PROP(idx, easydma_maxcnt_bits)),\ + .rx_buffer = spim_##idx##_rx_buffer,)) .dev = \ + DEVICE_DT_GET(SPIM(idx)), \ + .busy = false, \ + }; \ + PINCTRL_DT_DEFINE(SPIM(idx)); \ + static const struct spi_nrfx_config spi_##idx##z_config = { \ + .spim = \ + {
#define SPIM_MEMORY_SECTION(idx) \
COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \
(__attribute__((__section__(LINKER_DT_NODE_REGION_NAME( \
Expand Down
31 changes: 27 additions & 4 deletions drivers/spi/spi_nrfx_spis.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
struct spi_nrfx_data {
struct spi_context ctx;
const struct device *dev;
#ifdef CONFIG_MULTITHREADING
struct k_sem wake_sem;
#else
atomic_t woken_up;
#endif
struct gpio_callback wake_cb_data;
};

Expand Down Expand Up @@ -193,7 +197,11 @@

(void)gpio_pin_interrupt_configure_dt(&dev_config->wake_gpio,
GPIO_INT_DISABLE);
#ifdef CONFIG_MULTITHREADING
k_sem_give(&dev_data->wake_sem);
#else
atomic_set(&dev_data->woken_up, 1);
#endif /* CONFIG_MULTITHREADING */
}

static void wait_for_wake(struct spi_nrfx_data *dev_data,
Expand All @@ -206,7 +214,19 @@
dev_config->wake_gpio.pin) == 0) {
(void)gpio_pin_interrupt_configure_dt(&dev_config->wake_gpio,
GPIO_INT_LEVEL_HIGH);
#ifdef CONFIG_MULTITHREADING
(void)k_sem_take(&dev_data->wake_sem, K_FOREVER);
#else
unsigned int key = irq_lock();

while (!atomic_get(&dev_data->woken_up)) {
k_cpu_atomic_idle(key);
key = irq_lock();
}

dev_data->woken_up = 0;
irq_unlock(key);
#endif /* CONFIG_MULTITHREADING */
}
}

Expand Down Expand Up @@ -482,11 +502,14 @@
nrfx_isr, nrfx_spis_##idx##_irq_handler, 0); \
} \
static struct spi_nrfx_data spi_##idx##_data = { \
SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx), \
SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx), \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \
IF_ENABLED(CONFIG_MULTITHREADING, \
(SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) \
.dev = DEVICE_DT_GET(SPIS(idx)), \
.wake_sem = Z_SEM_INITIALIZER( \
spi_##idx##_data.wake_sem, 0, 1), \
IF_ENABLED(CONFIG_MULTITHREADING, \
(.wake_sem = Z_SEM_INITIALIZER( \
spi_##idx##_data.wake_sem, 0, 1),)) \
}; \
PINCTRL_DT_DEFINE(SPIS(idx)); \
static const struct spi_nrfx_config spi_##idx##z_config = { \
Expand Down Expand Up @@ -524,7 +547,7 @@
POST_KERNEL, \
CONFIG_SPI_INIT_PRIORITY, \
&spi_nrfx_driver_api)

Check notice on line 550 in drivers/spi/spi_nrfx_spis.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/spi/spi_nrfx_spis.c:550 -#define SPI_NRFX_SPIS_DEFINE(idx) \ - static void irq_connect##idx(void) \ - { \ - IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), \ - nrfx_isr, nrfx_spis_##idx##_irq_handler, 0); \ - } \ - static struct spi_nrfx_data spi_##idx##_data = { \ - IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ - IF_ENABLED(CONFIG_MULTITHREADING, \ - (SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) \ - .dev = DEVICE_DT_GET(SPIS(idx)), \ - IF_ENABLED(CONFIG_MULTITHREADING, \ +#define SPI_NRFX_SPIS_DEFINE(idx) \ + static void irq_connect##idx(void) \ + { \ + IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), nrfx_isr, \ + nrfx_spis_##idx##_irq_handler, 0); \ + } \ + static struct spi_nrfx_data spi_##idx##_data = {IF_ENABLED(CONFIG_MULTITHREADING, \ + (SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx),)) \ + IF_ENABLED(CONFIG_MULTITHREADING, \ + (SPI_CONTEXT_INIT_SYNC(spi_##idx##_data, ctx),)) .dev = \ + DEVICE_DT_GET(SPIS(idx)), \ + IF_ENABLED(CONFIG_MULTITHREADING, \ (.wake_sem = Z_SEM_INITIALIZER( \ - spi_##idx##_data.wake_sem, 0, 1),)) \ - }; \ - PINCTRL_DT_DEFINE(SPIS(idx)); \ - static const struct spi_nrfx_config spi_##idx##z_config = { \ - .spis = { \ - .p_reg = (NRF_SPIS_Type *)DT_REG_ADDR(SPIS(idx)), \ - .drv_inst_idx = NRFX_SPIS##idx##_INST_IDX, \ - }, \ - .config = { \ - .skip_gpio_cfg = true, \ - .skip_psel_cfg = true, \ - .mode = NRF_SPIS_MODE_0, \ - .bit_order = NRF_SPIS_BIT_ORDER_MSB_FIRST, \ - .orc = SPIS_PROP(idx, overrun_character), \ - .def = SPIS_PROP(idx, def_char), \ - }, \ - .irq_connect = irq_connect##idx, \ - .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPIS(idx)), \ - .max_buf_len = BIT_MASK(SPIS_PROP(idx, easydma_maxcnt_bits)), \ + spi_##idx##_data.wake_sem, 0, 1),)) }; \ + PINCTRL_DT_DEFINE(SPIS(idx)); \ + static const struct spi_nrfx_config spi_##idx##z_config = { \ + .spis = \ + { \ + .p_reg = (NRF_SPIS_Type *)DT_REG_ADDR(SPIS(idx)), \ + .drv_inst_idx = NRFX_SPIS##idx##_INST_IDX, \ + }, \ + .config = \ + { \ + .skip_gpio_cfg = true, \ + .skip_psel_cfg = true, \ + .mode = NRF_SPIS_MODE_0, \ + .bit_order = NRF_SPIS_BIT_ORDER_MSB_FIRST, \ + .orc = SPIS_PROP(idx, overrun_character), \ + .def = SPIS_PROP(idx, def_char), \ + }, \ + .irq_connect = irq_connect##idx, \ + .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPIS(idx)),
/* Macro creates device instance if it is enabled in devicetree. */
#define SPIS_DEVICE(periph, prefix, id, _) \
IF_ENABLED(CONFIG_HAS_HW_NRF_SPIS##prefix##id, (SPI_NRFX_SPIS_DEFINE(prefix##id);))
Expand Down
Loading