[PATCH 1/2] dt-bindings: i2c: convert i2c-mux-reg to DT schema

From: Abdurrahman Hussain

Date: Sun Jun 07 2026 - 04:22:20 EST


Convert Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt to
the YAML schema so the i2c-mux-reg binding is validated by
dt_binding_check.

Also document a new optional "base-bus-num" property: when
present, child adapter N is registered as Linux i2c bus number
(base-bus-num + reg), so static references such as sensors.conf
stanzas remain stable across boots. The matching driver support is
added in the following patch.

Signed-off-by: Abdurrahman Hussain <abdurrahman@xxxxxxxxxx>
---
.../devicetree/bindings/i2c/i2c-mux-reg.txt | 74 --------------
.../devicetree/bindings/i2c/i2c-mux-reg.yaml | 110 +++++++++++++++++++++
2 files changed, 110 insertions(+), 74 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt
deleted file mode 100644
index b9d9755e4172..000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Register-based I2C Bus Mux
-
-This binding describes an I2C bus multiplexer that uses a single register
-to route the I2C signals.
-
-Required properties:
-- compatible: i2c-mux-reg
-- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
- port is connected to.
-* Standard I2C mux properties. See i2c-mux.yaml in this directory.
-* I2C child bus nodes. See i2c-mux.yaml in this directory.
-
-Optional properties:
-- reg: this pair of <offset size> specifies the register to control the mux.
- The <offset size> depends on its parent node. It can be any memory-mapped
- address. The size must be either 1, 2, or 4 bytes. If reg is omitted, the
- resource of this device will be used.
-- little-endian: The existence indicates the register is in little endian.
-- big-endian: The existence indicates the register is in big endian.
- If both little-endian and big-endian are omitted, the endianness of the
- CPU will be used.
-- write-only: The existence indicates the register is write-only.
-- idle-state: value to set the muxer to when idle. When no value is
- given, it defaults to the last value used.
-
-Whenever an access is made to a device on a child bus, the value set
-in the relevant node's reg property will be output to the register.
-
-If an idle state is defined, using the idle-state (optional) property,
-whenever an access is not being made to a device on a child bus, the
-register will be set according to the idle value.
-
-If an idle state is not defined, the most recently used value will be
-left programmed into the register.
-
-Example of a mux on PCIe card, the host is a powerpc SoC (big endian):
-
- i2c-mux {
- /* the <offset size> depends on the address translation
- * of the parent device. If omitted, device resource
- * will be used instead. The size is to determine
- * whether iowrite32, iowrite16, or iowrite8 will be used.
- */
- reg = <0x6028 0x4>;
- little-endian; /* little endian register on PCIe */
- compatible = "i2c-mux-reg";
- #address-cells = <1>;
- #size-cells = <0>;
- i2c-parent = <&i2c1>;
- i2c@0 {
- reg = <0>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- si5338: clock-generator@70 {
- compatible = "silabs,si5338";
- reg = <0x70>;
- /* other stuff */
- };
- };
-
- i2c@1 {
- /* data is written using iowrite32 */
- reg = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- si5338: clock-generator@70 {
- compatible = "silabs,si5338";
- reg = <0x70>;
- /* other stuff */
- };
- };
- };
diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-reg.yaml
new file mode 100644
index 000000000000..7fadedabde70
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-reg.yaml
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-mux-reg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Register-based I2C Bus Mux
+
+maintainers:
+ - Peter Rosin <peda@xxxxxxxxxx>
+
+description: |
+ This binding describes an I2C bus multiplexer that uses a single
+ memory-mapped register to route the I2C signals.
+
+ Whenever an access is made to a device on a child bus, the value
+ set in the relevant node's reg property is output to the register.
+
+ If an idle state is defined via the idle-state property, the
+ register is set to that value whenever no access is being made.
+ Otherwise the most recently used value is left programmed.
+
+allOf:
+ - $ref: /schemas/i2c/i2c-mux.yaml#
+
+properties:
+ compatible:
+ const: i2c-mux-reg
+
+ reg:
+ maxItems: 1
+ description: |
+ Offset and size of the register that selects the active child
+ bus, relative to the parent node's address space. The size
+ determines the access width and must be 1, 2, or 4 bytes. If
+ omitted, the platform device's own memory resource is used
+ instead.
+
+ i2c-parent:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description:
+ Phandle of the I2C bus that this multiplexer's master-side port
+ is connected to.
+
+ little-endian:
+ type: boolean
+ description: Register is accessed in little-endian byte order.
+
+ big-endian:
+ type: boolean
+ description: Register is accessed in big-endian byte order.
+
+ write-only:
+ type: boolean
+ description:
+ Register is write-only; the driver must not read back the
+ current selection.
+
+ idle-state:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ Value to write to the register when no child bus is selected.
+
+ base-bus-num:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Base Linux i2c-adapter number for the child buses. Child N is
+ registered as bus (base-bus-num + reg). When unset, child
+ adapters are allocated dynamically by the i2c core.
+
+required:
+ - compatible
+ - i2c-parent
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ i2c-mux@6028 {
+ compatible = "i2c-mux-reg";
+ reg = <0x6028 0x4>;
+ little-endian;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ i2c-parent = <&i2c1>;
+ base-bus-num = <16>;
+
+ i2c@0 {
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ clock-generator@70 {
+ compatible = "silabs,si5338";
+ reg = <0x70>;
+ };
+ };
+
+ i2c@1 {
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ clock-generator@70 {
+ compatible = "silabs,si5338";
+ reg = <0x70>;
+ };
+ };
+ };
+...

--
2.54.0