Add devicetree binding document for Loongson-1 GPIO.
Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
---
.../bindings/gpio/loongson,ls1x-gpio.yaml | 60 +++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
new file mode 100644
index 000000000000..e4ab49d48fae
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/loongson,ls1x-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Loongson-1 GPIO controller
+
+maintainers:
+ - Keguang Zhang <keguang.zhang@gmail.com>
+
+properties:
+ compatible:
+ const: loongson,ls1x-gpio
+
+ reg:
+ maxItems: 1
+
+ gpio-controller: true
+
+ "#gpio-cells":
+ const: 2
+
+ ngpios:
+ minimum: 1
+ maximum: 32
+
+required:
+ - compatible
+ - reg
+ - gpio-controller
+ - '#gpio-cells'
+ - ngpios
+
+additionalProperties: false
+
+examples:
+ - |
+ gpio0: gpio@1fd010c0 {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010c0 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ ngpios = <32>;
+ };
+
+ - |
+ gpio1: gpio@1fd010c4 {
+ compatible = "loongson,ls1x-gpio";
+ reg = <0x1fd010c4 0x4>;
+
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ ngpios = <32>;
+ };
+
+...
--
2.34.1
On 22/02/2023 12:12, Keguang Zhang wrote:
> Add devicetree binding document for Loongson-1 GPIO.
>
> Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> ---
> .../bindings/gpio/loongson,ls1x-gpio.yaml | 60 +++++++++++++++++++
> 1 file changed, 60 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
>
> diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
> new file mode 100644
> index 000000000000..e4ab49d48fae
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/loongson,ls1x-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Loongson-1 GPIO controller
> +
> +maintainers:
> + - Keguang Zhang <keguang.zhang@gmail.com>
> +
> +properties:
> + compatible:
> + const: loongson,ls1x-gpio
> +
> + reg:
> + maxItems: 1
> +
> + gpio-controller: true
> +
> + "#gpio-cells":
> + const: 2
> +
> + ngpios:
> + minimum: 1
> + maximum: 32
Isn't this fixed at 32? Do you have hardware with different number of GPIOs?
> +
> +required:
> + - compatible
> + - reg
> + - gpio-controller
> + - '#gpio-cells'
Use consistent quotes - either " or '
> + - ngpios
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + gpio0: gpio@1fd010c0 {
> + compatible = "loongson,ls1x-gpio";
> + reg = <0x1fd010c0 0x4>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + ngpios = <32>;
> + };
> +
> + - |
> + gpio1: gpio@1fd010c4 {
> + compatible = "loongson,ls1x-gpio";
> + reg = <0x1fd010c4 0x4>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + ngpios = <32>;
> + };
These are two the same examples, keep only one.
Best regards,
Krzysztof
On Wed, Feb 22, 2023 at 8:35 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 22/02/2023 12:12, Keguang Zhang wrote:
> > Add devicetree binding document for Loongson-1 GPIO.
> >
> > Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
> > ---
> > .../bindings/gpio/loongson,ls1x-gpio.yaml | 60 +++++++++++++++++++
> > 1 file changed, 60 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
> > new file mode 100644
> > index 000000000000..e4ab49d48fae
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/gpio/loongson,ls1x-gpio.yaml
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/gpio/loongson,ls1x-gpio.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Loongson-1 GPIO controller
> > +
> > +maintainers:
> > + - Keguang Zhang <keguang.zhang@gmail.com>
> > +
> > +properties:
> > + compatible:
> > + const: loongson,ls1x-gpio
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + gpio-controller: true
> > +
> > + "#gpio-cells":
> > + const: 2
> > +
> > + ngpios:
> > + minimum: 1
> > + maximum: 32
>
> Isn't this fixed at 32? Do you have hardware with different number of GPIOs?
>
Yes. The GPIO number of some groups is less than 32.
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - gpio-controller
> > + - '#gpio-cells'
>
> Use consistent quotes - either " or '
>
Will do.
> > + - ngpios
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + gpio0: gpio@1fd010c0 {
> > + compatible = "loongson,ls1x-gpio";
> > + reg = <0x1fd010c0 0x4>;
> > +
> > + gpio-controller;
> > + #gpio-cells = <2>;
> > +
> > + ngpios = <32>;
> > + };
> > +
> > + - |
> > + gpio1: gpio@1fd010c4 {
> > + compatible = "loongson,ls1x-gpio";
> > + reg = <0x1fd010c4 0x4>;
> > +
> > + gpio-controller;
> > + #gpio-cells = <2>;
> > +
> > + ngpios = <32>;
> > + };
>
> These are two the same examples, keep only one.
>
Will do.
> Best regards,
> Krzysztof
>
--
Best regards,
Kelvin Cheung
© 2016 - 2026 Red Hat, Inc.