linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] dt-bindings: pinctrl: support specifying pins
@ 2021-11-10 23:14 Rafał Miłecki
  2021-11-11 15:31 ` Linus Walleij
  2021-11-11 20:06 ` Rob Herring
  0 siblings, 2 replies; 8+ messages in thread
From: Rafał Miłecki @ 2021-11-10 23:14 UTC (permalink / raw)
  To: Linus Walleij, Rob Herring
  Cc: linux-gpio, devicetree, linux-kernel, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

Add support for "pins" node with pin@ subnodes. This allows specifying
all pins (and their names) at DT level.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
While working with pinctrl in Linux I started wondering if we could
start specifying pins in DT instead of Linux drivers. When working with
DT we usually avoid hardcoding hardware description in drivers so it
isn't clear to me why it doesn't apply to pins.

Please let me know if this makes sense. If by some chance I'm correct I
think that specifying groups and functions could follow too.

FWIW: I didn't start working on Linux reading pins from DT yet.
---
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 12 +++++++++-
 .../devicetree/bindings/pinctrl/pinctrl.yaml  | 23 +++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml b/Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
index 8d1e5b1cdd5f..92a86b0822d6 100644
--- a/Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
@@ -74,7 +74,7 @@ required:
   - reg
   - reg-names
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
@@ -83,6 +83,16 @@ examples:
         reg = <0x1800c1c0 0x24>;
         reg-names = "cru_gpio_control";
 
+        pins {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            pin@0 {
+                reg = <0>;
+                label = "spi_clk";
+            };
+        };
+
         spi-pins {
             function = "spi";
             groups = "spi_grp";
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
index d471563119a9..d2f105e9570d 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
@@ -42,4 +42,27 @@ properties:
       This property can be set either globally for the pin controller or in
       child nodes for individual pin group control.
 
+  pins:
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^pin@[0-9a-z]+$":
+        type: object
+
+        properties:
+          reg:
+            description: Pin number
+
+          label:
+            description: Pin name
+            $ref: /schemas/types.yaml#/definitions/string
+
+        additionalProperties: false
+
 additionalProperties: true
-- 
2.31.1


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

end of thread, other threads:[~2021-11-12 12:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 23:14 [PATCH RFC] dt-bindings: pinctrl: support specifying pins Rafał Miłecki
2021-11-11 15:31 ` Linus Walleij
2021-11-11 19:53   ` Rob Herring
2021-11-12 10:16   ` Tony Lindgren
2021-11-12 11:21     ` Andy Shevchenko
2021-11-12 12:16       ` Tony Lindgren
2021-11-12 12:20         ` Andy Shevchenko
2021-11-11 20:06 ` Rob Herring

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