From patchwork Thu Jun 4 03:46:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11586883 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3122B913 for ; Thu, 4 Jun 2020 03:47:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15B482074B for ; Thu, 4 Jun 2020 03:47:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XMh2NLBL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbgFDDrE (ORCPT ); Wed, 3 Jun 2020 23:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbgFDDrB (ORCPT ); Wed, 3 Jun 2020 23:47:01 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C60CC03E96D; Wed, 3 Jun 2020 20:47:01 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id t7so2949930pgt.3; Wed, 03 Jun 2020 20:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NxEaSPQeIOPRkfXUqBGWXS3DhANeE89pJJUJwsIWN6U=; b=XMh2NLBLCV1jRAsM/ApPVYMn0b8sSfJSvOD39kjJ1Om9Wed9iwphuhaPW9wZ3rsBHv u8UUaLG7LjbGEYX+lAyn6swrDVh9AvFtLNGkHG7klLKXrNclPthMtPF0i2sh2fLO3ys5 wwT90Pe51q16aPifitePxyi03f77GMxf4NvhwVuaMusm7QLwD7q0iLO+TUj49JVRlbNe 6cyzApJCV7abeGs6zUhOHAfrRSSPel6w+A6rfY006mPcSKCANZernfLy0CFifmBw7JAm XzUF0f/amIWLBpuMk7lrwlZdWFc2dYJbjwYnxzaY/mSz2cMDGqig2Qns1uSdl28izDXv BrJw== 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:in-reply-to :references; bh=NxEaSPQeIOPRkfXUqBGWXS3DhANeE89pJJUJwsIWN6U=; b=dXmeR56coD0mjaGzIh8a+wyEXDa3+yr4fULC+UgluqkCharkuPMiDPWzgZtpOW5dVH DH7Km1eCYzGZ3EG36uDtYO3kEGZCXjpTq8/trqEbE9X43sTsgSDouKxDG49ujVt7qLFD H5q8qx76/gIPzhgM8RKHUJE76lF7n0bYITtNGc1/FJA4c0yIkGr0lVOSA/sFQDwgxA33 nb+x0Rd43QcyF/OiqbE+jAvrqdm2KCf9hdeMVdvLcKxRW4UDYD4TcpRdsihMs4FMvUah 4uU5uuvUKEHJh/lBzJ4zFLoiMs2EyLKtGNmefr3X2eaFktOYvC/JyEABgvNLyCnCLBDv 7GNg== X-Gm-Message-State: AOAM533X+S7JwNCXhiZire7vlDVB+YWPCIIwX2+JhqeFmlMRrAdjs3JS S+AVBXOmMTI+Tu7GbIE565dymmtx X-Google-Smtp-Source: ABdhPJyuRIpehL8ILBEuAv8MYZ88AthlobDOSBfpKUE+4FSI+ipnlgCRqSzcWpGqCddTssyAUSN10g== X-Received: by 2002:a05:6a00:150c:: with SMTP id q12mr2251871pfu.270.1591242420517; Wed, 03 Jun 2020 20:47:00 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p19sm3083367pff.116.2020.06.03.20.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 20:46:59 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Mark Brown , Rob Herring , Nicolas Saenz Julienne , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...), linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), Martin Sperl , lukas@wunner.de Subject: [PATCH 1/3] dt-bindings: spi: Document bcm2711 and bcm7211 SPI compatible Date: Wed, 3 Jun 2020 20:46:53 -0700 Message-Id: <20200604034655.15930-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200604034655.15930-1-f.fainelli@gmail.com> References: <20200604034655.15930-1-f.fainelli@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The BCM2711 and BCM7211 chips use the BCM2835 SPI controller, but there are severl instances of those in the system and they all share the same interrupt line. Document specific compatible strings such that the driver can take appropriate actions. Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt b/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt index f11f295c8450..3d55dd64b1be 100644 --- a/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt +++ b/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt @@ -5,7 +5,8 @@ SPI0, and the other known as the "Universal SPI Master"; part of the auxiliary block. This binding applies to the SPI0 controller. Required properties: -- compatible: Should be "brcm,bcm2835-spi". +- compatible: Should be one of "brcm,bcm2835-spi" for BCM2835/2836/2837 or + "brcm,bcm2711-spi" for BCM2711 or "brcm,bcm7211-spi" for BCM7211. - reg: Should contain register location and length. - interrupts: Should contain interrupt. - clocks: The clock feeding the SPI controller. From patchwork Thu Jun 4 03:46:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11586881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AF43913 for ; Thu, 4 Jun 2020 03:47:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FF0420679 for ; Thu, 4 Jun 2020 03:47:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KFOe7x6I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbgFDDrF (ORCPT ); Wed, 3 Jun 2020 23:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727078AbgFDDrE (ORCPT ); Wed, 3 Jun 2020 23:47:04 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 278A8C03E96D; Wed, 3 Jun 2020 20:47:03 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id j1so2580891pfe.4; Wed, 03 Jun 2020 20:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ljd1gL0a9YiLaECGRPUeWMWqu+jwE37ussa58cXejzA=; b=KFOe7x6IauMLNFE6HuIGA9laJSc4wQ8x9ZS2Kto1ySLnTDNb85y66ci+0Meqq7qqy/ 5K+adi8U+uMY5S2TtJ8ek0N60iZ5UHt8DrBbU9vN/NlexZkaZSrcsT2mK/VbDiNas0Wj 55H9G3/nXOALk9OhppEKn1xUs0OMCg+QZ4kbpUTHnewmfqXsjToNh8rMRwoDdTGGKHZX sj00WxYzUPlGyf7sDohmvVnRDurXAq2pZso/3HiHo7fVNhSX6hEw2N9J5PdlIw378rqu Dt2kAGGlAyb4laYnEodsJ2kr1a9A3bstMmu64hRqIOrRA4bo80PMEwXOLNqBgXzBdAi6 EjJA== 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:in-reply-to :references; bh=ljd1gL0a9YiLaECGRPUeWMWqu+jwE37ussa58cXejzA=; b=fahz0hmDVyz0gJfrdpIXHf5farpnThBpHqeqRrPNwjDH5Y9RFWz8PCVfvNB0aTTb/u 38aahd3gQ5Bk8kcYqx9kbzHZvOOOskZGW/o+v+CHZrLvlf2cwYq6EfQqEOUdMrHVJws1 np8hbK11dW+ridHL2n0a1Qn6Ul4ErihSdphzwuIzAmwyoTpuXi3yXwmQ8Nhn+MtzVoN+ kWbC4AsFsNooLJLGVmFLH7bxRkuDx2vCHkBI0789J3ZlOSD3yd5qD9Z4m4/QVnoj2n1g EzdUwWR7hrmkiRKtoNtLml3wKEVM7kkZSidH5x5YF0i/AKs+pb9eBwFwlsENncI6WhS9 K0AA== X-Gm-Message-State: AOAM531xdqo8iGloNj48FBcT6vapus3a/Oxit8F8lL+bS3xstMRjVEAo GUEDsrKl+mnnH1R5a3JShHPndlcl X-Google-Smtp-Source: ABdhPJwNVk3QpeeMpbblNbwAltfHbm6Ih+XSP+R2DYxvoDZBP0fN/cf2VcALRGiRxP0aHkdT0nmoYA== X-Received: by 2002:a62:e703:: with SMTP id s3mr2151197pfh.43.1591242422257; Wed, 03 Jun 2020 20:47:02 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p19sm3083367pff.116.2020.06.03.20.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 20:47:01 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Mark Brown , Rob Herring , Nicolas Saenz Julienne , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...), linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), Martin Sperl , lukas@wunner.de Subject: [PATCH 2/3] ARM: dts: bcm2711: Update SPI nodes compatible strings Date: Wed, 3 Jun 2020 20:46:54 -0700 Message-Id: <20200604034655.15930-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200604034655.15930-1-f.fainelli@gmail.com> References: <20200604034655.15930-1-f.fainelli@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The BCM2711 SoC features 5 SPI controllers which all share the same interrupt line, the SPI driver needs to support interrupt sharing, therefore use the chip specific compatible string to help with that. Signed-off-by: Florian Fainelli --- arch/arm/boot/dts/bcm2711.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi index a91cf68e3c4c..9a9ea67fbc2d 100644 --- a/arch/arm/boot/dts/bcm2711.dtsi +++ b/arch/arm/boot/dts/bcm2711.dtsi @@ -152,7 +152,7 @@ }; spi3: spi@7e204600 { - compatible = "brcm,bcm2835-spi"; + compatible = "brcm,bcm2711-spi", "brcm,bcm2835-spi"; reg = <0x7e204600 0x0200>; interrupts = ; clocks = <&clocks BCM2835_CLOCK_VPU>; @@ -162,7 +162,7 @@ }; spi4: spi@7e204800 { - compatible = "brcm,bcm2835-spi"; + compatible = "brcm,bcm2711-spi", "brcm,bcm2835-spi"; reg = <0x7e204800 0x0200>; interrupts = ; clocks = <&clocks BCM2835_CLOCK_VPU>; @@ -172,7 +172,7 @@ }; spi5: spi@7e204a00 { - compatible = "brcm,bcm2835-spi"; + compatible = "brcm,bcm2711-spi", "brcm,bcm2835-spi"; reg = <0x7e204a00 0x0200>; interrupts = ; clocks = <&clocks BCM2835_CLOCK_VPU>; @@ -182,7 +182,7 @@ }; spi6: spi@7e204c00 { - compatible = "brcm,bcm2835-spi"; + compatible = "brcm,bcm2711-spi", "brcm,bcm2835-spi"; reg = <0x7e204c00 0x0200>; interrupts = ; clocks = <&clocks BCM2835_CLOCK_VPU>; From patchwork Thu Jun 4 03:46:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11586879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FA9D913 for ; Thu, 4 Jun 2020 03:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 574E12074B for ; Thu, 4 Jun 2020 03:47:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B0/8qGwj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727078AbgFDDrH (ORCPT ); Wed, 3 Jun 2020 23:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727795AbgFDDrG (ORCPT ); Wed, 3 Jun 2020 23:47:06 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 339A7C08C5C0; Wed, 3 Jun 2020 20:47:05 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id b16so2718072pfi.13; Wed, 03 Jun 2020 20:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QQ6Hyh/m2EhPIKuAygxezflBAl58W/VBXN+x76AFtqs=; b=B0/8qGwjkJ+zdXPjuEpW0NvP34Qn50UqLSD1UlkyU+uP+WAYx3+tL4pgemaok2OEzk CiHrVQVPFAhZTIbUm30Wz7K2a1Tm5uzc0CnG70c9RBzjCyJjTLUInaZBkVFAADTCdxEg wuSSJWKjxXHtlRxb7F3qDu81yDJCiVqbW/B5+CZom5dIBmCSQw6nCa6YindB3CDzleh7 ufysFY89IT01nWs9e2loDh8njH2quflbkFG0ZwEH/v2Wh2ac0HK4/MM0zsigo7M/uryW wKVsoP4wsgjoIbs9n+45JNd8AyQaSqgmDd+ekrkcydGCguZbDPLW3GVY5ARUYWD+NQyv M3tA== 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:in-reply-to :references; bh=QQ6Hyh/m2EhPIKuAygxezflBAl58W/VBXN+x76AFtqs=; b=WImZ94r0Dr1eA92KWf4zxT80YwVZJJu8IQUIooaFCj6UX3sLqIP3qP5M5uoKOiOVFc Eo9X1kLYPZwieeafE6SCrYufq61OrTVMVcGz4KQtXgTTl2FBnCWS6MeERO+WergZhj/3 oeKNIra2q85cvyp1rRdscVRTZtcRWpZnMpayO7Vm4OUT7IWtPu9OfwAg5Fmkh58H8X5e sTYU2lO4QWv0hveOU9PX0tfZm14FLogVDWS2+vAV4BbM8dxlDeGlkAN5ulrXnoRnC5ar 041kTc0t/zSkKZKYzeo2y/InulzdxuqEMlD+Cx5F7ml1Q7PF4YWBzFcv8xGNlTclhZ/D v+gg== X-Gm-Message-State: AOAM533LwxRcl8/AJr3MilkWYRqoBhiIY/gD23bzLqvWEr/IETqF6hEZ ZK6OgaMZFQfFQ8cktEe+cRkgeJN7 X-Google-Smtp-Source: ABdhPJwbqlo5gRwaKOl0uPy+5X9nNBxzaPZErf6Kvavs7jP4lLEx9XgMSZvc12iLCbVBqhcgwHO+vQ== X-Received: by 2002:a62:1885:: with SMTP id 127mr2292423pfy.258.1591242424241; Wed, 03 Jun 2020 20:47:04 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p19sm3083367pff.116.2020.06.03.20.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 20:47:03 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Mark Brown , Rob Herring , Nicolas Saenz Julienne , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...), linux-spi@vger.kernel.org (open list:SPI SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), Martin Sperl , lukas@wunner.de Subject: [PATCH 3/3] spi: bcm2835: Enable shared interrupt support Date: Wed, 3 Jun 2020 20:46:55 -0700 Message-Id: <20200604034655.15930-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200604034655.15930-1-f.fainelli@gmail.com> References: <20200604034655.15930-1-f.fainelli@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The SPI controller found in the BCM2711 and BCM7211 SoCs is instantiated 5 times, with all instances sharing the same interrupt line. We specifically match the two compatible strings here to determine whether it is necessary to request the interrupt with the IRQF_SHARED flag and to use an appropriate interrupt handler capable of returning IRQ_NONE. For the BCM2835 case which is deemed performance critical, there is no overhead since a dedicated handler that does not assume sharing is used. Signed-off-by: Florian Fainelli --- drivers/spi/spi-bcm2835.c | 48 +++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 237bd306c268..2e73ec70ee80 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -361,11 +361,10 @@ static void bcm2835_spi_reset_hw(struct spi_controller *ctlr) bcm2835_wr(bs, BCM2835_SPI_DLEN, 0); } -static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) +static inline irqreturn_t bcm2835_spi_interrupt_common(struct spi_controller *ctlr, + u32 cs) { - struct spi_controller *ctlr = dev_id; struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); - u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS); /* * An interrupt is signaled either if DONE is set (TX FIFO empty) @@ -394,6 +393,27 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) +{ + struct spi_controller *ctlr = dev_id; + struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); + u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS); + + return bcm2835_spi_interrupt_common(ctlr, cs); +} + +static irqreturn_t bcm2835_spi_sh_interrupt(int irq, void *dev_id) +{ + struct spi_controller *ctlr = dev_id; + struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); + u32 cs = bcm2835_rd(bs, BCM2835_SPI_CS); + + if (!(cs & BCM2835_SPI_CS_INTR)) + return IRQ_NONE; + + return bcm2835_spi_interrupt_common(ctlr, cs); +} + static int bcm2835_spi_transfer_one_irq(struct spi_controller *ctlr, struct spi_device *spi, struct spi_transfer *tfr, @@ -1287,12 +1307,26 @@ static int bcm2835_spi_setup(struct spi_device *spi) return 0; } +static const struct of_device_id bcm2835_spi_match[] = { + { .compatible = "brcm,bcm2835-spi", .data = &bcm2835_spi_interrupt }, + { .compatible = "brcm,bcm2711-spi", .data = &bcm2835_spi_sh_interrupt }, + { .compatible = "brcm,bcm7211-spi", .data = &bcm2835_spi_sh_interrupt }, + {} +}; +MODULE_DEVICE_TABLE(of, bcm2835_spi_match); + static int bcm2835_spi_probe(struct platform_device *pdev) { + irqreturn_t (*bcm2835_spi_isr_func)(int, void *); struct spi_controller *ctlr; + unsigned long flags = 0; struct bcm2835_spi *bs; int err; + bcm2835_spi_isr_func = of_device_get_match_data(&pdev->dev); + if (bcm2835_spi_isr_func == &bcm2835_spi_sh_interrupt) + flags = IRQF_SHARED; + ctlr = spi_alloc_master(&pdev->dev, ALIGN(sizeof(*bs), dma_get_cache_alignment())); if (!ctlr) @@ -1344,7 +1378,7 @@ 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, + err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_isr_func, flags, dev_name(&pdev->dev), ctlr); if (err) { dev_err(&pdev->dev, "could not request IRQ: %d\n", err); @@ -1400,12 +1434,6 @@ static void bcm2835_spi_shutdown(struct platform_device *pdev) dev_err(&pdev->dev, "failed to shutdown\n"); } -static const struct of_device_id bcm2835_spi_match[] = { - { .compatible = "brcm,bcm2835-spi", }, - {} -}; -MODULE_DEVICE_TABLE(of, bcm2835_spi_match); - static struct platform_driver bcm2835_spi_driver = { .driver = { .name = DRV_NAME,