Skip to content

Commit ecfbd3c

Browse files
msperlbroonie
authored andcommitted
spi: bcm2835: Enable shared interrupt support
bcm2711, Rasberry Pi 4's SoC, shares one interrupt for multiple instances of the bcm2835 SPI controller. So this enables shared interrupt support for them. The early bail out in the interrupt routine avoids messing with buffers of transfers being done by other means. Otherwise, the driver can handle receiving interrupts asserted by other controllers during an IRQ based transfer. Signed-off-by: Martin Sperl <[email protected]> Signed-off-by: Nicolas Saenz Julienne <[email protected]> Tested-by: Florian Fainelli <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 118eb0e commit ecfbd3c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/spi/spi-bcm2835.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
379379
if (bs->tx_len && cs & BCM2835_SPI_CS_DONE)
380380
bcm2835_wr_fifo_blind(bs, BCM2835_SPI_FIFO_SIZE);
381381

382+
/* check if we got interrupt enabled */
383+
if (!(bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_INTR))
384+
return IRQ_NONE;
385+
382386
/* Read as many bytes as possible from FIFO */
383387
bcm2835_rd_fifo(bs);
384388
/* Write as many bytes as possible to FIFO */
@@ -1344,8 +1348,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
13441348
bcm2835_wr(bs, BCM2835_SPI_CS,
13451349
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
13461350

1347-
err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
1348-
dev_name(&pdev->dev), ctlr);
1351+
err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt,
1352+
IRQF_SHARED, dev_name(&pdev->dev), ctlr);
13491353
if (err) {
13501354
dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
13511355
goto out_dma_release;

0 commit comments

Comments
 (0)