Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp663286ybm; Thu, 28 May 2020 12:01:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+FybrdSikFfg4CJPoedZogaYDiahWTddZOn6fOD9+/Ed8SeYMMNq+AvTvXnGprXY6fp8H X-Received: by 2002:a17:906:b7cd:: with SMTP id fy13mr4568110ejb.133.1590692469480; Thu, 28 May 2020 12:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590692469; cv=none; d=google.com; s=arc-20160816; b=0av+fto3zOPCRyDl6lIsuWE1N526Iw5Vsm2WoCVLWEC5cWb3kl+dUhQBOXp+Y9iR2N VpqTZQ2Ln+v4xHjn7Qi7WM+0SKEQxX0uLkMQxGilkZx1T4y9NSz37KkcRj0aLVM3S/kZ vZ2X3BD1XJtq9RWGESyXIklQgoNLkkgEqJuHkgtoSqPZNJKpzhUEcx3DEAOQdohPjgM9 0jSaunA7dpkclTjMNg28XE9mvyhLpZJFEifFWm3ageaqlVeT4WcrKuObT5tRyrgt+Xlc 5NUKtpknsQlqZPRIhHWUyqIDhTk4hERHCLyj3+2fiznFsjY2e80vG5tu5kp9AE1ShCFR si+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FAM65NAJZrn2ZNhL0qEi0c10Gu3pPCHyhTeXFv2wHwc=; b=AeMTzdtIEsIeRdSaPqJ0P85/mHQDmuVtOCQE5+39X84i0x8Xc38Pa4rQew09BpxAIj X9uojZNPCcxtyvqBuQLeOX3lNJq9+q8h4Z0I/Uuxx7tMWa6xvfkNzBNlJjezBPtyWTJY OiRIiO8bzriEg1UmMTDr9T/+YAZWelVOpU+tsEchfGizwE68RYj1UPWhUnDQyQBrC4uH hQzfaViVfJgZYIrfFFIMi0lpfYe10y6NB2hV+e6QHmq5TTOwZuwVhOeKU0g7+Xwl9Lpq nwFLol66P18n5xOhOi6WxEpcGsGXUSMb0VuTKLC+DVi9aONQz3512rpmQEkZuuAp4j73 /+0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qt3si3976960ejb.21.2020.05.28.12.00.45; Thu, 28 May 2020 12:01:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406072AbgE1S6V (ORCPT + 99 others); Thu, 28 May 2020 14:58:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:60352 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406065AbgE1S6S (ORCPT ); Thu, 28 May 2020 14:58:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3F458AB5C; Thu, 28 May 2020 18:58:16 +0000 (UTC) From: Nicolas Saenz Julienne To: Mark Brown , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne Cc: Martin Sperl , linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: bcm2835: Enable shared interrupt support Date: Thu, 28 May 2020 20:58:04 +0200 Message-Id: <20200528185805.28991-1-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Sperl 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 Signed-off-by: Nicolas Saenz Julienne --- drivers/spi/spi-bcm2835.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 11c235879bb7..ca1085c812f2 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -379,6 +379,10 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) if (bs->tx_len && cs & BCM2835_SPI_CS_DONE) bcm2835_wr_fifo_blind(bs, BCM2835_SPI_FIFO_SIZE); + /* check if we got interrupt enabled */ + if (!(bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_INTR)) + return IRQ_NONE; + /* Read as many bytes as possible from FIFO */ bcm2835_rd_fifo(bs); /* Write as many bytes as possible to FIFO */ @@ -1340,8 +1344,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev) bcm2835_wr(bs, BCM2835_SPI_CS, BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); - err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0, - dev_name(&pdev->dev), ctlr); + err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, + IRQF_SHARED, dev_name(&pdev->dev), ctlr); if (err) { dev_err(&pdev->dev, "could not request IRQ: %d\n", err); goto out_dma_release; -- 2.26.2