From: Olof Johansson <olof@lixom.net>
To: Yixun Lan <dlan@gentoo.org>
Cc: Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Meng Zhang <zhangmeng.kevin@linux.spacemit.com>,
linux-gpio@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, Conor Dooley <conor@kernel.org>,
Yangyu Chen <cyy@cyyself.name>,
devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Jesse Taube <mr.bossman075@gmail.com>,
Jisheng Zhang <jszhang@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Inochi Amaoto <inochiama@outlook.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH v4 1/4] dt-bindings: gpio: spacemit: add support for K1 SoC
Date: Wed, 22 Jan 2025 12:03:48 -0800 [thread overview]
Message-ID: <Z5FPJLzAEVXGWJnE@chonkvm.lixom.net> (raw)
In-Reply-To: <20250121-03-k1-gpio-v4-1-4641c95c0194@gentoo.org>
Hi,
On Tue, Jan 21, 2025 at 11:38:11AM +0800, Yixun Lan wrote:
> The GPIO controller of K1 support basic functions as input/output,
> all pins can be used as interrupt which route to one IRQ line,
> trigger type can be select between rising edge, failing edge, or both.
> There are four GPIO ports, each consisting of 32 pins.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
> .../devicetree/bindings/gpio/spacemit,k1-gpio.yaml | 116 +++++++++++++++++++++
> 1 file changed, 116 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/gpio/spacemit,k1-gpio.yaml b/Documentation/devicetree/bindings/gpio/spacemit,k1-gpio.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..dd9459061aecfcba84e6a3c5052fbcddf6c61150
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/spacemit,k1-gpio.yaml
> @@ -0,0 +1,116 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/spacemit,k1-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SpacemiT K1 GPIO controller
> +
> +maintainers:
> + - Yixun Lan <dlan@gentoo.org>
> +
> +description:
> + The controller's registers are organized as sets of eight 32-bit
> + registers with each set of port controlling 32 pins. A single
> + interrupt line is shared for all of the pins by the controller.
> + Each port will be represented as child nodes with the generic
> + GPIO-controller properties in this bindings file.
There's only one interrupt line for all ports, but you have a binding that
duplicates them for every set of ports. That seems overly complicated,
doesn't it? They'd all bind the same handler, so there's no benefit in
providing the flexibility,.
> +properties:
> + $nodename:
> + pattern: "^gpio@[0-9a-f]+$"
> +
> + compatible:
> + const: spacemit,k1-gpio
> +
> + reg:
> + maxItems: 1
> +
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 0
> +
> +patternProperties:
> + "^gpio-port@[0-9a-f]+$":
> + type: object
> + properties:
> + compatible:
> + const: spacemit,k1-gpio-port
> +
> + reg:
> + maxItems: 1
> +
> + gpio-controller: true
> +
> + "#gpio-cells":
> + const: 2
> +
> + gpio-ranges: true
> +
> + interrupts:
> + maxItems: 1
> +
> + interrupt-controller: true
> +
> + "#interrupt-cells":
> + const: 2
> + description:
> + The first cell is the GPIO number, the second should specify interrupt
> + flag. The controller does not support level interrupts, so flags of
> + IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_LEVEL_LOW should not be used.
> + Refer <dt-bindings/interrupt-controller/irq.h> for valid flags.
Same here, since there's no real flexibility between the banks, it might
make sense to consider a 3-cell GPIO specifier instead, and having
the first cell indicate bank. I could see this argument go in either
direction, but I'm not sure I understand why to provide a gpio-controller
per bank.
Comparing to say Rockchip, where each bank has a separate interrupt line
-- so there the granularity makes sense.
-Olof
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2025-01-22 20:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 3:38 [PATCH v4 0/4] riscv: spacemit: add gpio support for K1 SoC Yixun Lan
2025-01-21 3:38 ` [PATCH v4 1/4] dt-bindings: gpio: spacemit: add " Yixun Lan
2025-01-22 20:03 ` Olof Johansson [this message]
2025-01-23 11:30 ` Yixun Lan
2025-01-23 23:19 ` Olof Johansson
2025-01-27 18:17 ` Rob Herring
2025-01-28 3:17 ` Yixun Lan
2025-01-28 16:03 ` Linus Walleij
2025-01-28 16:58 ` Rob Herring
2025-01-28 18:50 ` Samuel Holland
2025-02-06 9:18 ` Linus Walleij
2025-02-06 10:39 ` Yixun Lan
2025-02-06 13:31 ` Yixun Lan
2025-02-13 13:07 ` Linus Walleij
2025-02-14 11:54 ` Yixun Lan
2025-02-14 13:08 ` Yixun Lan
2025-02-18 9:44 ` Linus Walleij
2025-02-18 9:55 ` Yixun Lan
2025-02-18 10:17 ` Linus Walleij
2025-02-18 10:59 ` Yixun Lan
2025-01-28 15:47 ` Linus Walleij
2025-01-21 3:38 ` [PATCH v4 2/4] " Yixun Lan
2025-02-07 10:56 ` Yixun Lan
2025-02-15 21:11 ` Alex Elder
2025-02-16 12:56 ` Yixun Lan
2025-01-21 3:38 ` [PATCH v4 3/4] riscv: dts: spacemit: add gpio " Yixun Lan
2025-01-21 3:38 ` [PATCH v4 4/4] riscv: dts: spacemit: add gpio LED for system heartbeat Yixun Lan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z5FPJLzAEVXGWJnE@chonkvm.lixom.net \
--to=olof@lixom.net \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=cyy@cyyself.name \
--cc=devicetree@vger.kernel.org \
--cc=dlan@gentoo.org \
--cc=inochiama@outlook.com \
--cc=jszhang@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mr.bossman075@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=zhangmeng.kevin@linux.spacemit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox