netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: net: dsa: microchip: add bit-banged SMI example
@ 2025-05-28 20:31 Corentin Guillevic
  2025-05-28 21:46 ` Rob Herring (Arm)
  0 siblings, 1 reply; 3+ messages in thread
From: Corentin Guillevic @ 2025-05-28 20:31 UTC (permalink / raw)
  To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Marek Vasut
  Cc: Corentin Guillevic, Woojung Huh, netdev, devicetree, linux-kernel

KSZ8863 can be configured using I2C, SPI or Microchip SMI. The latter is
similar to MDIO, but uses a different protocol. If the hardware doesn't
support this, SMI bit banging can help. This commit adds an device tree
example that uses the CONFIG_MDIO_GPIO driver for SMI bit banging.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 .../bindings/net/dsa/microchip,ksz.yaml       | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
index 62ca63e8a26f..6cab0100065b 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
@@ -242,3 +242,60 @@ examples:
         };
     };
 ...
+  # KSZ8863 with bit-banged SMI
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    // Ethernet switch connected via SMI to the host, CPU port wired to eth0:
+    ethernet0 {
+        phy-mode = "rmii";
+
+        fixed-link {
+            speed = <100>;
+            full-duplex;
+            pause;
+        };
+    };
+
+    mdio: mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        compatible = "microchip,mdio-smi0";
+        gpios = <&gpioc 1 GPIO_ACTIVE_HIGH>,
+            <&gpioa 2 GPIO_ACTIVE_HIGH>;
+        status = "okay";
+
+        switch@0 {
+            compatible = "microchip,ksz8863";
+            reg = <0>;
+            reset-gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
+            status = "okay";
+
+            ethernet-ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                lan1: port@0 {
+                    reg = <0>;
+                    label = "lan1";
+                    phy-mode = "internal";
+                };
+                lan2: port@1 {
+                    reg = <1>;
+                    label = "lan2";
+                    phy-mode = "internal";
+                };
+                port@2 {
+                    reg = <2>;
+                    label = "cpu";
+                    ethernet = <&ethernet0>;
+                    phy-mode = "rmii";
+                    microchip,rmii-clk-internal;
+
+                    fixed-link {
+                        speed = <100>;
+                        full-duplex;
+                    };
+                };
+            };
+        };
+   };
-- 
2.49.0


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

* Re: [PATCH] dt-bindings: net: dsa: microchip: add bit-banged SMI example
  2025-05-28 20:31 [PATCH] dt-bindings: net: dsa: microchip: add bit-banged SMI example Corentin Guillevic
@ 2025-05-28 21:46 ` Rob Herring (Arm)
  2025-06-02 17:01   ` Corentin GUILLEVIC
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring (Arm) @ 2025-05-28 21:46 UTC (permalink / raw)
  To: Corentin Guillevic
  Cc: devicetree, Jakub Kicinski, netdev, David S. Miller, Andrew Lunn,
	Marek Vasut, Krzysztof Kozlowski, Vladimir Oltean, Woojung Huh,
	Conor Dooley, Woojung Huh, UNGLinuxDriver, Paolo Abeni,
	linux-kernel, Eric Dumazet


On Wed, 28 May 2025 22:31:51 +0200, Corentin Guillevic wrote:
> KSZ8863 can be configured using I2C, SPI or Microchip SMI. The latter is
> similar to MDIO, but uses a different protocol. If the hardware doesn't
> support this, SMI bit banging can help. This commit adds an device tree
> example that uses the CONFIG_MDIO_GPIO driver for SMI bit banging.
> 
> Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
> ---
>  .../bindings/net/dsa/microchip,ksz.yaml       | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
> 

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

yamllint warnings/errors:
./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:1: [error] missing document start "---" (document-start)
./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: [error] syntax error: expected '<document start>', but found '<block sequence start>' (syntax)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml: ignoring, error parsing file
Traceback (most recent call last):
  File "/usr/bin/yamllint", line 33, in <module>
    sys.exit(load_entry_point('yamllint==1.29.0', 'console_scripts', 'yamllint')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yamllint/cli.py", line 228, in run
    prob_level = show_problems(problems, file, args_format=args.format,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yamllint/cli.py", line 113, in show_problems
    for problem in problems:
  File "/usr/lib/python3/dist-packages/yamllint/linter.py", line 200, in _run
    for problem in get_cosmetic_problems(buffer, conf, filepath):
  File "/usr/lib/python3/dist-packages/yamllint/linter.py", line 137, in get_cosmetic_problems
    for problem in rule.check(rule_conf,
  File "/usr/lib/python3/dist-packages/yamllint/rules/indentation.py", line 583, in check
    yield from _check(conf, token, prev, next, nextnext, context)
  File "/usr/lib/python3/dist-packages/yamllint/rules/indentation.py", line 344, in _check
    if expected < 0:
       ^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'int'
./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: but found another document
make[2]: *** Deleting file 'Documentation/devicetree/bindings/net/dsa/microchip,ksz.example.dts'
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: but found another document
make[2]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/net/dsa/microchip,ksz.example.dts] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1524: dt_binding_check] Error 2
make: *** [Makefile:248: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250528203152.628818-1-corentin.guillevic@smile.fr

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.


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

* Re: [PATCH] dt-bindings: net: dsa: microchip: add bit-banged SMI example
  2025-05-28 21:46 ` Rob Herring (Arm)
@ 2025-06-02 17:01   ` Corentin GUILLEVIC
  0 siblings, 0 replies; 3+ messages in thread
From: Corentin GUILLEVIC @ 2025-06-02 17:01 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: devicetree, Jakub Kicinski, netdev, David S. Miller, Andrew Lunn,
	Marek Vasut, Krzysztof Kozlowski, Vladimir Oltean, Woojung Huh,
	Conor Dooley, UNGLinuxDriver, Paolo Abeni, linux-kernel,
	Eric Dumazet

Le mer. 28 mai 2025 à 23:46, Rob Herring (Arm) <robh@kernel.org> a écrit :
>
>
> On Wed, 28 May 2025 22:31:51 +0200, Corentin Guillevic wrote:
> > KSZ8863 can be configured using I2C, SPI or Microchip SMI. The latter is
> > similar to MDIO, but uses a different protocol. If the hardware doesn't
> > support this, SMI bit banging can help. This commit adds an device tree
> > example that uses the CONFIG_MDIO_GPIO driver for SMI bit banging.
> >
> > Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
> > ---
> >  .../bindings/net/dsa/microchip,ksz.yaml       | 57 +++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> yamllint warnings/errors:
> ./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:1: [error] missing document start "---" (document-start)
> ./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: [error] syntax error: expected '<document start>', but found '<block sequence start>' (syntax)
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml: ignoring, error parsing file
> Traceback (most recent call last):
>   File "/usr/bin/yamllint", line 33, in <module>
>     sys.exit(load_entry_point('yamllint==1.29.0', 'console_scripts', 'yamllint')())
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3/dist-packages/yamllint/cli.py", line 228, in run
>     prob_level = show_problems(problems, file, args_format=args.format,
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3/dist-packages/yamllint/cli.py", line 113, in show_problems
>     for problem in problems:
>   File "/usr/lib/python3/dist-packages/yamllint/linter.py", line 200, in _run
>     for problem in get_cosmetic_problems(buffer, conf, filepath):
>   File "/usr/lib/python3/dist-packages/yamllint/linter.py", line 137, in get_cosmetic_problems
>     for problem in rule.check(rule_conf,
>   File "/usr/lib/python3/dist-packages/yamllint/rules/indentation.py", line 583, in check
>     yield from _check(conf, token, prev, next, nextnext, context)
>   File "/usr/lib/python3/dist-packages/yamllint/rules/indentation.py", line 344, in _check
>     if expected < 0:
>        ^^^^^^^^^^^^
> TypeError: '<' not supported between instances of 'NoneType' and 'int'
> ./Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: but found another document
> make[2]: *** Deleting file 'Documentation/devicetree/bindings/net/dsa/microchip,ksz.example.dts'
> Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml:246:3: but found another document
> make[2]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/net/dsa/microchip,ksz.example.dts] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1524: dt_binding_check] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250528203152.628818-1-corentin.guillevic@smile.fr
>
> 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.
>

Sorry,.. I send a fixed one.

Regards,
Corentin

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

end of thread, other threads:[~2025-06-02 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 20:31 [PATCH] dt-bindings: net: dsa: microchip: add bit-banged SMI example Corentin Guillevic
2025-05-28 21:46 ` Rob Herring (Arm)
2025-06-02 17:01   ` Corentin GUILLEVIC

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