Devicetree
 help / color / mirror / Atom feed
From: Markus Stockhausen <markus.stockhausen@gmx.de>
To: andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-i2c@vger.kernel.org,
	devicetree@vger.kernel.org
Cc: Markus Stockhausen <markus.stockhausen@gmx.de>
Subject: [PATCH 1/2] dt-bindings: i2c: Add i2c-shared-gpio
Date: Thu,  7 May 2026 20:17:10 +0200	[thread overview]
Message-ID: <20260507181711.2696783-2-markus.stockhausen@gmx.de> (raw)
In-Reply-To: <20260507181711.2696783-1-markus.stockhausen@gmx.de>

Document the driver for bitbanged gpio I2C busses
with shared SCL lines.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
---
 .../bindings/i2c/i2c-gpio-shared.yaml         | 115 ++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-gpio-shared.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-gpio-shared.yaml b/Documentation/devicetree/bindings/i2c/i2c-gpio-shared.yaml
new file mode 100644
index 000000000000..7db344821e2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-gpio-shared.yaml
@@ -0,0 +1,115 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-gpio-shared.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Multiple GPIO bitbanged I2C buses with shared SCL
+
+maintainers:
+  - Markus Stockhausen <markus.stockhausen@gmx.de>
+
+description:
+  Bitbanging I2C bus driver that supports multiple independent I2C buses
+  sharing a single SCL line. Each child node represents one I2C bus with
+  its own SDA line. The shared SCL line is driven by the parent node.
+  A mutex serializes access so that only one bus transfers at a time.
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: i2c-gpio-shared
+  required:
+    - compatible
+
+properties:
+  compatible:
+    const: i2c-gpio-shared
+
+  scl-gpios:
+    maxItems: 1
+    description:
+      GPIO used for the shared SCL signal. Must be configured as
+      open-drain. All child buses share this single clock line.
+
+  i2c-gpio-shared,scl-output-only:
+    type: boolean
+    description:
+      If present, SCL is treated as output only and clock stretching
+      by devices is not supported.
+
+  i2c-gpio-shared,timeout-ms:
+    description:
+      Bus timeout in milliseconds. If not specified, defaults to 100 ms.
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^i2c@[0-9a-f]+$":
+    $ref: /schemas/i2c/i2c-controller.yaml#
+    unevaluatedProperties: false
+
+    properties:
+      reg:
+        maxItems: 1
+        description:
+          Bus index used to identify this child bus. Must be unique among
+          siblings and match the node unit address.
+
+      sda-gpios:
+        maxItems: 1
+        description:
+          GPIO used for the SDA signal of this I2C bus. Must be
+          configured as open-drain.
+
+      i2c-gpio-shared,delay-us:
+        default: 5
+        description:
+          Delay in microseconds between signal transitions for this bus.
+          Controls the I2C clock frequency. Defaults to 5 us (~100 kHz).
+
+      i2c-gpio-shared,sda-output-only:
+        type: boolean
+        description:
+          If present, SDA is treated as output only. No acknowledgment
+          or read data from devices can be received on this bus.
+
+    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-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        i2c@0 {
+            reg = <0>;
+            sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+            i2c-gpio-shared,delay-us = <2>;
+        };
+
+        i2c@1 {
+            reg = <1>;
+            sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+            i2c-gpio-shared,delay-us = <2>;
+        };
+    };
-- 
2.54.0


  reply	other threads:[~2026-05-07 18:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 18:17 [PATCH 0/2] i2c: Add i2c-shared-gpio driver Markus Stockhausen
2026-05-07 18:17 ` Markus Stockhausen [this message]
2026-05-07 19:30   ` [PATCH 1/2] dt-bindings: i2c: Add i2c-shared-gpio Rob Herring (Arm)
2026-05-08 13:18   ` Rob Herring
2026-05-09 11:16     ` AW: " markus.stockhausen
2026-05-07 18:17 ` [PATCH 2/2] i2c: shared-gpio: Add driver for gpio based busses with shared SCL Markus Stockhausen

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=20260507181711.2696783-2-markus.stockhausen@gmx.de \
    --to=markus.stockhausen@gmx.de \
    --cc=andi.shyti@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-i2c@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