From patchwork Tue Feb 27 00:44:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 13573024 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 BDD92C48BF6 for ; Tue, 27 Feb 2024 00:44:47 +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: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:In-Reply-To:References: List-Owner; bh=zZFLZ03dhzp/UC/sKmX2CLtio3W8h0hHtW9JfVOVni0=; b=fdC4DZxHRy8oVK KTmx4PBMm4R8n0fwWfsxS/qWQVd6CgF6J1DOHe9sr9T0HASCLBaSNcvroaOarzE2Fn2tQXC81FxaI uLj+Ls6ev1aubXndIyBkQ5ypq4sQp4KpHlTOkPvFQYlwc6tbe3c1vJaET3wcSJuN3xRLQadS1CndL Y+mG7T+y0cx+GBhwf6G31YQaHU08zaNM3cL86xbbdBjimf2m/0K/P9dVskgJy1DZUgFRZxya1Cb0u qmLaJpPOYXP2efG4w0fPjqfPzx69JgP/6BUz5CUxCttymzFGBBm3AmRKeGpH5aYmevBuKFG3umYNt vWL2k9DoWq5ZVr8uj4SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1relaC-000000038dL-3nV0; Tue, 27 Feb 2024 00:44:32 +0000 Received: from pi.codeconstruct.com.au ([203.29.241.158] helo=codeconstruct.com.au) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rela9-000000038ca-0R3S for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 00:44:30 +0000 Received: from localhost.localdomain (unknown [120.20.22.137]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id 086E520127; Tue, 27 Feb 2024 08:44:21 +0800 (AWST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1708994665; bh=Ca/9sKvjcNdwT2jNocS9+Pqis6uqPGYxjdQcRGzr4PM=; h=From:To:Cc:Subject:Date; b=D5Y1UnlAi2V621CUNK7697LYH4CARfNwf1mia/d0VwmEYUKErtNJblhxT5Fi9ojaI jNacK8lV13+I3mbFr0tFuVes8884k4sEq5AY10/KmUVFLY9GASJO7jgyKIyinB5Vgk 4zniK4LqOHZ0G6J8vVySYfCxtdpfa0058pA+BlREUrjs9+/pD3iO7w5H/zanD3D4sf xdLrfNKv9vrtps6bughv26Tq3/HDB6AUzUcBmtA8fXI694874WepNXYGFnaXho1UiT iwD3tDXQ3cREJYa/yhB7iasrOjogEG3O1E2r8yhXSGIRX1fbpb1W1EvrSLFTXQ12Cg osFEgKVS3+wtw== From: Andrew Jeffery To: linus.walleij@linaro.org, brgl@bgdev.pl, krzysztof.kozlowski+dt@linaro.org Cc: Andrew Jeffery , robh+dt@kernel.org, conor+dt@kernel.org, joel@jms.id.au, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] dt-bindings: gpio: aspeed,ast2400-gpio: Convert to DT schema Date: Tue, 27 Feb 2024 11:14:14 +1030 Message-Id: <20240227004414.841391-1-andrew@codeconstruct.com.au> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_164429_581377_D0BAAEFB X-CRM114-Status: GOOD ( 17.84 ) 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 Squash warnings such as: ``` arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-galaxy100.dtb: /ahb/apb@1e600000/gpio@1e780000: failed to match any schema with compatible: ['aspeed,ast2400-gpio'] ``` Signed-off-by: Andrew Jeffery --- v4: Add constraints for gpio-line-names, ngpios as requested by Krzysztof: https://lore.kernel.org/all/458becdb-fb1e-4808-87b6-3037ec945647@linaro.org/ Add more examples to exercise constraints. v3: https://lore.kernel.org/all/20240226051645.414935-1-andrew@codeconstruct.com.au/ Base on v6.8-rc6, fix yamllint warning Rob's bot picked the missing `#interrupt-cells` in the example on v2[1]. The patch was based on v6.8-rc1, and going back over my shell history I missed the following output from `make dt_binding_check`: ``` ... LINT Documentation/devicetree/bindings usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...] yamllint: error: one of the arguments FILE_OR_DIR - is required ... ``` I've rebased on v6.8-rc6 and no-longer see the issue with the invocation of `yamllint`. [1]: https://lore.kernel.org/all/170892197611.2260479.15343562563553959436.robh@kernel.org/ v2: https://lore.kernel.org/all/20240226031951.284847-1-andrew@codeconstruct.com.au/ Address feedback from Krzysztof: https://lore.kernel.org/all/0d1dd262-b6dd-4d71-9239-8b0aec8cceff@linaro.org/ v1: https://lore.kernel.org/all/20240220052918.742793-1-andrew@codeconstruct.com.au/ .../bindings/gpio/aspeed,ast2400-gpio.yaml | 149 ++++++++++++++++++ .../devicetree/bindings/gpio/gpio-aspeed.txt | 39 ----- 2 files changed, 149 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-aspeed.txt base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b diff --git a/Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml b/Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml new file mode 100644 index 000000000000..25f938b442e1 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/aspeed,ast2400-gpio.yaml @@ -0,0 +1,149 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/aspeed,ast2400-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Aspeed GPIO controller + +maintainers: + - Andrew Jeffery + +properties: + compatible: + enum: + - aspeed,ast2400-gpio + - aspeed,ast2500-gpio + - aspeed,ast2600-gpio + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + description: The clock to use for debounce timings + + gpio-controller: true + gpio-line-names: true + gpio-ranges: true + + "#gpio-cells": + const: 2 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + + ngpios: true + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#interrupt-cells" + - gpio-controller + - "#gpio-cells" + +allOf: + - if: + properties: + compatible: + contains: + const: aspeed,ast2400-gpio + then: + properties: + gpio-line-names: + minItems: 220 + maxItems: 220 + ngpios: + const: 220 + - if: + properties: + compatible: + contains: + const: aspeed,ast2500-gpio + then: + properties: + gpio-line-names: + minItems: 232 + maxItems: 232 + ngpios: + const: 232 + - if: + properties: + compatible: + contains: + const: aspeed,ast2600-gpio + then: + properties: + gpio-line-names: + minItems: 36 + maxItems: 208 + ngpios: + enum: [ 36, 208 ] + required: + - ngpios + +additionalProperties: false + +examples: + - | + gpio@1e780000 { + compatible = "aspeed,ast2400-gpio"; + reg = <0x1e780000 0x1000>; + interrupts = <20>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + - | + #include + gpio: gpio@1e780000 { + compatible = "aspeed,ast2500-gpio"; + reg = <0x1e780000 0x200>; + clocks = <&syscon ASPEED_CLK_APB>; + interrupts = <20>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl 0 0 232>; + }; + - | + #include + #include + #include + gpio0: gpio@1e780000 { + compatible = "aspeed,ast2600-gpio"; + reg = <0x1e780000 0x400>; + clocks = <&syscon ASPEED_CLK_APB2>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <2>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pinctrl 0 0 208>; + ngpios = <208>; + }; + - | + #include + #include + #include + gpio1: gpio@1e780800 { + compatible = "aspeed,ast2600-gpio"; + reg = <0x1e780800 0x800>; + clocks = <&syscon ASPEED_CLK_APB1>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl 0 208 36>; + ngpios = <36>; + }; diff --git a/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt b/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt deleted file mode 100644 index b2033fc3a71a..000000000000 --- a/Documentation/devicetree/bindings/gpio/gpio-aspeed.txt +++ /dev/null @@ -1,39 +0,0 @@ -Aspeed GPIO controller Device Tree Bindings -------------------------------------------- - -Required properties: -- compatible : Either "aspeed,ast2400-gpio", "aspeed,ast2500-gpio", - or "aspeed,ast2600-gpio". - -- #gpio-cells : Should be two - - First cell is the GPIO line number - - Second cell is used to specify optional - parameters (unused) - -- reg : Address and length of the register set for the device -- gpio-controller : Marks the device node as a GPIO controller. -- interrupts : Interrupt specifier (see interrupt bindings for - details) -- interrupt-controller : Mark the GPIO controller as an interrupt-controller - -Optional properties: - -- clocks : A phandle to the clock to use for debounce timings -- ngpios : Number of GPIOs controlled by this controller. Should be set - when there are multiple GPIO controllers on a SoC (ast2600). - -The gpio and interrupt properties are further described in their respective -bindings documentation: - -- Documentation/devicetree/bindings/gpio/gpio.txt -- Documentation/devicetree/bindings/interrupt-controller/interrupts.txt - - Example: - gpio@1e780000 { - #gpio-cells = <2>; - compatible = "aspeed,ast2400-gpio"; - gpio-controller; - interrupts = <20>; - reg = <0x1e780000 0x1000>; - interrupt-controller; - };