Skip to content

Commit 89fcdd5

Browse files
msperlbroonie
authored andcommitted
spi: bcm2835: enable shared interrupt support
BCM2711 shares an interrupt betweem 5 SPI interfaces (0, 3, 4, 5 & 6). Another interrupt is shared between SPI1, SPI2 and UART1, which also affects BCM2835/6/7. Acting on an interrupt intended for another interface ought to be harmless (although potentially inefficient), but it can cause this driver to crash - presumably because some critical state is not ready. Add a test to the spi-bcm2835 interrupt service routine that interrupts are enabled on this interface to avoid the crash and improve efficiency. Signed-off-by: Martin Sperl <[email protected]> Link: raspberrypi/linux#5048 Suggested-by: https://github.com/boe-pi Co-developed-by: Phil Elwell <[email protected]> Signed-off-by: Phil Elwell <[email protected]> Cc: Mark Brown <[email protected]> Cc: Lukas Wunner <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b54f240 commit 89fcdd5

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
@@ -372,6 +372,10 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
372372
struct bcm2835_spi *bs = dev_id;
373373
u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS);
374374

375+
/* Bail out early if interrupts are not enabled */
376+
if (!(cs & BCM2835_SPI_CS_INTR))
377+
return IRQ_NONE;
378+
375379
/*
376380
* An interrupt is signaled either if DONE is set (TX FIFO empty)
377381
* or if RXR is set (RX FIFO >= ¾ full).
@@ -1365,8 +1369,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
13651369
bcm2835_wr(bs, BCM2835_SPI_CS,
13661370
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
13671371

1368-
err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
1369-
dev_name(&pdev->dev), bs);
1372+
err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt,
1373+
IRQF_SHARED, dev_name(&pdev->dev), bs);
13701374
if (err) {
13711375
dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
13721376
goto out_dma_release;

0 commit comments

Comments
 (0)