Skip to contentSkip to conversation

dt-bindings: net: convert microchip,lan78xx.txt to YAML schema

PATCH Superseded Mikhail Lukianchikov 4 participants 4 messages Jul 7 – Jul 8

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: net: convert microchip,lan78xx.txt to YAML schema

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

The conversion was validated with 'make dt_binding_check'

---
 .../bindings/net/microchip,lan78xx.txt        |  53 --------
 .../bindings/net/microchip,lan78xx.yaml       | 113 ++++++++++++++++++
 2 files changed, 113 insertions(+), 53 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt
 create mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.yaml
Documentation/devicetree/bindings/net/microchip,lan78xx.txt deleted +0 -53
deleted file mode 100644
index 11a679530ae6..000000000000
@@ -1,53 +0,0 @@
-Microchip LAN78xx Gigabit Ethernet controller
-
-The LAN78XX 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.
-
-Required properties:
-- compatible: Should be one of "usb424,7800", "usb424,7801" or "usb424,7850".
-
-The MAC address will be determined using the optional properties
-defined in ethernet.txt.
-
-Optional properties of the embedded PHY:
-- microchip,led-modes: a 0..4 element vector, with each element configuring
-  the operating mode of an LED. Omitted LEDs are turned off. Allowed values
-  are defined in "include/dt-bindings/net/microchip-lan78xx.h".
-
-Example:
-
-/* Based on the configuration for a Raspberry Pi 3 B+ */
-&usb {
-	usb-port@1 {
-		compatible = "usb424,2514";
-		reg = <1>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		usb-port@1 {
-			compatible = "usb424,2514";
-			reg = <1>;
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			ethernet: ethernet@1 {
-				compatible = "usb424,7800";
-				reg = <1>;
-				local-mac-address = [ 00 11 22 33 44 55 ];
-
-				mdio {
-					#address-cells = <0x1>;
-					#size-cells = <0x0>;
-					eth_phy: ethernet-phy@1 {
-						reg = <1>;
-						microchip,led-modes = <
-							LAN78XX_LINK_1000_ACTIVITY
-							LAN78XX_LINK_10_100_ACTIVITY
-						>;
-					};
-				};
-			};
-		};
-	};
-};
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
2.52.0
#1 lore raw
Quoted 5 lines · Mikhail Lukianchikov

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

The conversion was validated with 'make dt_binding_check'

Quoted 8 lines
---
 .../bindings/net/microchip,lan78xx.txt        |  53 --------
 .../bindings/net/microchip,lan78xx.yaml       | 113 ++++++++++++++++++
 2 files changed, 113 insertions(+), 53 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt
 create mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.yaml

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/net/microchip,lan78xx.example.dtb: /: 'compatible' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/microchip,lan78xx.example.dtb: /: 'model' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/microchip,lan78xx.example.dtb: /: '#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/microchip,lan78xx.example.dtb: /: '#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
Documentation/devicetree/bindings/net/microchip,lan78xx.example.dtb: /usb: failed to match any schema with compatible: ['usb-host']

doc reference errors (make refcheckdocs):
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/net/microchip,lan78xx.txt
MAINTAINERS: Documentation/devicetree/bindings/net/microchip,lan78xx.txt

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

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.

#2 lore raw
In reply to Mikhail Lukianchikov
Quoted 2 lines · Mikhail Lukianchikov

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

Subject: there is no YAML schema

https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23

Quoted 2 lines

The conversion was validated with 'make dt_binding_check'

Drop, irrelevant and not even true. There is no point in writing in commit msg that you performed the absolute minimal expected build testing. It is expected.

Quoted 2 lines

...

You left stale maintainer entry. Checkpatch told you that, no? Did you run checkpatch?

If this is your first contribution then you need to read carefully guidelines how to contribute and then actually follow these guidelines. What does evry guideline speak about? Checkpatch.

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml

Quoted 5 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +0 -0
new file mode 100644
index 000000000000..743667c1e761

microchip,lan7800.yaml

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 11

Quoted 12 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +11 -0
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/microchip,lan78xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip LAN78xx Gigabit Ethernet controller
+
+maintainers:
+  - Rengarajan Sundararajan <[email protected]>
+  - UNGLinuxDriver <[email protected]>

Drop last email.

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +6 -0
+
+description:
+  The LAN78XX 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.
+

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +10 -0
+allOf:
+  - $ref: /schemas/usb/usb-device.yaml#
+  - $ref: /schemas/net/ethernet-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - usb424,7800
+      - usb424,7801
+      - usb424,7850

Odd format. Missing blank lines. Look at existing code to understand how this is supposed to look like.

Quoted 43 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +43 -0
+  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]+)?$":
+    type: object
+    description: |
+      PHY node for the embedded or external PHY. The PHY address is
+      given by the 'reg' property.
+    properties:
+      reg:
+        maxItems: 1
+        description: PHY address.
+      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
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 80

Quoted 10 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +10 -0
+  - |
+    #include <dt-bindings/net/microchip-lan78xx.h>
+    / {
+        usb: usb {
+            compatible = "usb-host";
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+    &usb {

Drop all this, irrelevant and not even close to expected style.

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 82

Quoted 2 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +2 -0
+        usb-port@1 {
+            compatible = "usb424,2514";

Drop node

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 88

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +6 -0
+            reg = <1>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            usb-port@1 {
+                compatible = "usb424,2514";

Drop node, not relevant to this binding.

Again, look at other bindings to understand what to write. Or read DTS101 slides.

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 85

Quoted 3 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +3 -0
+                reg = <1>;
+                #address-cells = <1>;
+                #size-cells = <0>;

Best regards,
Krzysztof

#3 lore raw
In reply to Mikhail Lukianchikov
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `ethernet-phy` node schema (which validates `microchip,led-modes`) is incorrectly placed at…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The ethernet-phy node schema (which validates microchip,led-modes) is incorrectly placed at the root level of the ethernet controller schema instead of within the mdio node, causing PHY properties to silently bypass validation. --

--- Patch [1]: [PATCH] dt-bindings: net: convert microchip,lan78xx.txt to YAML schema --- commit d20f485d326a6780c198391c5453a7f4df19b905
Author: Mikhail Lukianchikov <[email protected]>

dt-bindings: net: convert microchip,lan78xx.txt to YAML schema

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

Quoted 4 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +0 -0
new file mode 100644

[ ... ]

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 43

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +6 -0
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+
+patternProperties:
+  "^ethernet-phy(@[0-9a-f]+)?$":

[Severity: Medium]
Should this patternProperties block for the ethernet-phy node be nested inside the mdio property definition rather than at the root level of the ethernet controller schema?

Because this rule applies to the root level instead of child nodes of mdio, properties like microchip,led-modes bypass schema validation. Malformed property values will silently pass dt_binding_check.

Quoted 4 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +4 -0
+    type: object
+    description: |
+      PHY node for the embedded or external PHY. The PHY address is
+      given by the 'reg' property.

[ ... ]

Documentation/devicetree/bindings/net/microchip,lan78xx.yaml line 103

Quoted 6 lines
Documentation/devicetree/bindings/net/microchip,lan78xx.yaml new file +6 -0
+                    mdio {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                        ethernet-phy@1 {
+                            reg = <1>;
+                            microchip,led-modes = <

[Severity: Medium]
As correctly shown in this example, the ethernet-phy node resides inside mdio.

Could the schema definition above be updated to match this structure so the PHY properties are properly evaluated?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1