devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pinctrl: Add Cypress cy8c95x0
@ 2022-06-15 10:49 Patrick Rudolph
  2022-06-15 10:49 ` [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding Patrick Rudolph
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Rudolph @ 2022-06-15 10:49 UTC (permalink / raw)
  To: Patrick Rudolph, linux-gpio; +Cc: devicetree, linux-kernel

Add Cypress cy8c95x0 pinctrl support.

v2:
 - Update DT binding
 - Support output pincfg through DT
 - Always expose all GPIOs and ignore ngpios property

Patrick Rudolph (2):
  dt-binding: Add cypress,cy8c95x0 binding
  pinctrl: Add Cypress cy8c95x0 support

 .../bindings/pinctrl/cypress,cy8c95x0.yaml    |  131 ++
 MAINTAINERS                                   |    6 +
 drivers/pinctrl/Kconfig                       |   14 +
 drivers/pinctrl/Makefile                      |    1 +
 drivers/pinctrl/pinctrl-cy8c95x0.c            | 1380 +++++++++++++++++
 5 files changed, 1532 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
 create mode 100644 drivers/pinctrl/pinctrl-cy8c95x0.c

-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding
  2022-06-15 10:49 [PATCH v2 0/2] pinctrl: Add Cypress cy8c95x0 Patrick Rudolph
@ 2022-06-15 10:49 ` Patrick Rudolph
  2022-06-15 14:20   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Rudolph @ 2022-06-15 10:49 UTC (permalink / raw)
  To: Linus Walleij, Patrick Rudolph
  Cc: Rob Herring, Krzysztof Kozlowski, linux-gpio, devicetree,
	linux-kernel

Added device tree binding documentation for
Cypress CY8C95x0 I2C pin-controller.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
 .../bindings/pinctrl/cypress,cy8c95x0.yaml    | 131 ++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml

diff --git a/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml b/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
new file mode 100644
index 000000000000..765e8834d9dd
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/cypress,cy8c95x0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cypress CY8C95X0 I2C GPIO expander
+
+maintainers:
+  - Patrick Rudolph <patrick.rudolph@9elements.com>
+
+description: |
+  This supports the 20/40/60 pin Cypress CYC95x0 GPIO I2C expanders.
+  Pin function configuration is performed on a per-pin basis.
+
+properties:
+  compatible:
+    enum:
+      - cypress,cy8c9520
+      - cypress,cy8c9540
+      - cypress,cy8c9560
+
+  reg:
+    maxItems: 1
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    description:
+      The first cell is the GPIO number and the second cell specifies GPIO
+      flags, as defined in <dt-bindings/gpio/gpio.h>.
+    const: 2
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+  gpio-line-names: true
+
+  gpio-ranges:
+    maxItems: 1
+
+  gpio-reserved-ranges:
+    maxItems: 1
+
+  vdd-supply:
+    description:
+      Optional power supply.
+
+patternProperties:
+  '-pins$':
+    type: object
+    description:
+      Pinctrl node's client devices use subnodes for desired pin configuration.
+      Client device subnodes use below standard properties.
+    $ref: "/schemas/pinctrl/pincfg-node.yaml"
+
+    properties:
+      pins:
+        description:
+          List of gpio pins affected by the properties specified in this
+          subnode.
+        items:
+          - pattern: "^gp([0-7][0-7])$"
+      function:
+        description:
+          Specify the alternative function to be configured for the specified
+          pins.
+        enum: [ gpio, pwm ]
+
+      bias-pull-down: true
+
+      bias-pull-up: true
+
+      bias-disable: true
+
+      output-high: true
+
+      output-low: true
+
+      drive-push-pull: true
+
+      drive-open-drain: true
+
+      drive-open-source: true
+
+    required:
+      - pins
+      - function
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-controller
+  - '#interrupt-cells'
+  - gpio-controller
+  - '#gpio-cells'
+
+additionalProperties: false
+
+allOf:
+  - $ref: "pinctrl.yaml#"
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      pinctrl@20 {
+        compatible = "cypress,cy8c9520";
+        reg = <0x20>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        #interrupt-cells = <2>;
+        interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-controller;
+        vdd-supply = <&p3v3>;
+        gpio-reserved-ranges = <5 1>;
+      };
+    };
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding
  2022-06-15 10:49 ` [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding Patrick Rudolph
@ 2022-06-15 14:20   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-15 14:20 UTC (permalink / raw)
  To: Patrick Rudolph, Linus Walleij
  Cc: Rob Herring, Krzysztof Kozlowski, linux-gpio, devicetree,
	linux-kernel

On 15/06/2022 03:49, Patrick Rudolph wrote:
> Added device tree binding documentation for
> Cypress CY8C95x0 I2C pin-controller.
> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>

The subject is still wrong. You need subsystem prefix (pinctrl) and you
can skip final "binding" word, as it is implied by dt-bindings.

> ---
>  .../bindings/pinctrl/cypress,cy8c95x0.yaml    | 131 ++++++++++++++++++
>  1 file changed, 131 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml b/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
> new file mode 100644
> index 000000000000..765e8834d9dd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
> @@ -0,0 +1,131 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pinctrl/cypress,cy8c95x0.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cypress CY8C95X0 I2C GPIO expander
> +
> +maintainers:
> +  - Patrick Rudolph <patrick.rudolph@9elements.com>
> +
> +description: |
> +  This supports the 20/40/60 pin Cypress CYC95x0 GPIO I2C expanders.
> +  Pin function configuration is performed on a per-pin basis.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - cypress,cy8c9520
> +      - cypress,cy8c9540
> +      - cypress,cy8c9560
> +
> +  reg:
> +    maxItems: 1
> +
> +  gpio-controller: true
> +
> +  '#gpio-cells':
> +    description:
> +      The first cell is the GPIO number and the second cell specifies GPIO
> +      flags, as defined in <dt-bindings/gpio/gpio.h>.
> +    const: 2
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  interrupt-controller: true
> +
> +  '#interrupt-cells':
> +    const: 2
> +
> +  gpio-line-names: true
> +
> +  gpio-ranges:
> +    maxItems: 1
> +
> +  gpio-reserved-ranges:
> +    maxItems: 1
> +
> +  vdd-supply:
> +    description:
> +      Optional power supply.
> +
> +patternProperties:
> +  '-pins$':
> +    type: object
> +    description:
> +      Pinctrl node's client devices use subnodes for desired pin configuration.
> +      Client device subnodes use below standard properties.
> +    $ref: "/schemas/pinctrl/pincfg-node.yaml"

Skip quotes.

> +
> +    properties:
> +      pins:
> +        description:
> +          List of gpio pins affected by the properties specified in this
> +          subnode.
> +        items:
> +          - pattern: "^gp([0-7][0-7])$"

Use the same type of quotes everywhere - either ' or ". Does it actually
work? It looks like you allow here only one pin but the description
suggests it is a list of pins. I think you wanted here just "pattern:
..." without leading minus. Then you need also min and maxItems.

Why blank line here disappeared? My comment was in different place.

> +      function:
> +        description:
> +          Specify the alternative function to be configured for the specified
> +          pins.
> +        enum: [ gpio, pwm ]
> +
> +      bias-pull-down: true
> +
> +      bias-pull-up: true
> +
> +      bias-disable: true
> +
> +      output-high: true
> +
> +      output-low: true
> +
> +      drive-push-pull: true
> +
> +      drive-open-drain: true
> +
> +      drive-open-source: true
> +
> +    required:
> +      - pins
> +      - function
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - interrupt-controller
> +  - '#interrupt-cells'
> +  - gpio-controller
> +  - '#gpio-cells'
> +
> +additionalProperties: false
> +
> +allOf:
> +  - $ref: "pinctrl.yaml#"
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    i2c0 {

Just "i2c".

> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      pinctrl@20 {
> +        compatible = "cypress,cy8c9520";
> +        reg = <0x20>;
> +        gpio-controller;
> +        #gpio-cells = <2>;
> +        #interrupt-cells = <2>;
> +        interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
> +        interrupt-controller;
> +        vdd-supply = <&p3v3>;
> +        gpio-reserved-ranges = <5 1>;
> +      };
> +    };


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-15 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 10:49 [PATCH v2 0/2] pinctrl: Add Cypress cy8c95x0 Patrick Rudolph
2022-06-15 10:49 ` [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding Patrick Rudolph
2022-06-15 14:20   ` Krzysztof Kozlowski

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).