From patchwork Tue Mar 26 19:58:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13604936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97229C6FD1F for ; Tue, 26 Mar 2024 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SSVQR+hte9KtXBVuM0FwpuXP5Sm+0QTClwaW8wp+Ss8=; b=Vw+mjtv9WfEo7Y ZEhalLorKazpNM3eQadSjnQzXLXJU0UtwqwBOMc30FYpqkwOsyh0WmSVxKLtUo/eIOt8v3lyskpKe sMeF4RLAPNJfkibOKU1juZHEbF27JlxeHnFT7t+fUuXioilY65KitN+Yr3DbgIxKfbtfqzUQChEWp FO2tudfsE2f5VjrarUl9e+SQGQTw1RBI8C3ncluo558tmbJxgFjsqdJ5Mx05G1yk1ODapvH1J3ZyL vidMWD/KjEfnziehTgh8IapGN/H34NRXsjz8y+csqLMTnkz+MdwFGv0AUXyvPW1GbEYfkCv13qPre TRgOEyvyqar2pGtcMdKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwK-00000006Ed2-3Twn; Tue, 26 Mar 2024 19:58:32 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwC-00000006EYu-2BvZ; Tue, 26 Mar 2024 19:58:28 +0000 Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E072E0C; Tue, 26 Mar 2024 20:57:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711483067; bh=M+sikU8CAkfAMgQyqfdEXCWhXnwwdaIfoiiwHGy9YSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BkupN6YlJbApaOayA61ci01X95b6nNUw7bEmtYjIfrx8UFv23Q/6FyCR/VtccMb1x qbQgTk4ofx28PKXSemGKPcJrI5Cs4uWYLou/AhMjmB5r1EowHcoB51mVlo3YPipHIw DKKlsL4dfdmHhKU+67EZ3ASdj6OUoH9MduYF1/TI= From: Laurent Pinchart To: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Dave Stevenson , Naushir Patuck , Bartosz Golaszewski , Broadcom internal kernel review list , Conor Dooley , Florian Fainelli , Krzysztof Kozlowski , Linus Walleij , Ray Jui , Rob Herring , Scott Branden , Stefan Wahren Subject: [PATCH v2 1/3] dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Add gpio child node Date: Tue, 26 Mar 2024 21:58:05 +0200 Message-ID: <20240326195807.15163-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> References: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240326_125826_807318_3C6A66B0 X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Unlike the other child nodes of the raspberrypi,bcm2835-firmware device, the gpio child is documented in a legacy text-based binding in gpio/raspberrypi,firmware-gpio.txt. This causes DT validation failures: arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb: 'gpio' does not match any of the regexes: 'pinctrl-[0-9]+' from schema $id: http://devicetree.org/schemas/arm/bcm/raspberrypi,bcm2835-firmware.yaml# Convert the binding to YAML and move it to raspberrypi,bcm2835-firmware.yaml. Signed-off-by: Laurent Pinchart Reviewed-by: Krzysztof Kozlowski --- Changes since v1: - Add minItems for gpio-line-names --- .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 30 +++++++++++++++++++ .../gpio/raspberrypi,firmware-gpio.txt | 30 ------------------- 2 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 Documentation/devicetree/bindings/gpio/raspberrypi,firmware-gpio.txt diff --git a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml index 39e3c248f5b7..1f84407a73e4 100644 --- a/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml +++ b/Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml @@ -46,6 +46,30 @@ properties: - compatible - "#clock-cells" + gpio: + type: object + additionalProperties: false + + properties: + compatible: + const: raspberrypi,firmware-gpio + + gpio-controller: true + + "#gpio-cells": + const: 2 + description: + The first cell is the pin number, and the second cell is used to + specify the gpio polarity (GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW). + + gpio-line-names: + minItems: 8 + + required: + - compatible + - gpio-controller + - "#gpio-cells" + reset: type: object additionalProperties: false @@ -96,6 +120,12 @@ examples: #clock-cells = <1>; }; + expgpio: gpio { + compatible = "raspberrypi,firmware-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + reset: reset { compatible = "raspberrypi,firmware-reset"; #reset-cells = <1>; diff --git a/Documentation/devicetree/bindings/gpio/raspberrypi,firmware-gpio.txt b/Documentation/devicetree/bindings/gpio/raspberrypi,firmware-gpio.txt deleted file mode 100644 index ce97265e23ba..000000000000 --- a/Documentation/devicetree/bindings/gpio/raspberrypi,firmware-gpio.txt +++ /dev/null @@ -1,30 +0,0 @@ -Raspberry Pi GPIO expander - -The Raspberry Pi 3 GPIO expander is controlled by the VC4 firmware. The -firmware exposes a mailbox interface that allows the ARM core to control the -GPIO lines on the expander. - -The Raspberry Pi GPIO expander node must be a child node of the Raspberry Pi -firmware node. - -Required properties: - -- compatible : Should be "raspberrypi,firmware-gpio" -- gpio-controller : Marks the device node as a gpio controller -- #gpio-cells : Should be two. The first cell is the pin number, and - the second cell is used to specify the gpio polarity: - 0 = active high - 1 = active low - -Example: - -firmware: firmware-rpi { - compatible = "raspberrypi,bcm2835-firmware"; - mboxes = <&mailbox>; - - expgpio: gpio { - compatible = "raspberrypi,firmware-gpio"; - gpio-controller; - #gpio-cells = <2>; - }; -}; From patchwork Tue Mar 26 19:58:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13604937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EE01C6FD1F for ; Tue, 26 Mar 2024 19:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wc/FdC5qch0m/SEIno4u4AJXQNjKJf7mNWHqVwoi0Do=; b=ITX5pNrLpyG3yY n045rt6jWajJ0RLRia2kaEA8YCBcDqdtiPUh9iadpiOvUVliMQJVFLmKMe96abp2vUh7uLwCVJKP1 IbL6HF9UGBDtXNNCx9bQo+mhjg0WHS5Rq06bBgFy7MlpjRvDsVVktivzaSWpKL9n26mP4DK+zgXWn F8vzrG8sTjmz3lAg58wZjInXEioCzCG8g7yJbU+kIMtL55MfKCBYtsNBw07fS1uaiwhq3nliXxP6B p1248g2p3Ekz0km7+7Mfi6clhRzXLAaPvUAgkLkpsByXbrb5UnkSm9o6qXasw9wX9Bjv2fxeGcDcu ldqhcP+zzDJFzjPb+4Qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwY-00000006Eh3-0wpd; Tue, 26 Mar 2024 19:58:46 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwC-00000006EZ8-2Br8; Tue, 26 Mar 2024 19:58:30 +0000 Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 886A81211; Tue, 26 Mar 2024 20:57:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711483069; bh=NOOXMotqlANDklHCIQd9xpIBR4UrQSUA1aIhSFEYwl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEFgeM1SjYUBwFoJdV8tdgMy4rceDRa5Wtm94TukJo0JhVLwiwq3XVcoPb8RM0cwF pEng6rZl9mmvh9KHXFzbn13fUylazlM+0fHHW2Nss3YSnfJkLzCeoZgqXAUrk9v/iO lWLasM4EAEWwl9gGGpIqsbwL+RXEaedXbwi4g0TI= From: Laurent Pinchart To: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Dave Stevenson , Naushir Patuck , Broadcom internal kernel review list , Conor Dooley , Florian Fainelli , Krzysztof Kozlowski , Nicolas Saenz Julienne , Ray Jui , Rob Herring , Scott Branden , Stefan Wahren Subject: [PATCH v2 2/3] firmware: raspberrypi: Use correct device for DMA mappings Date: Tue, 26 Mar 2024 21:58:06 +0200 Message-ID: <20240326195807.15163-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> References: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240326_125826_855294_7944EB16 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The buffer used to transfer data over the mailbox interface is mapped using the client's device. This is incorrect, as the device performing the DMA transfer is the mailbox itself. Fix it by using the mailbox controller device instead. This requires including the mailbox_controller.h header to dereference the mbox_chan and mbox_controller structures. The header is not meant to be included by clients. This could be fixed by extending the client API with a function to access the controller's device. Fixes: 4e3d60656a72 ("ARM: bcm2835: Add the Raspberry Pi firmware driver") Signed-off-by: Laurent Pinchart --- drivers/firmware/raspberrypi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 322aada20f74..ac34876a97f8 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -97,8 +98,8 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, if (size & 3) return -EINVAL; - buf = dma_alloc_coherent(fw->cl.dev, PAGE_ALIGN(size), &bus_addr, - GFP_ATOMIC); + buf = dma_alloc_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), + &bus_addr, GFP_ATOMIC); if (!buf) return -ENOMEM; @@ -126,7 +127,7 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, ret = -EINVAL; } - dma_free_coherent(fw->cl.dev, PAGE_ALIGN(size), buf, bus_addr); + dma_free_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), buf, bus_addr); return ret; } From patchwork Tue Mar 26 19:58:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13604938 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71501C54E67 for ; Tue, 26 Mar 2024 19:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/WmrUk+ViowqRfT3TRS0xtJKyMtFx6AEdbdNj6jKENs=; b=HOjMtkr3ME/Lyk 8dVdjMhFF7k5nA5wLR+aVgWGzjpR18U08s+BuQv4e1Vou0WCBcXXO30YqWszOk7KwFBqLPLEb5HKN jRmUxeHwZD7fSafzmQ16QdKZ7AYaCNyiof+MF/myVuxoec3jDQrlbhC/7tUmpMUNy8fWEBmNBGa7e pxweAe5eGtpUkfvkZm25+VwJnP5JB+pbgFT+03K/yH+8vdnZlo064Sgn2m/1ULyBEjXU8rnQp3GOh t+WLnT+11TzI3FIX07+9iw7SGNuRYvEwS23+3Jd7Pl25pDtGz87uyt66WuxwfV+b5Mv8O4njTgqEC IiQsBMLXmZf5lA9J/UNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwl-00000006Eo4-29i6; Tue, 26 Mar 2024 19:58:59 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpCwC-00000006EZG-2uiI; Tue, 26 Mar 2024 19:58:30 +0000 Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B996B1815; Tue, 26 Mar 2024 20:57:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711483071; bh=xCYO00GEeHZ0vGGTmeWkp874jMs5RtNQgkYQEldVLlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttpc+UvrM33y4lluL0FUDhPTYjb7/nW/T2Ao0Uexem0rXxJu0ZICFI9CZJuuLu1Oj H6k3GCLbK6TKIALcyyFPPviVhyLWTdJ0+A/cKJfRxVysqq1+IRF6DiYhWbw/AJS7ww JArVW6tS5P7YrcpBOXSvnhSxNEOJ41UYrJVK9YjE= From: Laurent Pinchart To: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Dave Stevenson , Naushir Patuck , Broadcom internal kernel review list , Conor Dooley , Florian Fainelli , Krzysztof Kozlowski , Nicolas Saenz Julienne , Ray Jui , Rob Herring , Scott Branden , Stefan Wahren Subject: [PATCH v2 3/3] ARM: dts: bcm283x: Drop unneeded properties in the bcm2835-firmware node Date: Tue, 26 Mar 2024 21:58:07 +0200 Message-ID: <20240326195807.15163-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> References: <20240326195807.15163-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240326_125826_868977_4DDC812A X-CRM114-Status: GOOD ( 10.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The firmware node contains a "dma-ranges" property to enable usage of the DMA mapping API with its child devices, along with "#address-cells" and "#size-cells" properties to support the dma-ranges. This was needed due to usage of the incorrect device to perform the DMA mapping in drivers. Now that this has been fixed, drop the properties. This effectively reverts commits be08d278eb09 ("ARM: dts: bcm283x: Add cells encoding format to firmware bus") and 55c7c0621078 ("ARM: dts: bcm283x: Fix vc4's firmware bus DMA limitations"). Signed-off-by: Laurent Pinchart --- arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi b/arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi index f0acc9390f31..761a9da97bd0 100644 --- a/arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi +++ b/arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi @@ -4,11 +4,7 @@ / { soc { firmware: firmware { compatible = "raspberrypi,bcm2835-firmware", "simple-mfd"; - #address-cells = <1>; - #size-cells = <1>; - mboxes = <&mailbox>; - dma-ranges; }; power: power {