[PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer

Farouk Bouabid posted 7 patches 1 year, 9 months ago
There is a newer version of this series
[PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Farouk Bouabid 1 year, 9 months ago
This patch adds support for the Mule I2C multiplexer.

Mule is an mcu that emulates a set of i2c devices which are reacheable
through an i2c-mux.

The emulated devices share a single i2c address with the mux itself where
the requested register is what determines which logic is executed (mux or
device).

Signed-off-by: Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
---
 .../devicetree/bindings/i2c/i2c-mux-mule.yaml      | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml
new file mode 100644
index 000000000000..458e4661cbc8
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-mux-mule.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mule I2C multiplexer
+
+maintainers:
+  - Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
+  - Quentin Schulz <quentin.schulz@theobroma-systems.com>
+
+description: |
+  Mule is an mcu that emulates a set of i2c devices which are reacheable
+  through an i2c-mux.
+
+  The emulated devices share a single i2c address with the mux itself where
+  the requested register is what determines which logic is executed (mux or
+  device)
+
+      +--------------------------------------------------+
+      | Mule                                             |
+      |    +---------------+                             |
+  ------+->|Config register|----+                        |
+      | |  +---------------+    |                        |
+      | |                       V_                       |
+      | |                      |  \          +--------+  |
+      | |                      |   \-------->| dev #0 |  |
+      | |                      |   |         +--------+  |
+      | |                      | M |-------->| dev #1 |  |
+      | +--------------------->| U |         +--------+  |
+      |                        | X |-------->| dev #2 |  |
+      |                        |   |         +--------+  |
+      |                        |   /-------->| dev #3 |  |
+      |                        |__/          +--------+  |
+      +--------------------------------------------------+
+
+
+allOf:
+  - $ref: /schemas/i2c/i2c-mux.yaml#
+
+properties:
+  compatible:
+    const: tsd,mule-i2c-mux
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        i2c-mux@18 {
+            compatible = "tsd,mule-i2c-mux";
+            reg = <0x18>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            i2c@0 {
+                reg = <0x0>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                fan: fan@18 {
+                  compatible = "ti,amc6821";
+                  reg = <0x18>;
+                  #cooling-cells = <2>;
+                };
+            };
+        };
+    };
+...

-- 
2.34.1
Re: [PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Rob Herring 1 year, 9 months ago
On Fri, Apr 26, 2024 at 11:50 AM Farouk Bouabid
<farouk.bouabid@theobroma-systems.com> wrote:
>
> This patch adds support for the Mule I2C multiplexer.
>
> Mule is an mcu that emulates a set of i2c devices which are reacheable

MCU

reachable

> through an i2c-mux.
>
> The emulated devices share a single i2c address with the mux itself where
> the requested register is what determines which logic is executed (mux or
> device).

Just to be sure, we need a complete binding for the MCU. Is this the
only thing the MCU does?

Rob
Re: [PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Farouk Bouabid 1 year, 9 months ago
Hi Rob,

On 29.04.24 15:56, Rob Herring wrote:
> On Fri, Apr 26, 2024 at 11:50 AM Farouk Bouabid
> <farouk.bouabid@theobroma-systems.com> wrote:
>> This patch adds support for the Mule I2C multiplexer.
>>
>> Mule is an mcu that emulates a set of i2c devices which are reacheable
> MCU
>
> reachable
>
>> through an i2c-mux.
>>
>> The emulated devices share a single i2c address with the mux itself where
>> the requested register is what determines which logic is executed (mux or
>> device).
> Just to be sure, we need a complete binding for the MCU. Is this the
> only thing the MCU does?


Currently that is all the MCU does. We plan to add more features to the 
MCU firmware: Buzzer over i2c, watchdog over i2c ...


Best regards

Farouk

Re: [PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Krzysztof Kozlowski 1 year, 9 months ago
Except that this was not fully tested few comments.

A nit, subject: drop second/last, redundant "dt-bindings for". The
"dt-bindings" prefix is already stating that these are bindings.
See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/Documentation/devicetree/bindings/submitting-patches.rst#L18


On 26/04/2024 18:49, Farouk Bouabid wrote:
> This patch adds support for the Mule I2C multiplexer.

Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

> 
> Mule is an mcu that emulates a set of i2c devices which are reacheable
> through an i2c-mux.
> 
> The emulated devices share a single i2c address with the mux itself where
> the requested register is what determines which logic is executed (mux or
> device).
> 
> Signed-off-by: Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
> ---
>  .../devicetree/bindings/i2c/i2c-mux-mule.yaml      | 80 ++++++++++++++++++++++
>  1 file changed, 80 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml
> new file mode 100644
> index 000000000000..458e4661cbc8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-mule.yaml

Use compatible as filename.

> @@ -0,0 +1,80 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/i2c/i2c-mux-mule.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Mule I2C multiplexer
> +
> +maintainers:
> +  - Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
> +  - Quentin Schulz <quentin.schulz@theobroma-systems.com>
> +
> +description: |
> +  Mule is an mcu that emulates a set of i2c devices which are reacheable

typo, reachable

> +  through an i2c-mux.
> +
> +  The emulated devices share a single i2c address with the mux itself where
> +  the requested register is what determines which logic is executed (mux or
> +  device)
> +
> +      +--------------------------------------------------+
> +      | Mule                                             |
> +      |    +---------------+                             |
> +  ------+->|Config register|----+                        |
> +      | |  +---------------+    |                        |
> +      | |                       V_                       |
> +      | |                      |  \          +--------+  |
> +      | |                      |   \-------->| dev #0 |  |
> +      | |                      |   |         +--------+  |
> +      | |                      | M |-------->| dev #1 |  |
> +      | +--------------------->| U |         +--------+  |
> +      |                        | X |-------->| dev #2 |  |
> +      |                        |   |         +--------+  |
> +      |                        |   /-------->| dev #3 |  |
> +      |                        |__/          +--------+  |
> +      +--------------------------------------------------+
> +
> +
> +allOf:
> +  - $ref: /schemas/i2c/i2c-mux.yaml#
> +
> +properties:
> +  compatible:
> +    const: tsd,mule-i2c-mux
> +
> +  reg:
> +    maxItems: 1
> +

Best regards,
Krzysztof
Re: [PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Rob Herring 1 year, 9 months ago
On Fri, 26 Apr 2024 18:49:33 +0200, Farouk Bouabid wrote:
> This patch adds support for the Mule I2C multiplexer.
> 
> Mule is an mcu that emulates a set of i2c devices which are reacheable
> through an i2c-mux.
> 
> The emulated devices share a single i2c address with the mux itself where
> the requested register is what determines which logic is executed (mux or
> device).
> 
> Signed-off-by: Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
> ---
>  .../devicetree/bindings/i2c/i2c-mux-mule.yaml      | 80 ++++++++++++++++++++++
>  1 file changed, 80 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/i2c/i2c-mux-mule.example.dtb: fan@18: '#cooling-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/trivial-devices.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240426-dev-mule-i2c-mux-v1-2-045a482f6ffb@theobroma-systems.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH 2/7] dt-bindings: i2c: mux: mule: add dt-bindings for mule i2c multiplexer
Posted by Farouk Bouabid 1 year, 9 months ago
Hi Rob,

On 26.04.24 20:22, Rob Herring wrote:
> On Fri, 26 Apr 2024 18:49:33 +0200, Farouk Bouabid wrote:
>> This patch adds support for the Mule I2C multiplexer.
>>
>> Mule is an mcu that emulates a set of i2c devices which are reacheable
>> through an i2c-mux.
>>
>> The emulated devices share a single i2c address with the mux itself where
>> the requested register is what determines which logic is executed (mux or
>> device).
>>
>> Signed-off-by: Farouk Bouabid <farouk.bouabid@theobroma-systems.com>
>> ---
>>   .../devicetree/bindings/i2c/i2c-mux-mule.yaml      | 80 ++++++++++++++++++++++
>>   1 file changed, 80 insertions(+)
>>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/i2c/i2c-mux-mule.example.dtb: fan@18: '#cooling-cells' does not match any of the regexes: 'pinctrl-[0-9]+'


Currently ti,amc6821 uses trivial devices dt-bindings which does not 
support "#cooling-cells". We can fix this in a different patch though.


Best regards

Farouk