diff mbox series

[v3,1/8] dt-bindings: net: add schema for ASIX USB Ethernet controllers

Message ID 20220215080937.2263111-1-o.rempel@pengutronix.de
State Superseded
Headers show
Series [v3,1/8] dt-bindings: net: add schema for ASIX USB Ethernet controllers | expand

Commit Message

Oleksij Rempel Feb. 15, 2022, 8:09 a.m. UTC
Create schema for ASIX USB Ethernet controllers and import some of
currently supported USB IDs form drivers/net/usb/asix_devices.c

This devices are already used in some of DTs. So, this schema makes it official.
NOTE: there was no previously documented txt based DT binding for this
controllers.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 .../devicetree/bindings/net/asix,ax88178.yaml | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/asix,ax88178.yaml

Comments

Florian Fainelli Feb. 15, 2022, 9:01 p.m. UTC | #1
On 2/15/22 12:09 AM, Oleksij Rempel wrote:
> It should be "ethernet@x" instead of "usbether@x"
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

This looks like, a quick grep on the u-boot source code seems to suggest
that only one file is assuming that 'usbether@1' is to be used as a node
name and the error message does not even match the code it is patching:

board/liebherr/xea/xea.c:
  #ifdef CONFIG_OF_BOARD_SETUP
  static int fdt_fixup_l2switch(void *blob)
  {
          u8 ethaddr[6];
          int ret;

          if (eth_env_get_enetaddr("ethaddr", ethaddr)) {
                  ret = fdt_find_and_setprop(blob,

"/ahb@80080000/switch@800f0000",
                                             "local-mac-address",
ethaddr, 6, 1);
                  if (ret < 0)
                          printf("%s: can't find usbether@1 node: %d\n",
                                 __func__, ret);
          }

          return 0;
  }

I will wait for the other maintainers on the other patches to provide
some feedback, but if all is well, will apply this one soon.
Oleksij Rempel Feb. 16, 2022, 7:16 a.m. UTC | #2
On Tue, Feb 15, 2022 at 01:01:06PM -0800, Florian Fainelli wrote:
> On 2/15/22 12:09 AM, Oleksij Rempel wrote:
> > It should be "ethernet@x" instead of "usbether@x"
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> 
> This looks like, a quick grep on the u-boot source code seems to suggest
> that only one file is assuming that 'usbether@1' is to be used as a node
> name and the error message does not even match the code it is patching:
> 
> board/liebherr/xea/xea.c:
>   #ifdef CONFIG_OF_BOARD_SETUP
>   static int fdt_fixup_l2switch(void *blob)
>   {
>           u8 ethaddr[6];
>           int ret;
> 
>           if (eth_env_get_enetaddr("ethaddr", ethaddr)) {
>                   ret = fdt_find_and_setprop(blob,
> 
> "/ahb@80080000/switch@800f0000",
>                                              "local-mac-address",
> ethaddr, 6, 1);
>                   if (ret < 0)
>                           printf("%s: can't find usbether@1 node: %d\n",
>                                  __func__, ret);
>           }

\o/ :)

>           return 0;
>   }
> 
> I will wait for the other maintainers on the other patches to provide
> some feedback, but if all is well, will apply this one soon.

Full path fdt matching has proven to be not stable enough. Especially on
chips with early DT adaptation like iMX. It is better to use aliases
where possible. 

Regards,
Oleksij
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/asix,ax88178.yaml b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
new file mode 100644
index 000000000000..1af52358de4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
@@ -0,0 +1,68 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/asix,ax88178.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: The device tree bindings for the USB Ethernet controllers
+
+maintainers:
+  - Oleksij Rempel <o.rempel@pengutronix.de>
+
+description: |
+  Device tree properties for hard wired USB Ethernet devices.
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - usbb95,1720   # ASIX AX88172
+          - usbb95,172a   # ASIX AX88172A
+          - usbb95,1780   # ASIX AX88178
+          - usbb95,7720   # ASIX AX88772
+          - usbb95,772a   # ASIX AX88772A
+          - usbb95,772b   # ASIX AX88772B
+          - usbb95,7e2b   # ASIX AX88772B
+
+  reg: true
+  local-mac-address: true
+  mac-address: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    usb {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet@1 {
+            compatible = "usbb95,7e2b";
+            reg = <1>;
+            local-mac-address = [00 00 00 00 00 00];
+        };
+    };
+  - |
+    usb {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        usb1@1 {
+            compatible = "usb1234,5678";
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            ethernet@1 {
+               compatible = "usbb95,772b";
+               reg = <1>;
+            };
+        };
+    };