Skip to content

Commit

Permalink
drivers: spi: fix spi_dw interrupt mask
Browse files Browse the repository at this point in the history
Found EMSDP board SPI-FLASH sample broke after adding DFSS
into spi_dw. Found wrong interrput mask resulting in false
interrupt enabled. Now fixed it to fit both DFSS and DW.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
  • Loading branch information
Siyuan Cheng authored and nashif committed May 30, 2023
1 parent 5a7b343 commit d2e91c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/spi/spi_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ static int transceive(const struct device *dev,
/* Enable interrupts */
reg_data = !rx_bufs ?
DW_SPI_IMR_UNMASK & DW_SPI_IMR_MASK_RX :
DW_SPI_IMR_UNMASK & DW_SPI_IMR_MASK_TX;
DW_SPI_IMR_UNMASK;
write_imr(info, reg_data);

spi_context_cs_control(&spi->ctx, true);
Expand Down
15 changes: 5 additions & 10 deletions drivers/spi/spi_dw.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,12 @@ static int reg_test_bit(uint8_t bit, uint32_t addr, uint32_t off)
DW_SPI_IMR_TXOIM | \
DW_SPI_IMR_RXUIM | \
DW_SPI_IMR_RXOIM | \
DW_SPI_IMR_RXFIM | \
DW_SPI_IMR_MSTIM)
#define DW_SPI_IMR_MASK_TX (~(DW_SPI_IMR_RXUIM | \
DW_SPI_IMR_TXOIM | \
DW_SPI_IMR_RXFIM)
#define DW_SPI_IMR_MASK_TX (~(DW_SPI_IMR_TXEIM | \
DW_SPI_IMR_TXOIM))
#define DW_SPI_IMR_MASK_RX (~(DW_SPI_IMR_RXUIM | \
DW_SPI_IMR_RXOIM | \
DW_SPI_IMR_MSTIM))
#define DW_SPI_IMR_MASK_RX (~(DW_SPI_IMR_TXEIM |\
DW_SPI_IMR_RXUIM | \
DW_SPI_IMR_TXOIM | \
DW_SPI_IMR_RXOIM | \
DW_SPI_IMR_MSTIM))
DW_SPI_IMR_RXFIM))

/*
* Including the right register definition file
Expand Down

0 comments on commit d2e91c6

Please sign in to comment.