Loongson 2K0300 ships a GPIO controller whose input/output control logic
is similar to previous generation of SoCs. Additionally, it acts as an
interrupt-controller supporting both level and edge interrupts and has a
distinct reset signal.
Describe its compatible in devicetree. We enlarge the maximum value of
ngpios to 128, since the controller technically supports at most 128
pins, although only 106 are routed out of the package. Properties for
interrupt-controllers and resets are introduced and limited as 2K0300
only.
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../bindings/gpio/loongson,ls-gpio.yaml | 28 ++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
index b68159600e2b..69852444df23 100644
--- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
+++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml
@@ -14,6 +14,7 @@ properties:
oneOf:
- enum:
- loongson,ls2k-gpio
+ - loongson,ls2k0300-gpio
- loongson,ls2k0500-gpio0
- loongson,ls2k0500-gpio1
- loongson,ls2k2000-gpio0
@@ -36,7 +37,7 @@ properties:
ngpios:
minimum: 1
- maximum: 64
+ maximum: 128
"#gpio-cells":
const: 2
@@ -49,6 +50,14 @@ properties:
minItems: 1
maxItems: 64
+ "#interrupt-cells":
+ const: 2
+
+ interrupt-controller: true
+
+ resets:
+ maxItems: 1
+
required:
- compatible
- reg
@@ -58,6 +67,23 @@ required:
- gpio-ranges
- interrupts
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: loongson,ls2k0300-gpio
+ then:
+ required:
+ - "#interrupt-cells"
+ - interrupt-controller
+ - resets
+ else:
+ properties:
+ "#interrupts-cells": false
+ interrupt-controller: false
+ resets: false
+
additionalProperties: false
examples:
--
2.50.1
Hi, Yao, On Mon, Sep 1, 2025 at 9:38 PM Yao Zi <ziyao@disroot.org> wrote: > > Loongson 2K0300 ships a GPIO controller whose input/output control logic > is similar to previous generation of SoCs. Additionally, it acts as an > interrupt-controller supporting both level and edge interrupts and has a > distinct reset signal. > > Describe its compatible in devicetree. We enlarge the maximum value of > ngpios to 128, since the controller technically supports at most 128 > pins, although only 106 are routed out of the package. Properties for > interrupt-controllers and resets are introduced and limited as 2K0300 > only. Replace the full name with "Loongson-2K0300" and short name with "LS2K0300", others look good to me. Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> > > Signed-off-by: Yao Zi <ziyao@disroot.org> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- > .../bindings/gpio/loongson,ls-gpio.yaml | 28 ++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > index b68159600e2b..69852444df23 100644 > --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > @@ -14,6 +14,7 @@ properties: > oneOf: > - enum: > - loongson,ls2k-gpio > + - loongson,ls2k0300-gpio > - loongson,ls2k0500-gpio0 > - loongson,ls2k0500-gpio1 > - loongson,ls2k2000-gpio0 > @@ -36,7 +37,7 @@ properties: > > ngpios: > minimum: 1 > - maximum: 64 > + maximum: 128 > > "#gpio-cells": > const: 2 > @@ -49,6 +50,14 @@ properties: > minItems: 1 > maxItems: 64 > > + "#interrupt-cells": > + const: 2 > + > + interrupt-controller: true > + > + resets: > + maxItems: 1 > + > required: > - compatible > - reg > @@ -58,6 +67,23 @@ required: > - gpio-ranges > - interrupts > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: loongson,ls2k0300-gpio > + then: > + required: > + - "#interrupt-cells" > + - interrupt-controller > + - resets > + else: > + properties: > + "#interrupts-cells": false > + interrupt-controller: false > + resets: false > + > additionalProperties: false > > examples: > -- > 2.50.1 > >
On Mon, Sep 01, 2025 at 10:22:04PM +0800, Huacai Chen wrote: > Hi, Yao, > > On Mon, Sep 1, 2025 at 9:38 PM Yao Zi <ziyao@disroot.org> wrote: > > > > Loongson 2K0300 ships a GPIO controller whose input/output control logic > > is similar to previous generation of SoCs. Additionally, it acts as an > > interrupt-controller supporting both level and edge interrupts and has a > > distinct reset signal. > > > > Describe its compatible in devicetree. We enlarge the maximum value of > > ngpios to 128, since the controller technically supports at most 128 > > pins, although only 106 are routed out of the package. Properties for > > interrupt-controllers and resets are introduced and limited as 2K0300 > > only. > Replace the full name with "Loongson-2K0300" and short name with > "LS2K0300", others look good to me. > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> I don't understand what is improved with this. For the fullname, I don't see any difference between "Loongson 2K0300" and "Loongson-2K0300". And for the short one, omitting the "LS" prefix doesn't introduce any ambiguity, either. I did a quick search through git log, and found many commits for Loongson 2K SoCs do include a hyphen for the fullname and "LS" prefix for abbreviation in messages, while some merge commits don't do so. Even the official production page for Loongson 2K0300 refers to it without a hyphen[1]. Thus I cannot find out of the point of rewording... > Loongson 2K0300 is a multi-function SoC build upon the LA264 processor > core, ... I'll appreciate and adapt it if you could explain why the change is necessary. Thanks for your patience. Best regards, Yao Zi [1]: https://loongson.cn/EN/product/show?id=35 > > > > Signed-off-by: Yao Zi <ziyao@disroot.org> > > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > --- > > .../bindings/gpio/loongson,ls-gpio.yaml | 28 ++++++++++++++++++- > > 1 file changed, 27 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > > index b68159600e2b..69852444df23 100644 > > --- a/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > > +++ b/Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml > > @@ -14,6 +14,7 @@ properties: > > oneOf: > > - enum: > > - loongson,ls2k-gpio > > + - loongson,ls2k0300-gpio > > - loongson,ls2k0500-gpio0 > > - loongson,ls2k0500-gpio1 > > - loongson,ls2k2000-gpio0 > > @@ -36,7 +37,7 @@ properties: > > > > ngpios: > > minimum: 1 > > - maximum: 64 > > + maximum: 128 > > > > "#gpio-cells": > > const: 2 > > @@ -49,6 +50,14 @@ properties: > > minItems: 1 > > maxItems: 64 > > > > + "#interrupt-cells": > > + const: 2 > > + > > + interrupt-controller: true > > + > > + resets: > > + maxItems: 1 > > + > > required: > > - compatible > > - reg > > @@ -58,6 +67,23 @@ required: > > - gpio-ranges > > - interrupts > > > > +allOf: > > + - if: > > + properties: > > + compatible: > > + contains: > > + const: loongson,ls2k0300-gpio > > + then: > > + required: > > + - "#interrupt-cells" > > + - interrupt-controller > > + - resets > > + else: > > + properties: > > + "#interrupts-cells": false > > + interrupt-controller: false > > + resets: false > > + > > additionalProperties: false > > > > examples: > > -- > > 2.50.1 > > > > >
Hi Huacai, On Mon, Sep 01, 2025 at 02:58:54PM +0000, Yao Zi wrote: > On Mon, Sep 01, 2025 at 10:22:04PM +0800, Huacai Chen wrote: > > Hi, Yao, > > > > On Mon, Sep 1, 2025 at 9:38 PM Yao Zi <ziyao@disroot.org> wrote: > > > > > > Loongson 2K0300 ships a GPIO controller whose input/output control logic > > > is similar to previous generation of SoCs. Additionally, it acts as an > > > interrupt-controller supporting both level and edge interrupts and has a > > > distinct reset signal. > > > > > > Describe its compatible in devicetree. We enlarge the maximum value of > > > ngpios to 128, since the controller technically supports at most 128 > > > pins, although only 106 are routed out of the package. Properties for > > > interrupt-controllers and resets are introduced and limited as 2K0300 > > > only. > > Replace the full name with "Loongson-2K0300" and short name with > > "LS2K0300", others look good to me. > > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> > > I don't understand what is improved with this. For the fullname, I don't > see any difference between "Loongson 2K0300" and "Loongson-2K0300". And > for the short one, omitting the "LS" prefix doesn't introduce any > ambiguity, either. > > I did a quick search through git log, and found many commits for Loongson > 2K SoCs do include a hyphen for the fullname and "LS" prefix for > abbreviation in messages, while some merge commits don't do so. > > Even the official production page for Loongson 2K0300 refers to it > without a hyphen[1]. Thus I cannot find out of the point of rewording... > > > Loongson 2K0300 is a multi-function SoC build upon the LA264 processor > > core, ... > > I'll appreciate and adapt it if you could explain why the change is > necessary. Thanks for your patience. Though I still don't understand purpose of the change, I've sent v3[2] with naming style adjusted and all comments you left in PATCH 2 resolved. Thanks for your review. > Best regards, > Yao Zi > > [1]: https://loongson.cn/EN/product/show?id=35 Regards, Yao Zi [2]: https://lore.kernel.org/linux-gpio/20250904013438.2405-1-ziyao@disroot.org/
© 2016 - 2025 Red Hat, Inc.