From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Yinbo Zhu <zhuyinbo@loongson.cn>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jianmin Lv <lvjianmin@loongson.cn>,
wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset
Date: Tue, 8 Aug 2023 17:05:34 +0200 [thread overview]
Message-ID: <91f57b0d-a6e9-c039-40b6-0a1a9af5f7a0@linaro.org> (raw)
In-Reply-To: <20230807074043.31288-2-zhuyinbo@loongson.cn>
On 07/08/2023 09:40, Yinbo Zhu wrote:
> Loongson GPIO controllers come in multiple variants that are compatible
> except for certain register offset values. Add support in yaml file for
> device properties allowing to specify them in DT.
>
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
> .../bindings/gpio/loongson,ls-gpio.yaml | 40 ++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
> index fb86e8ce6349..fc51cf40fccd 100644
> --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
> +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
> @@ -14,6 +14,7 @@ properties:
> enum:
> - loongson,ls2k-gpio
> - loongson,ls7a-gpio
> + - loongson,ls2k1000-gpio
>
> reg:
> maxItems: 1
> @@ -29,6 +30,33 @@ properties:
>
> gpio-ranges: true
>
> + loongson,gpio-conf-offset:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + This option indicate this GPIO configuration register offset address.
> +
> + loongson,gpio-out-offset:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + This option indicate this GPIO output register offset address.
> +
> + loongson,gpio-in-offset:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + This option indicate this GPIO input register offset address.
> +
> + loongson,gpio-ctrl-mode:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + This option indicate this GPIO control mode, where '0' represents
> + bit control mode and '1' represents byte control mode.
I have no clue what does it mean. Is it only 0 or 1? Then it should be
enum or even bool.
> +
> + loongson,gpio-inten-offset:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description:
> + This option indicate this GPIO interrupt enable register offset
> + address.
> +
> interrupts:
> minItems: 1
> maxItems: 64
> @@ -39,6 +67,11 @@ required:
> - ngpios
> - "#gpio-cells"
> - gpio-controller
> + - loongson,gpio-conf-offset
> + - loongson,gpio-in-offset
> + - loongson,gpio-out-offset
> + - loongson,gpio-ctrl-mode
> + - loongson,gpio-inten-offset
No, you cannot add them as required to every other device. First, there
is no single need. Second, it breaks the ABI.
> - gpio-ranges
> - interrupts
>
> @@ -49,11 +82,16 @@ examples:
> #include <dt-bindings/interrupt-controller/irq.h>
>
> gpio0: gpio@1fe00500 {
> - compatible = "loongson,ls2k-gpio";
> + compatible = "loongson,ls2k1000-gpio";
> reg = <0x1fe00500 0x38>;
> ngpios = <64>;
> #gpio-cells = <2>;
> gpio-controller;
> + loongson,gpio-conf-offset = <0>;
> + loongson,gpio-in-offset = <0x20>;
> + loongson,gpio-out-offset = <0x10>;
> + loongson,gpio-ctrl-mode = <0>;
> + loongson,gpio-inten-offset = <0x30>;
I still think that you just embed the programming model into properties,
instead of using dedicated compatible for different blocks. It could be
fine, although I would prefer to check it with your DTS.
Where is your DTS?
Best regards,
Krzysztof
next prev parent reply other threads:[~2023-08-08 17:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 7:40 [PATCH v3 0/2] gpio: loongson: add firmware offset parse support Yinbo Zhu
2023-08-07 7:40 ` [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset Yinbo Zhu
2023-08-08 12:05 ` Conor Dooley
2023-08-09 7:47 ` Yinbo Zhu
2023-08-09 15:39 ` Conor Dooley
2023-08-10 6:19 ` Yinbo Zhu
2023-08-11 14:25 ` Bartosz Golaszewski
2023-08-14 3:39 ` Yinbo Zhu
2023-08-14 19:18 ` Krzysztof Kozlowski
2023-08-15 8:59 ` Linus Walleij
2023-08-23 3:37 ` Yinbo Zhu
2023-08-08 15:05 ` Krzysztof Kozlowski [this message]
2023-08-09 7:28 ` Yinbo Zhu
2023-08-09 13:00 ` Krzysztof Kozlowski
2023-08-10 3:35 ` Yinbo Zhu
2023-08-10 6:08 ` Krzysztof Kozlowski
2023-08-07 7:40 ` [PATCH v3 2/2] gpio: loongson: add firmware offset parse support Yinbo Zhu
2023-08-10 8:27 ` Linus Walleij
2023-08-11 3:50 ` Yinbo Zhu
2023-08-14 21:48 ` andy.shevchenko
2023-08-23 7:36 ` Yinbo Zhu
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=91f57b0d-a6e9-c039-40b6-0a1a9af5f7a0@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongson-kernel@lists.loongnix.cn \
--cc=lvjianmin@loongson.cn \
--cc=robh+dt@kernel.org \
--cc=wanghongliang@loongson.cn \
--cc=zhuyinbo@loongson.cn \
/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;
as well as URLs for NNTP newsgroup(s).