Skip to contentSkip to conversation

dt-bindings: net: microchip,lan78xx: convert to DT schema

PATCH Superseded Mikhail Lukianchikov 3 participants 3 messages Jul 11 – Jul 12

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 dt-bindings: net: microchip,lan78xx: convert to DT schema

Convert the Microchip LAN78xx family (LAN7800, LAN7801, LAN7850) binding documentation from plain text to DT schema.

The conversion adds proper validation for the 'microchip,led-modes' property inside the MDIO node.

---
Changes in v3:
- Added $ref to ethernet-phy.yaml for PHY node to use standard PHY properties.
- Dropped redundant PHY description and manual 'reg' property definition.
- Dropped root node and fake compatibles in the example.

Link to v2: https://lore.kernel.org/netdev/[email protected]

 .../bindings/net/microchip,lan7800.yaml       | 96 +++++++++++++++++++
 .../bindings/net/microchip,lan78xx.txt        | 53 ----------
 MAINTAINERS                                   |  3 +-
 3 files changed, 97 insertions(+), 55 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,lan7800.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +96 -0
new file mode 100644
index 000000000000..730999d11e8a
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/microchip,lan7800.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip LAN7800/LAN7801/LAN7850 Gigabit Ethernet controller
+
+maintainers:
+  - Rengarajan Sundararajan <[email protected]>
+
+description:
+  The LAN7800/LAN7801/LAN7850 devices are usually configured by
+  programming their OTP or with an external EEPROM, but some
+  platforms (e.g. Raspberry Pi 3 B+) have neither. The Device Tree
+  properties, if present, override the OTP and EEPROM.
+
+allOf:
+  - $ref: /schemas/usb/usb-device.yaml#
+  - $ref: /schemas/net/ethernet-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - usb424,7800
+      - usb424,7801
+      - usb424,7850
+
+  reg:
+    maxItems: 1
+    description: USB port number
+
+  local-mac-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minItems: 6
+    maxItems: 6
+    description:
+      MAC address to use if not stored in OTP or EEPROM. If present,
+      overrides OTP/EEPROM.
+
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+
+    patternProperties:
+      "^ethernet-phy(@[0-9a-f]+)?$":
+        $ref: /schemas/net/ethernet-phy.yaml#
+        unevaluatedProperties: false
+        type: object
+
+        properties:
+          microchip,led-modes:
+            $ref: /schemas/types.yaml#/definitions/uint32-array
+            minItems: 1
+            maxItems: 4
+            description:
+              Array of LED mode values for each of up to 4 LEDs.
+              Omitted LEDs are turned off. Allowed values are defined
+              in include/dt-bindings/net/microchip-lan78xx.h.
+
+        required:
+          - reg
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/net/microchip-lan78xx.h>
+
+    usb {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet@1 {
+            compatible = "usb424,7800";
+            reg = <1>;
+            local-mac-address = [00 11 22 33 44 55];
+
+            mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                ethernet-phy@1 {
+                    reg = <1>;
+                    microchip,led-modes = <
+                        LAN78XX_LINK_1000_ACTIVITY
+                        LAN78XX_LINK_10_100_ACTIVITY
+                    >;
+                };
+            };
+        };
+    };
+...
Documentation/devicetree/bindings/net/microchip,lan78xx.txt deleted +0 -53

53 lines not on this page · raw message

MAINTAINERS +1 -2
index f37a81950e25..157a677a284f 100644
@@ -27928,10 +27928,9 @@ F:	drivers/usb/isp1760/*
 USB LAN78XX ETHERNET DRIVER
 M:	Thangaraj Samynathan <[email protected]>
 M:	Rengarajan Sundararajan <[email protected]>
-M:	[email protected]
 L:	[email protected]
 S:	Maintained
-F:	Documentation/devicetree/bindings/net/microchip,lan78xx.txt
+F:	Documentation/devicetree/bindings/net/microchip,lan7800.yaml
 F:	drivers/net/usb/lan78xx.*
 F:	include/dt-bindings/net/microchip-lan78xx.h
 
Signature · 1 line
2.52.0
#1 lore raw
Quoted 2 lines · Mikhail Lukianchikov

The conversion adds proper validation for the 'microchip,led-modes' property inside the MDIO node.

It was in the old binding, so I don't understand this part. You list here changes done to the binding during conversion. I see no change, so what does this refer to?

Quoted 52 lines

---
Changes in v3:
- Added $ref to ethernet-phy.yaml for PHY node to use standard PHY properties.
- Dropped redundant PHY description and manual 'reg' property definition.
- Dropped root node and fake compatibles in the example.

Link to v2: https://lore.kernel.org/netdev/[email protected]

 .../bindings/net/microchip,lan7800.yaml       | 96 +++++++++++++++++++
 .../bindings/net/microchip,lan78xx.txt        | 53 ----------
 MAINTAINERS                                   |  3 +-
 3 files changed, 97 insertions(+), 55 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/microchip,lan7800.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +29 -0
new file mode 100644
index 000000000000..730999d11e8a
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/microchip,lan7800.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip LAN7800/LAN7801/LAN7850 Gigabit Ethernet controller
+
+maintainers:
+  - Rengarajan Sundararajan <[email protected]>
+
+description:
+  The LAN7800/LAN7801/LAN7850 devices are usually configured by
+  programming their OTP or with an external EEPROM, but some
+  platforms (e.g. Raspberry Pi 3 B+) have neither. The Device Tree
+  properties, if present, override the OTP and EEPROM.
+
+allOf:
+  - $ref: /schemas/usb/usb-device.yaml#
+  - $ref: /schemas/net/ethernet-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - usb424,7800
+      - usb424,7801
+      - usb424,7850
+
+  reg:

Documentation/devicetree/bindings/net/microchip,lan7800.yaml line 39

Quoted 10 lines
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +10 -0
+    maxItems: 1
+    description: USB port number
+
+  local-mac-address:
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minItems: 6
+    maxItems: 6
+    description:
+      MAC address to use if not stored in OTP or EEPROM. If present,
+      overrides OTP/EEPROM.

Drop local-mac-address, already coming from network-class schema.

Quoted 4 lines
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +4 -0
+
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false

...

MAINTAINERS F: drivers/usb/isp1760/* · line 27931

Quoted 9 lines
MAINTAINERS +0 -1
index f37a81950e25..157a677a284f 100644
@@ -27928,10 +27928,9 @@ F:	drivers/usb/isp1760/*
 USB LAN78XX ETHERNET DRIVER
 M:	Thangaraj Samynathan <[email protected]>
 M:	Rengarajan Sundararajan <[email protected]>
-M:	[email protected]

I don't understand this change. No one requested this. Not explained in commit msg at all.

MAINTAINERS F: drivers/usb/isp1760/* · line 27936

Quoted 7 lines
MAINTAINERS +1 -1
 L:	[email protected]
 S:	Maintained
-F:	Documentation/devicetree/bindings/net/microchip,lan78xx.txt
+F:	Documentation/devicetree/bindings/net/microchip,lan7800.yaml
 F:	drivers/net/usb/lan78xx.*
 F:	include/dt-bindings/net/microchip-lan78xx.h
 

Best regards,
Krzysztof

#2 lore raw
In reply to Mikhail Lukianchikov
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The converted DT schema incorrectly rejects a 0-length `microchip,led-modes` property, breaking…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The converted DT schema incorrectly rejects a 0-length microchip,led-modes property, breaking backward compatibility.
- [Medium] Silently dropping an active maintainer from the MAINTAINERS file without explanation.
--

--- Patch [1]: [PATCH v3] dt-bindings: net: microchip,lan78xx: convert to DT schema --- commit 2888aafe795bb2f999fce4b5a449417cdf27043b
Author: Mikhail Lukianchikov <[email protected]>

dt-bindings: net: microchip,lan78xx: convert to DT schema

Convert the Microchip LAN78xx family (LAN7800, LAN7801, LAN7850) binding documentation from plain text to DT schema. The conversion adds proper validation for the 'microchip,led-modes' property inside the MDIO node.

Quoted 5 lines
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +0 -0
new file mode 100644
index 0000000000000..730999d11e8a0

[ ... ]

Documentation/devicetree/bindings/net/microchip,lan7800.yaml line 54

Quoted 4 lines
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +4 -0
+        properties:
+          microchip,led-modes:
+            $ref: /schemas/types.yaml#/definitions/uint32-array
+            minItems: 1

[Severity: Medium]
Does setting minItems to 1 here improperly reject a 0-length property?

The original text binding specified this as a 0..4 element vector. If a device tree uses an empty property to explicitly disable all LEDs, it will now fail schema validation.

Quoted 3 lines
Documentation/devicetree/bindings/net/microchip,lan7800.yaml new file +3 -0
+            maxItems: 4
+            description:
+              Array of LED mode values for each of up to 4 LEDs.

[ ... ]

MAINTAINERS F: drivers/usb/isp1760/* · line 27931

Quoted 9 lines
MAINTAINERS +0 -1
index f37a81950e250..157a677a284fc 100644
@@ -27928,10 +27928,9 @@ F:	drivers/usb/isp1760/*
 USB LAN78XX ETHERNET DRIVER
 M:	Thangaraj Samynathan <[email protected]>
 M:	Rengarajan Sundararajan <[email protected]>
-M:	[email protected]

[Severity: Medium]
This isn't a bug, but was the [email protected] maintainer email intentionally removed?

The commit message doesn't mention dropping this group email, which will no longer be automatically CC'd on patches to the LAN78XX driver.

Quoted 2 lines
MAINTAINERS +0 -0
 L:	[email protected]
 S:	Maintained
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1