Skip to content

Commit 760d158

Browse files
talih0stephanosio
authored andcommitted
drivers: spi: xmc4xxx: Fix comp with interrupt enabled and dma disabled
When dma is enabled, spi_xmc4xxx_transcieve_dma() needs to disable the isr used by spi_xmc4xxx_transceive(). Renable the isr at the end of spi_xmc4xxx_transceive_dma() instead of in spi_xmc4xxx_transceive(). Doing this in latter function will fail compilation when interrupt support is enabled but dma is disabled. This is regression from 8494b64 but was only caught when xmc47_relax_kit was added which tested this scenario in tests/drivers/spi/spi_loopback. Fixes #57494 Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
1 parent 96a9055 commit 760d158

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/spi/spi_xmc4xxx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ static int spi_xmc4xxx_transceive(const struct device *dev, const struct spi_con
292292
#if defined(CONFIG_SPI_XMC4XXX_INTERRUPT)
293293
XMC_SPI_CH_EnableEvent(config->spi, XMC_SPI_CH_EVENT_STANDARD_RECEIVE |
294294
XMC_SPI_CH_EVENT_ALTERNATIVE_RECEIVE);
295-
irq_enable(config->irq_num_rx);
296295
spi_xmc4xxx_shift_frames(dev);
297296
ret = spi_context_wait_for_completion(ctx);
298297
/* cs released in isr */
@@ -469,6 +468,7 @@ static int spi_xmc4xxx_transceive_dma(const struct device *dev, const struct spi
469468
spi_context_cs_control(ctx, false);
470469
}
471470

471+
irq_enable(config->irq_num_rx);
472472
spi_context_release(ctx, ret);
473473

474474
return ret;
@@ -645,6 +645,8 @@ static const struct spi_driver_api spi_xmc4xxx_driver_api = {
645645
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, rx, irq), \
646646
DT_INST_IRQ_BY_NAME(index, rx, priority), spi_xmc4xxx_isr, \
647647
DEVICE_DT_INST_GET(index), 0); \
648+
\
649+
irq_enable(irq_num); \
648650
}
649651

650652
#define XMC4XXX_IRQ_HANDLER_STRUCT_INIT(index) .irq_config_func = spi_xmc4xxx_irq_setup_##index,

0 commit comments

Comments
 (0)