Skip to content

Commit 1dd4659

Browse files
vvfedorenkobroonie
authored andcommitted
spi: xilinx: add force_irq for QSPI mode
Xilinx PG158 page 80 [1] states that master transaction inhibit bit must be set to properly setup the transaction in QSPI mode. Add the force_irq flag to follow this sequence. [1] https://docs.xilinx.com/r/en-US/pg153-axi-quad-spi/Dual/Quad-SPI-Mode-Transactions Signed-off-by: Vadim Fedorenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e976222 commit 1dd4659

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/spi/spi-xilinx.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct xilinx_spi {
8383
void __iomem *regs; /* virt. address of the control registers */
8484

8585
int irq;
86-
86+
bool force_irq; /* force irq to setup master inhibit */
8787
u8 *rx_ptr; /* pointer in the Tx buffer */
8888
const u8 *tx_ptr; /* pointer in the Rx buffer */
8989
u8 bytes_per_word;
@@ -248,7 +248,8 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
248248
xspi->rx_ptr = t->rx_buf;
249249
remaining_words = t->len / xspi->bytes_per_word;
250250

251-
if (xspi->irq >= 0 && remaining_words > xspi->buffer_size) {
251+
if (xspi->irq >= 0 &&
252+
(xspi->force_irq || remaining_words > xspi->buffer_size)) {
252253
u32 isr;
253254
use_irq = true;
254255
/* Inhibit irq to avoid spurious irqs on tx_empty*/
@@ -393,13 +394,15 @@ static int xilinx_spi_probe(struct platform_device *pdev)
393394
struct resource *res;
394395
int ret, num_cs = 0, bits_per_word;
395396
struct spi_master *master;
397+
bool force_irq = false;
396398
u32 tmp;
397399
u8 i;
398400

399401
pdata = dev_get_platdata(&pdev->dev);
400402
if (pdata) {
401403
num_cs = pdata->num_chipselect;
402404
bits_per_word = pdata->bits_per_word;
405+
force_irq = pdata->force_irq;
403406
} else {
404407
of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
405408
&num_cs);
@@ -477,6 +480,8 @@ static int xilinx_spi_probe(struct platform_device *pdev)
477480
dev_name(&pdev->dev), xspi);
478481
if (ret)
479482
return ret;
483+
484+
xspi->force_irq = force_irq;
480485
}
481486

482487
/* SPI controller initializations */

include/linux/spi/xilinx_spi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct xspi_platform_data {
1515
u8 bits_per_word;
1616
struct spi_board_info *devices;
1717
u8 num_devices;
18+
bool force_irq;
1819
};
1920

2021
#endif /* __LINUX_SPI_XILINX_SPI_H */

0 commit comments

Comments
 (0)