From patchwork Thu May 3 18:09:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 134916 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2229316lji; Thu, 3 May 2018 11:09:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofw9gxqaMWYdVpwsWOzbhk9hhzWFYOFI8xgT62t0FQdbMjK4/8HPI6a207Ndr4zPwRAU2m X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr5856505plt.369.1525370988469; Thu, 03 May 2018 11:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525370988; cv=none; d=google.com; s=arc-20160816; b=vABnQ7X30AJt1YvTx03zxS1unjXtAIh4U7S9r1hIm0CDGFKfHDRGPgQFB11DAwlMpm ET94QPWbScnha4UAaR3ls1nh8E75vsJU2E9S8+Lo8y/ESfa+W84TSp50ERJb6gH3orNd wBJUbaLSNHdTB0tHUYFN7Ci/VjKq9/1pCi1jKJ/nWU+cHdswBSENgVc3ctWhJxm6zjp2 nCESM292u0izQopC+RByXF9vH0d0fYsuf/07+QLyaukV4nAtebEVws3OmV15XuGC9v1b sRy3gKqRCrf6TYKy1phx4G1QoEy1GBv3sNIF2dubmzgjNbAAf7qIYn5kVfgc5/iwk/ya lcZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9j1LvmxAgsSkSng/1Y7435qZxhNvWyoIhDASzwOY6gA=; b=yIUfxCjnKQB8cvbw/2tT+Fvd0ONkQsP4nJrZIoRprSS6njTKVMk3Zp34NdUFa5Kieh yqt++M9042msFXADgTTofuLkteABwPVp4VDKz1RWF56F7kO+Q9JvUXRE4J8XNA+D926i 7AMk4VHlYXjYB/p6OwgsPtis/JZjcNWFtKMnNBtuPd0jY6Vzlir+Y5hhh0X0w1DxOJqd B5RZljNxMUEfSxQNFBphSh5OPLxrvv9gZP04IavY8JkwT7XKhU8fWVg7p+Br0KO75oAX Lw5uKLyb1uaTX1hikZzy/ra1jlHaJt0aKxH8ywcWA9k9JFFBiAB/s07wjVlMyUXsy1fA JxKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7-v6si11769917pgc.381.2018.05.03.11.09.48; Thu, 03 May 2018 11:09:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbeECSJr (ORCPT + 1 other); Thu, 3 May 2018 14:09:47 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:44621 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbeECSJr (ORCPT ); Thu, 3 May 2018 14:09:47 -0400 Received: by mail-ot0-f196.google.com with SMTP id g7-v6so21673828otj.11 for ; Thu, 03 May 2018 11:09:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zd2a/kWDZCGQx42OMBRWF2QliLqXQNMDv7vrXaEFoo4=; b=GHlMkMw/VCh4I9RuT2c+OtG5wYIv++2hotqQJgTsH8dSeV7Nrzq9Emc/gaRpEV9xip 94h5HqWViy2d4GQRz0xB1/M1glbsihkaTZF/AE7ctPuuIRHBZOCjMMtqP94gS5pyfnuB igVP1/+cU8eBgySER5TFd9rvxLCGHOxVvdhOxyqiFHhIFw0IeOoZoJzp6KdCi7kSAXcU EH6GUOVkjZY6KROJYSQtavjmU5YJdRRUyXycn+GarrR2E4PHL1VB/X81uNVoKEgt/3Jp B4pqrjjOq0Hm3UMEOHekrDqb9hD12AwLqxZ7L1RlWSAuuu96MI6NKXRBPIJzgtO9U+GM eFsA== X-Gm-Message-State: ALQs6tDnz/kBpyV+2vIks3C4NFCa8CdMqdmEBQ9e4ABlp7Qx2WGCZGVa BOnDwZqXc0G1lPv2u4RWNw== X-Received: by 2002:a9d:1a2f:: with SMTP id a44-v6mr14761387ote.275.1525370986687; Thu, 03 May 2018 11:09:46 -0700 (PDT) Received: from xps15.herring.priv (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id t202-v6sm4054494oif.57.2018.05.03.11.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 11:09:46 -0700 (PDT) From: Rob Herring To: Mark Brown Cc: Alexander Graf , Marc Zyngier , Eric Anholt , Stefan Wahren , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] spi: bcm2835aux: ensure interrupts are enabled for shared handler Date: Thu, 3 May 2018 13:09:44 -0500 Message-Id: <20180503180945.3502-1-robh@kernel.org> X-Mailer: git-send-email 2.17.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The BCM2835 AUX SPI has a shared interrupt line (with AUX UART). Downstream fixes this with an AUX irqchip to demux the IRQ sources and a DT change which breaks compatibility with older kernels. The AUX irqchip was already rejected for upstream[1] and the DT change would break working systems if the DTB is updated to a newer one. The latter issue was brought to my attention by Alex Graf. The root cause however is a bug in the shared handler. Shared handlers must check that interrupts are actually enabled before servicing the interrupt. Add a check that the TXEMPTY or IDLE interrupts are enabled. [1] https://patchwork.kernel.org/patch/9781221/ Cc: Alexander Graf Cc: Marc Zyngier Cc: Mark Brown Cc: Eric Anholt Cc: Stefan Wahren Cc: Florian Fainelli Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: linux-spi@vger.kernel.org Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Rob Herring --- Compile tested only. I'll add something to the related github issue on this and hopefully someone can test and confirm. I'm assuming the 8250 driver can handle shared irqs correctly. Rob drivers/spi/spi-bcm2835aux.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Eric Anholt diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c index 1431cb98fe40..3094d818cf06 100644 --- a/drivers/spi/spi-bcm2835aux.c +++ b/drivers/spi/spi-bcm2835aux.c @@ -184,6 +184,11 @@ static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id) struct bcm2835aux_spi *bs = spi_master_get_devdata(master); irqreturn_t ret = IRQ_NONE; + /* IRQ may be shared, so return if our interrupts are disabled */ + if (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_CNTL1) & + (BCM2835_AUX_SPI_CNTL1_TXEMPTY | BCM2835_AUX_SPI_CNTL1_IDLE))) + return ret; + /* check if we have data to read */ while (bs->rx_len && (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &