mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ross Cawston <ross@r-sc.ca>
To: andi.shyti@kernel.org
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	kees@kernel.org, gustavoars@kernel.org,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ross Cawston <ross@r-sc.ca>
Subject: [PATCH 1/2] dt-bindings: i2c: add GPIO buses sharing one SCL line
Date: Sun, 18 Oct 2026 12:43:14 -0700	[thread overview]
Message-ID: <20261018194315.945-2-ross@r-sc.ca> (raw)
In-Reply-To: <20261018194315.945-1-ross@r-sc.ca>

Add a binding for several bit-banged I2C buses that share one SCL GPIO
and have one SDA GPIO each, as on some Realtek RTL930x switches. Each
child node is a bus with its own SDA line; the parent holds the shared
SCL line and the i2c-gpio style timing properties.

Signed-off-by: Ross Cawston <ross@r-sc.ca>
---
 .../bindings/i2c/i2c-gpio-shared-scl.yaml     | 94 +++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-gpio-shared-scl.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-gpio-shared-scl.yaml b/Documentation/devicetree/bindings/i2c/i2c-gpio-shared-scl.yaml
new file mode 100644
index 00000000000..e725120973a
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-gpio-shared-scl.yaml
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-gpio-shared-scl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bit-banged I2C buses sharing one SCL line
+
+maintainers:
+  - Ross Cawston <ross@r-sc.ca>
+
+description: |
+  Several I2C buses bit-banged on GPIOs, with one SCL line common to all of
+  them and one SDA line per bus. Each child node is a separate I2C bus.
+  Transfers are serialized, so only one bus clocks SCL at a time.
+
+properties:
+  compatible:
+    const: i2c-gpio-shared-scl
+
+  scl-gpios:
+    description: The shared SCL line, usually open drain.
+    maxItems: 1
+
+  i2c-gpio,delay-us:
+    description: Half the clock period in microseconds, as for i2c-gpio.
+    default: 5
+
+  i2c-gpio,timeout-ms:
+    description: Clock stretching timeout in milliseconds, as for i2c-gpio.
+    default: 100
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^i2c@[0-9a-f]+$":
+    $ref: /schemas/i2c/i2c-controller.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        description: Index of the bus, for naming only.
+        maxItems: 1
+
+      sda-gpios:
+        description: The SDA line of this bus, usually open drain.
+        maxItems: 1
+
+    required:
+      - reg
+      - sda-gpios
+
+required:
+  - compatible
+  - scl-gpios
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c-gpio-shared {
+        compatible = "i2c-gpio-shared-scl";
+        scl-gpios = <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+        i2c-gpio,delay-us = <5>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        i2c@0 {
+            reg = <0>;
+            sda-gpios = <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            fan-controller@2e {
+                compatible = "adi,adt7476";
+                reg = <0x2e>;
+            };
+        };
+
+        i2c@1 {
+            reg = <1>;
+            sda-gpios = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
-- 
2.55.0.windows.5


  reply	other threads:[~2026-10-18 19:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 19:43 [PATCH 0/2] " Ross Cawston
2026-10-18 19:43 ` Ross Cawston [this message]
2026-10-18 19:43 ` [PATCH 2/2] i2c: add driver for " Ross Cawston
2026-10-19  6:59   ` Uwe Kleine-König
2026-10-18 21:20 ` [PATCH 0/2] i2c: add " Ross Cawston

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=20261018194315.945-2-ross@r-sc.ca \
    --to=ross@r-sc.ca \
    --cc=andi.shyti@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®