Message ID | 20231002021602.260100-5-takahiro.akashi@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1220985vqb; Sun, 1 Oct 2023 23:06:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKcOa1S1aSe7QIWTUPI06CN4zSFJ6fQBjxskhv6pJPsZ0Hw9WmaFwz29LaQgF7e/iRS7sQ X-Received: by 2002:a17:90b:f85:b0:279:1035:4443 with SMTP id ft5-20020a17090b0f8500b0027910354443mr8796461pjb.8.1696226805976; Sun, 01 Oct 2023 23:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696226805; cv=none; d=google.com; s=arc-20160816; b=C3BETbbX4+/+efWS5sANfxryFvkZjgij9rNyFQCAcX83DhKaMBffLbqpULdfm42zpQ cdS6hgiX+qF3eaoG448nJ2xYh5h4/llRFRlSh80pg7llwEMm8T7oYJsfPVbaGQonTmAW 4X3oNZCywW5eHibWJYpQPvnIkamXLRN22cQkFenoXI5TThSRLf0WKe9hjijshHIB0QoF X85sNZiBEZgBBS7BB88zump2fn/qtQWc/8so5cLCarlKwxuEjc+SA4HVnSkTmOPl92N+ QW+5jDH1uX0VXNX19eELPeMR64qj5LEZ03gPRRBwmeOl+IiR5dpzi3YB+2BJ+FC/y+g6 IqGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RPOWcZHTqmoq/zqsh7e1DQOIHdOfQaJNQbue+Ak7Pz4=; fh=5LIWo2D/PeZk6SC/rjjkha3vijtdzmZAJYKHEnFRQDY=; b=GBfwVWTFyDvixLtLgTjSvgzJD0iw2oO0w+y8wwR34gbFyfyMYcFyrPdNLN7zAfq+zo SsqkSE8jK6dw4YFcFRAt0VWXX4Dsd5j82n3iYCpC/YoOMdScGHrZQwlJZjpTQ57iaFKt zEMqktbppUUY4FnM74c0EnE4Xy9fWEzaZ87JMj+3pWB6kkZHRL2vMuG+YCEG5PKaU+dH 0ozoymod6YT1HOQToe0F5xleU7rQfxC9FJ76Fy/HhTMIK9W/h2mtkHINkJD2EGy7O3zu thM6XaltZ2N5xnp2RCp1bRb82xw9x28HYgSBF23Rz1NsvrqUG+sUzVwVKTjcQOgA33fy FsIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSI3n4hZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h24-20020a17090acf1800b002791a73ab07si6594816pju.54.2023.10.01.23.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 23:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSI3n4hZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0F8498073DCD; Sun, 1 Oct 2023 19:17:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235435AbjJBCRm (ORCPT <rfc822;pwkd43@gmail.com> + 17 others); Sun, 1 Oct 2023 22:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235404AbjJBCRg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 1 Oct 2023 22:17:36 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A08711F for <linux-kernel@vger.kernel.org>; Sun, 1 Oct 2023 19:17:31 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1dd4115b369so1159517fac.1 for <linux-kernel@vger.kernel.org>; Sun, 01 Oct 2023 19:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696213050; x=1696817850; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RPOWcZHTqmoq/zqsh7e1DQOIHdOfQaJNQbue+Ak7Pz4=; b=gSI3n4hZCnR9n2j5PCWBmvhDXs4AUWsWvoh+NFIyVSdyWn1CQLufb7Rd9JG1h1mffj J1HrBFw5yWvDEn+t8ZKM/g78GpVgJtwvA6zYkMSbl4S3LFyy0XCictm/a/Xk+ig92LHV sDuzkGd//PF1LaQcJ5Qgh6JbQ6/YowtyviSoYZ4d5WxdykHdH/bQ045ABHKs+EijAlZU Mo++6IJxtxfSndNy8HYj70ca0Fpwvco6fkk9YWieSMfTy0HA0vQY4iC767+Gq9GyyOyu HoZGz6NwAodBGZSF9KnfwH8iTtb7EsCaCKEZwEy/GEFumuEMtw8tUyXkPwVyWXz+LsVT 5iWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696213050; x=1696817850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RPOWcZHTqmoq/zqsh7e1DQOIHdOfQaJNQbue+Ak7Pz4=; b=Ait2dkGxRAQ5pRGU+Yzii67yZpAhvCzBg+Cxn4n+P9w9Xqv5odjmYLv84PxD5udPzY mVFGWnL/PrVGjlrpjvdYel9Tj11PKzjj2X+glczpcLT/V5aTgqqXkyKaMBRPHSkm90Pb iJ4lPbWhDL6O8hHwOkTabeHSjACfHkefgflrxK5+R/eYHWpZI/1Wg4oRH9RC1IoXm+9C HSokPKk8fAuLkPy141NEOSZcwyk0uBzxz/tBbbZas5ewPXp37V6MV159BgcctAZe1UpA 3OmvUu4Jc9UN89HmPid3Se22c2qUke1AZJv5dv4UuNIwbkjkel3d+ArTWkIhGphtdUrp h38Q== X-Gm-Message-State: AOJu0YxbhDeLFLNNmFxolxgEjOOQVdjv4Tdl6bZf5ObFTr1iTypblgRS qR0QvJ0LXL5bIBZx3R9W2Z4goCprfxpupaGCP7ypcw== X-Received: by 2002:a05:6808:2123:b0:3a9:f25d:d917 with SMTP id r35-20020a056808212300b003a9f25dd917mr13656079oiw.4.1696213049725; Sun, 01 Oct 2023 19:17:29 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:7ab1:199:d138:f054]) by smtp.gmail.com with ESMTPSA id mg11-20020a17090b370b00b002609cadc56esm5278319pjb.11.2023.10.01.19.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 19:17:29 -0700 (PDT) From: AKASHI Takahiro <takahiro.akashi@linaro.org> To: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linus.walleij@linaro.org Cc: Oleksii_Moisieiev@epam.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, AKASHI Takahiro <takahiro.akashi@linaro.org> Subject: [RFC 4/4] dt-bindings: gpio: Add bindings for SCMI pinctrl based gpio Date: Mon, 2 Oct 2023 11:16:02 +0900 Message-Id: <20231002021602.260100-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002021602.260100-1-takahiro.akashi@linaro.org> References: <20231002021602.260100-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 01 Oct 2023 19:17:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778612628558000011 X-GMAIL-MSGID: 1778622719329393735 |
Series |
gpio: add SCMI pinctrl based driver
|
|
Commit Message
Takahiro Akashi
Oct. 2, 2023, 2:16 a.m. UTC
A dt binding for SCMI pinctrl based gpio driver is defined in this
commit. It basically conforms to generic pinctrl-gpio mapping framework.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
.../bindings/gpio/arm,scmi-gpio.yaml | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml
Comments
On Mon, Oct 02, 2023 at 11:16:02AM +0900, AKASHI Takahiro wrote: > A dt binding for SCMI pinctrl based gpio driver is defined in this > commit. It basically conforms to generic pinctrl-gpio mapping framework. What is "generic pinctrl-gpio mapping framework"? DT doesn't have frameworks. > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> > --- > .../bindings/gpio/arm,scmi-gpio.yaml | 71 +++++++++++++++++++ > 1 file changed, 71 insertions(+) > create mode 100644 Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > > diff --git a/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > new file mode 100644 > index 000000000000..2601c5594567 > --- /dev/null > +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > @@ -0,0 +1,71 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: SCMI pinctrl based generic GPIO controller > + > +maintainers: > + - AKASHI Takahiro <akashi.takahiro@linaro.org> > + > +properties: > + $nodename: > + pattern: "^scmi_gpio(@[0-9a-f]+)$" Not the correct name. > + > + compatible: > + const: arm,scmi-gpio-generic What makes it generic? No such thing. Just drop '-generic'. > + > + gpio-controller: true > + > + "#gpio-cells": > + const: 2 > + > + gpio-ranges: true > + > + gpio-ranges-group-names: true > + > +patternProperties: > + "^.+-hog(-[0-9]+)?$": > + type: object > + properties: > + gpio-hog: true > + gpios: true > + input: true > + output-high: true > + output-low: true > + line-name: true > + > + required: > + - gpio-hog > + - gpios You don't need all this just 'required: [ gpio-hog ]'. Then the hog schema will check the rest. > + > + additionalProperties: false > + > +required: > + - compatible > + - gpio-controller > + - "#gpio-cells" > + - gpio-ranges > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/gpio/gpio.h> > + > + scmi_gpio_0: scmi_gpio@0 { gpio { But doesn't SCMI have protocol numbers? > + compatible = "arm,scmi-gpio"; > + gpio-controller; > + #gpio-cells = <2>; > + gpio-ranges = <&scmi_pinctrl 0 10 5>, > + <&scmi_pinctrl 5 0 0>; > + gpio-ranges-group-names = "", > + "pinmux_gpio"; > + }; > + > + // Consumer: Outside the scope of this binding. Drop this node. > + sdhci0_pwrseq { > + compatible = "mmc-pwrseq-emmc"; > + reset-gpios = <&scmi_gpio_0 0 GPIO_ACTIVE_LOW>; > + }; > -- > 2.34.1 >
On Mon, Oct 02, 2023 at 09:41:55AM -0500, Rob Herring wrote: > On Mon, Oct 02, 2023 at 11:16:02AM +0900, AKASHI Takahiro wrote: > > A dt binding for SCMI pinctrl based gpio driver is defined in this > > commit. It basically conforms to generic pinctrl-gpio mapping framework. [ snip] > > + additionalProperties: false > > + > > +required: > > + - compatible > > + - gpio-controller > > + - "#gpio-cells" > > + - gpio-ranges > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include <dt-bindings/gpio/gpio.h> > > + > > + scmi_gpio_0: scmi_gpio@0 { > > gpio { > > But doesn't SCMI have protocol numbers? > My understanding is that this RFC GPIO driver from Akashi is built completely on Pinctrl facilities (as he says in the cover), it is not indeed a typical pure SCMI driver, it just happen to trigger the use of SCMI if the underlying backend pinctrl driver is pinctrl-scmi; but this driver does not really call directly into any SCMI API by itself, i.e. it does not get and call any SCMI protocol ops. (but it could indeed trigger the backend Pinctrl SCMI driver to issue such call on its behalf AFAIU...) I wonder why it has even a dependency on PINCTRL_SCMI at this point; is not that it could work (generically) even if the backend Pinctrl driver is NOT SCMI ? What makes it usable only against an SCMI Pinctrl backend ? Cannot be a generic GPIO driver based on top of Pinctrl, no matter which Pinctrl backend driver has been configured ? ...I maybe missing something here about Pinctrl AND GPIO frameworks :P Thanks, Cristian
Hi Rob, On Mon, Oct 02, 2023 at 09:41:55AM -0500, Rob Herring wrote: > On Mon, Oct 02, 2023 at 11:16:02AM +0900, AKASHI Takahiro wrote: > > A dt binding for SCMI pinctrl based gpio driver is defined in this > > commit. It basically conforms to generic pinctrl-gpio mapping framework. > > What is "generic pinctrl-gpio mapping framework"? DT doesn't have > frameworks. I meant to refer to section 2.1-2.3 in "Documentation/devicetree/bindings/gpio/gpio.txt". The semantics is implemented in drivers/gpio/gpiolib(-of).c. > > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> > > --- > > .../bindings/gpio/arm,scmi-gpio.yaml | 71 +++++++++++++++++++ > > 1 file changed, 71 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > > > > diff --git a/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > > new file mode 100644 > > index 000000000000..2601c5594567 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > > @@ -0,0 +1,71 @@ > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: SCMI pinctrl based generic GPIO controller > > + > > +maintainers: > > + - AKASHI Takahiro <akashi.takahiro@linaro.org> > > + > > +properties: > > + $nodename: > > + pattern: "^scmi_gpio(@[0-9a-f]+)$" > > Not the correct name. How not? > > + > > + compatible: > > + const: arm,scmi-gpio-generic > > What makes it generic? No such thing. Just drop '-generic'. I will discuss this issue in following Cristian's comment. > > > + > > + gpio-controller: true > > + > > + "#gpio-cells": > > + const: 2 > > + > > + gpio-ranges: true > > + > > + gpio-ranges-group-names: true > > + > > +patternProperties: > > + "^.+-hog(-[0-9]+)?$": > > + type: object > > + properties: > > + gpio-hog: true > > + gpios: true > > + input: true > > + output-high: true > > + output-low: true > > + line-name: true > > + > > + required: > > + - gpio-hog > > + - gpios > > You don't need all this just 'required: [ gpio-hog ]'. Then the hog > schema will check the rest. Okay. > > + > > + additionalProperties: false > > + > > +required: > > + - compatible > > + - gpio-controller > > + - "#gpio-cells" > > + - gpio-ranges > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > + #include <dt-bindings/gpio/gpio.h> > > + > > + scmi_gpio_0: scmi_gpio@0 { > > gpio { > > But doesn't SCMI have protocol numbers? > > > + compatible = "arm,scmi-gpio"; > > + gpio-controller; > > + #gpio-cells = <2>; > > + gpio-ranges = <&scmi_pinctrl 0 10 5>, > > + <&scmi_pinctrl 5 0 0>; > > + gpio-ranges-group-names = "", > > + "pinmux_gpio"; > > + }; > > + > > + // Consumer: > > Outside the scope of this binding. Drop this node. Even though it's in an example? "#gpio-cells" has a meaning in consumer side. -Takahiro Akashi > > + sdhci0_pwrseq { > > + compatible = "mmc-pwrseq-emmc"; > > + reset-gpios = <&scmi_gpio_0 0 GPIO_ACTIVE_LOW>; > > + }; > > -- > > 2.34.1 > >
Hi Rob, Cristian, On Mon, Oct 02, 2023 at 03:58:27PM +0100, Cristian Marussi wrote: > On Mon, Oct 02, 2023 at 09:41:55AM -0500, Rob Herring wrote: > > On Mon, Oct 02, 2023 at 11:16:02AM +0900, AKASHI Takahiro wrote: > > > A dt binding for SCMI pinctrl based gpio driver is defined in this > > > commit. It basically conforms to generic pinctrl-gpio mapping framework. > > [ snip] > > > > + additionalProperties: false > > > + > > > +required: > > > + - compatible > > > + - gpio-controller > > > + - "#gpio-cells" > > > + - gpio-ranges > > > + > > > +additionalProperties: false > > > + > > > +examples: > > > + - | > > > + #include <dt-bindings/gpio/gpio.h> > > > + > > > + scmi_gpio_0: scmi_gpio@0 { > > > > gpio { > > > > But doesn't SCMI have protocol numbers? > > > > My understanding is that this RFC GPIO driver from Akashi is built > completely on Pinctrl facilities (as he says in the cover), it is not > indeed a typical pure SCMI driver, it just happen to trigger the use > of SCMI if the underlying backend pinctrl driver is pinctrl-scmi; > but this driver does not really call directly into any SCMI API by > itself, i.e. it does not get and call any SCMI protocol ops. > (but it could indeed trigger the backend Pinctrl SCMI driver to issue > such call on its behalf AFAIU...) It would be possible to implement this driver by directly using SCMI pinctrl interfaces (I mean drivers/firmware/arm,scmi/pinctrl.c) if the system wants to utilize SCMI solely for GPIO accesses and doesn't need pinctrl support. (Even so, "protocol@19" will be required due to the current SCMI binding.) But I didn't take this approach because the kernel's pinctrl framework (and many existing pinctrl drivers) instead adopts standard pinctrl- gpio mapping (I mean gpiolib(-of).c) and it just seems to work well. > I wonder why it has even a dependency on PINCTRL_SCMI at this point; > is not that it could work (generically) even if the backend Pinctrl > driver is NOT SCMI ? > What makes it usable only against an SCMI Pinctrl backend ? > Cannot be a generic GPIO driver based on top of Pinctrl, no matter which > Pinctrl backend driver has been configured ? That is one of my questions (See the issue (3) in my cover letter.) Why doesn't there exist a generic GPIO driver of this kind (based on gpiolib framework) even though it could apparently be possible? I guess that there a couple of reasons: 1) As I mentioned in the issue (1) in my cover letter, the current framework doesn't present an interface, especially for obtaining a value on a gpio input pin. Then it enforces each pinctrl-based gpio driver needs to have its own driver. 2) Furthermore, there may be driver-specific semantics required, say, for pinconf-related configurations? (I don't come up with any example, though) If my driver is good enough for applying to other gpio controllers as well, I would not hesitate to name it a genuine generic driver whether the backend may be SCMI or not. -> Linus, comment here please. Due to possible cases of (2), I still added "-generic" postfix to the "compatibles" property so that other variant drivers may be tagged as "arm,scmi-gpio-some-system" or "some-vendor,scmi-gpio". Thanks, -Takahiro Akashi > > ...I maybe missing something here about Pinctrl AND GPIO frameworks :P > > Thanks, > Cristian
On 03/10/2023 02:41, AKASHI Takahiro wrote: > Hi Rob, > > On Mon, Oct 02, 2023 at 09:41:55AM -0500, Rob Herring wrote: >> On Mon, Oct 02, 2023 at 11:16:02AM +0900, AKASHI Takahiro wrote: >>> A dt binding for SCMI pinctrl based gpio driver is defined in this >>> commit. It basically conforms to generic pinctrl-gpio mapping framework. >> >> What is "generic pinctrl-gpio mapping framework"? DT doesn't have >> frameworks. > > I meant to refer to section 2.1-2.3 in "Documentation/devicetree/bindings/gpio/gpio.txt". The semantics is implemented in drivers/gpio/gpiolib(-of).c. Linux specific GPIO library is as well outside of DT scope. Please focus here on hardware, not Linux specifics. > >>> >>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> >>> --- >>> .../bindings/gpio/arm,scmi-gpio.yaml | 71 +++++++++++++++++++ >>> 1 file changed, 71 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml >>> new file mode 100644 >>> index 000000000000..2601c5594567 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml >>> @@ -0,0 +1,71 @@ >>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause >>> +%YAML 1.2 >>> +--- >>> +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: SCMI pinctrl based generic GPIO controller >>> + >>> +maintainers: >>> + - AKASHI Takahiro <akashi.takahiro@linaro.org> >>> + >>> +properties: >>> + $nodename: >>> + pattern: "^scmi_gpio(@[0-9a-f]+)$" >> >> Not the correct name. > > How not? Underscores are no allowed and are pointed by dtc (W=2). scmi is redundant here, because names should be generic. Anyway, we do not add node name requirements to device schema. > >>> + >>> + compatible: >>> + const: arm,scmi-gpio-generic >> >> What makes it generic? No such thing. Just drop '-generic'. > > I will discuss this issue in following Cristian's comment. > >> >>> + >>> + gpio-controller: true >>> + >>> + "#gpio-cells": >>> + const: 2 >>> + >>> + gpio-ranges: true >>> + >>> + gpio-ranges-group-names: true >>> + >>> +patternProperties: >>> + "^.+-hog(-[0-9]+)?$": >>> + type: object >>> + properties: >>> + gpio-hog: true >>> + gpios: true >>> + input: true >>> + output-high: true >>> + output-low: true >>> + line-name: true >>> + >>> + required: >>> + - gpio-hog >>> + - gpios >> >> You don't need all this just 'required: [ gpio-hog ]'. Then the hog >> schema will check the rest. > > Okay. > >>> + >>> + additionalProperties: false >>> + >>> +required: >>> + - compatible >>> + - gpio-controller >>> + - "#gpio-cells" >>> + - gpio-ranges >>> + >>> +additionalProperties: false >>> + >>> +examples: >>> + - | >>> + #include <dt-bindings/gpio/gpio.h> >>> + >>> + scmi_gpio_0: scmi_gpio@0 { >> >> gpio { >> >> But doesn't SCMI have protocol numbers? >> >>> + compatible = "arm,scmi-gpio"; >>> + gpio-controller; >>> + #gpio-cells = <2>; >>> + gpio-ranges = <&scmi_pinctrl 0 10 5>, >>> + <&scmi_pinctrl 5 0 0>; >>> + gpio-ranges-group-names = "", >>> + "pinmux_gpio"; >>> + }; >>> + >>> + // Consumer: >> >> Outside the scope of this binding. Drop this node. > > Even though it's in an example? > "#gpio-cells" has a meaning in consumer side. Just look at any other bindings. Best regards, Krzysztof
Hi Takahiro, first, thanks for working on this important and crucial driver! I'll try to clarify and also explain something of what the others are saying (unless I misunderstand them...) On Mon, Oct 2, 2023 at 4:17 AM AKASHI Takahiro <takahiro.akashi@linaro.org> wrote: > A dt binding for SCMI pinctrl based gpio driver is defined in this > commit. It basically conforms to generic pinctrl-gpio mapping framework. > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> I think like Christian says that SCMI maybe has nothing to do with this binding? It is just one possible use case (though we don't know of any others.) The resource it is using is generic functionality that exist in any pin controller that provides ways to drive lines high and low etc. Would it be named a generic pin control-based GPIO? (...) > +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml (...) > +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# So no ARM, no scmi, just pin-control-gpio.yaml, be bold! (I like this long unabbreviated name) > +title: SCMI pinctrl based generic GPIO controller Pin control-based generic GPIO controller Add description: The pin control-based GPIO will facilitate a pin controllers ability to drive electric lines high/low and other generic properties of a pin controller to perform general-purpose one-bit binary I/O. (At least I think this is the idea, I hope I understand correctly.) > +properties: > + $nodename: > + pattern: "^scmi_gpio(@[0-9a-f]+)$" These nodes are always just named gpio@... the resource marker is "this is a GPIO" that's all it means. > + compatible: > + const: arm,scmi-gpio-generic const: pin-control-gpio Other than that I am aboard with the solution! Yours, Linus Walleij
On Tue, Oct 03, 2023 at 03:16:49PM +0200, Linus Walleij wrote: > Hi Takahiro, > > first, thanks for working on this important and crucial driver! > > I'll try to clarify and also explain something of what the others > are saying (unless I misunderstand them...) Ah, thank you. > On Mon, Oct 2, 2023 at 4:17???AM AKASHI Takahiro > <takahiro.akashi@linaro.org> wrote: > > > A dt binding for SCMI pinctrl based gpio driver is defined in this > > commit. It basically conforms to generic pinctrl-gpio mapping framework. > > > > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> > > I think like Christian says that SCMI maybe has nothing to do > with this binding? It is just one possible use case (though we don't know > of any others.) The resource it is using is generic functionality that exist > in any pin controller that provides ways to drive lines high and low > etc. > > Would it be named a generic pin control-based GPIO? If you like :) As I said, I was not confident that the driver be applicable to other pinctrl-gpio cases. > (...) > > +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml > (...) > > +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# > > So no ARM, no scmi, just pin-control-gpio.yaml, be bold! I'm not so ambitious. > (I like this long unabbreviated name) > > > +title: SCMI pinctrl based generic GPIO controller > > Pin control-based generic GPIO controller > > Add > > description: > The pin control-based GPIO will facilitate a pin controllers ability > to drive electric lines high/low and other generic properties of a > pin controller to perform general-purpose one-bit binary I/O. > > (At least I think this is the idea, I hope I understand correctly.) Okay. > > +properties: > > + $nodename: > > + pattern: "^scmi_gpio(@[0-9a-f]+)$" > > These nodes are always just named gpio@... > the resource marker is "this is a GPIO" that's all it means. By following other gpio drivers' bindings, I will drop this rule. > > + compatible: > > + const: arm,scmi-gpio-generic > > const: pin-control-gpio > > Other than that I am aboard with the solution! Hope that the driver works on real hardware :) -Takahiro Akashi > Yours, > Linus Walleij
diff --git a/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml new file mode 100644 index 000000000000..2601c5594567 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/arm,scmi-gpio.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/arm,scmi-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SCMI pinctrl based generic GPIO controller + +maintainers: + - AKASHI Takahiro <akashi.takahiro@linaro.org> + +properties: + $nodename: + pattern: "^scmi_gpio(@[0-9a-f]+)$" + + compatible: + const: arm,scmi-gpio-generic + + gpio-controller: true + + "#gpio-cells": + const: 2 + + gpio-ranges: true + + gpio-ranges-group-names: true + +patternProperties: + "^.+-hog(-[0-9]+)?$": + type: object + properties: + gpio-hog: true + gpios: true + input: true + output-high: true + output-low: true + line-name: true + + required: + - gpio-hog + - gpios + + additionalProperties: false + +required: + - compatible + - gpio-controller + - "#gpio-cells" + - gpio-ranges + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + scmi_gpio_0: scmi_gpio@0 { + compatible = "arm,scmi-gpio"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&scmi_pinctrl 0 10 5>, + <&scmi_pinctrl 5 0 0>; + gpio-ranges-group-names = "", + "pinmux_gpio"; + }; + + // Consumer: + sdhci0_pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&scmi_gpio_0 0 GPIO_ACTIVE_LOW>; + };