Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
Subsystems (4)
cover Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
Hello,
This series adds support for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY, commonly used in enterprise and industrial networking applications. The PHY supports 10/100/1000 Mbps operation with RGMII interface and includes features such as IEEE 802.3az Energy Efficient Ethernet, IEEE 1588 SyncE, and an internal packet generator for diagnostics.
The driver implements extended register access via indirect addressing (registers 0x1E/0x1F) and provides comprehensive device tree support for RGMII delay configuration. The rx-internal-delay-ps and tx-internal-delay-ps properties allow precise tuning of clock delays in 150 ps steps from 0 to 2250 ps, with automatic selection of the nearest supported value if an exact match is not specified. The optional tx-inverted-clk flag enables 180-degree TX clock phase shift for boards where signal integrity or MAC requirements necessitate clock inversion.
The driver also includes a debugfs interface for diagnostics, exposing PHY status registers (info) and providing runtime control over the internal packet generator (pkg_gen), CRC corruption, and loopback functionality. This interface is particularly useful for development and field diagnostics without requiring external test equipment.
This PHY is used on the NDA platform with 1G Ethernet tile and has been tested on that hardware with successful link establishment and RGMII delay tuning.
Due to the specific PCB layout of the platform and FPGA configuration, the default RGMII timing configuration was insufficient, causing packet loss during normal operation. Tuning the TX/RX line delays and enabling clock inversion restored proper signal timing, resulting in zero packet loss and stable link performance.
$ make dt_binding_check SCHEMA Documentation/devicetree/bindings/processed-schema.json ... DTEX Documentation/devicetree/bindings/net/dapu,dap8211r.example.dts DTC [C] Documentation/devicetree/bindings/net/dapu,dap8211r.example.dtb ...
grep -i "dap8211r" Documentation/devicetree/bindings/processed-schema.json chema.json
"http://devicetree.org/schemas/net/dapu,dap8211r.yaml": { "$filename": ".../devicetree/bindings/net/dapu,dap8211r.yaml", "$id": "http://devicetree.org/schemas/net/dapu,dap8211r.yaml#", "title": "DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY",
Working with xgmac.
Board side not pkc_gen mode (normal):
$ arping -I eth0 192.168.5.100 ARPING 192.168.5.1 from 192.168.5.100 eth0 Unicast reply from 192.168.5.1 [board.mac.addr] 8.543ms Unicast reply from 192.168.5.1 [board.mac.addr] 3.295ms Unicast reply from 192.168.5.1 [board.mac.addr] 4.301ms Unicast reply from 192.168.5.1 [board.mac.addr] 4.096ms Unicast reply from 192.168.5.1 [board.mac.addr] 2.872ms ...
$ Unfortunately, there is a dependence on the axibus speed here $ iperf3 -c 192.168.5.1 Connecting to host 192.168.5.1, port 5201 [ 5] local 192.168.5.100 port 58936 connected to 192.168.5.1 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 7.88 MBytes 65.8 Mbits/sec 0 150 KBytes [ 5] 1.00-2.00 sec 8.50 MBytes 71.4 Mbits/sec 0 165 KBytes [ 5] 2.00-3.00 sec 8.25 MBytes 69.2 Mbits/sec 0 165 KBytes [ 5] 3.00-4.01 sec 8.50 MBytes 71.1 Mbits/sec 0 165 KBytes [ 5] 4.01-5.00 sec 8.38 MBytes 70.3 Mbits/sec 0 165 KBytes [ 5] 5.00-6.00 sec 8.50 MBytes 71.5 Mbits/sec 0 165 KBytes [ 5] 6.00-7.01 sec 8.62 MBytes 72.0 Mbits/sec 0 174 KBytes [ 5] 7.01-8.00 sec 8.62 MBytes 72.8 Mbits/sec 0 174 KBytes [ 5] 8.00-9.00 sec 8.62 MBytes 72.2 Mbits/sec 0 174 KBytes [ 5] 9.00-10.04 sec 8.62 MBytes 69.9 Mbits/sec 0 174 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.04 sec 84.6 MBytes 70.7 Mbits/sec 0 sender [ 5] 0.00-10.12 sec 84.8 MBytes 70.3 Mbits/sec receiveriperf Done.
$ ethtool -t eth0 ... The test extra info: 1. MAC Loopback 0 2. MAC Loopback (diff. queues) 0 3. PHY Loopback 0 ...
ELP side not pkc_gen mode (normal):
...
17:29:11.974973 ARP, Reply ELP is-at elp.mac.addr(oui Unknown), length 28 17:29:12.975199 ARP, Request who-has ELP (elp.mac.addr(oui Unknown)) tell 192.168.5.100, length 46 17:29:12.975217 ARP, Reply ELP is-at elp.mac.addr(oui Unknown), length 28 17:29:13.975022 ARP, Request who-has ELP (elp.mac.addr(oui Unknown)) tell 192.168.5.100, length 46 17:29:13.975035 ARP, Reply ELP is-at elp.mac.addr(oui Unknown), length 28 17:29:14.974837 ARP, Request who-has ELP (elp.mac.addr(oui Unknown)) tell 192.168.5.100, length 46 17:29:14.974849 ARP, Reply ELP is-at elp.mac.addr(oui Unknown), length 28 17:29:15.975026 ARP, Request who-has ELP (elp.mac.addr(oui Unknown)) tell 192.168.5.100, length 46
...
Accepted connection from 192.168.5.100, port 58932
[ 5] local 192.168.5.1 port 5201 connected to 192.168.5.100 port 58936
[ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 7.12 MBytes 59.7 Mbits/sec [ 5] 1.00-2.00 sec 8.50 MBytes 71.3 Mbits/sec [ 5] 2.00-3.00 sec 8.50 MBytes 71.3 Mbits/sec [ 5] 3.00-4.00 sec 8.38 MBytes 70.3 Mbits/sec [ 5] 4.00-5.00 sec 8.50 MBytes 71.3 Mbits/sec [ 5] 5.00-6.00 sec 8.38 MBytes 70.3 Mbits/sec [ 5] 6.00-7.00 sec 8.62 MBytes 72.4 Mbits/sec [ 5] 7.00-8.00 sec 8.62 MBytes 72.3 Mbits/sec [ 5] 8.00-9.00 sec 8.62 MBytes 72.4 Mbits/sec [ 5] 9.00-10.00 sec 8.62 MBytes 72.4 Mbits/sec [ 5] 10.00-10.12 sec 896 KBytes 62.3 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate [ 5] 0.00-10.12 sec 84.8 MBytes 70.3 Mbits/sec receiver
Board side pkc_gen mode:
To send pck_gen patern frame to ELP
$ echo N > pkg_gen_loopback $ echo 1 > pkg_gen
To send pck_gen patern frame to MAC
$ echo Y > pkg_gen_loopback $ echo 1 > pkg_gen
ELP side pkc_gen mode:
$ Ther is expected patern
$ tcpdump -i ens16
17:27:18.993518 5a:a5:5a:a5:5a:a5 (oui Unknown) > 5a:a5:5a:a5:5a:a5, ethertype Unknown (0x5aa5), length 60:
0x0000: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.Z.
0x0010: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.Z.
0x0020: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.
17:27:18.995522 5a:a5:5a:a5:5a:a5 (oui Unknown) > 5a:a5:5a:a5:5a:a5, ethertype Unknown (0x5aa5), length 60:
0x0000: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.Z.
0x0010: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.Z.
0x0020: 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 5aa5 Z.Z.Z.Z.Z.Z.Z.
...DTS node example:ðernet_1g_tile {
...
phy-mode = "rgmii-rxid";
phy-handle = <&phy1>;
...
mdio: mdio {
phy1: ethernet-phy@1 {
...
compatible = "ethernet-phy-ieee802.3-c22";
rx-internal-delay-ps = <1050>;
tx-use-inverted-clk;
...
}; };
};
--
Best regards,
Artem Shimko
Artem Shimko (2):
dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
.../bindings/net/dapu,dap8211r.yaml | 78 +++ drivers/net/phy/Kconfig | 10 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dap8211r.c | 544 ++++++++++++++++++ 4 files changed, 633 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yaml create mode 100644 drivers/net/phy/dap8211r.c
Signature · 1 line
2.43.0
PATCH 1/2 dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
Add device tree binding documentation for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY.
The PHY supports TX and RX clock delays in 150 ps steps from 0 to 2250 ps, with a default of 1950 ps if not specified. The tx-inverted-clk flag provides a vendor-specific extension for boards where PCB trace length or MAC requirements necessitate 180-degree clock phase shift.
--- .../bindings/net/dapu,dap8211r.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +78 -0
@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dapu,dap8211r.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY + +maintainers: + - Artem Shimko <[email protected]> + +description: | + The DAP8211R(I) is a Gigabit Ethernet PHY with RGMII interface, + supporting IEEE 802.3az Energy Efficient Ethernet, IEEE 1588 SyncE, + and an internal packet generator for diagnostics. + + Specifications: + - 10BASE-Te, 100BASE-TX, 1000BASE-T + - RGMII with configurable TX/RX clock delays (150 ps steps, 0-2250 ps) + - IEEE 802.3az-2010 Energy Efficient Ethernet + - IEEE 1588 SyncE support + - Internal packet generator and checker for link diagnostics + +allOf: + - $ref: ethernet-phy.yaml# + +properties: + compatible: + const: ethernet-phy-id0008.011b + + reg: + maxItems: 1 + + rx-internal-delay-ps: + description: + RGMII RX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250] + default: 1950 + + tx-internal-delay-ps: + description: + RGMII TX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250] + default: 1950 + + tx-inverted-clk: + $ref: /schemas/types.yaml#/definitions/flag + description: + If present, the RGMII TX clock to the MAC is inverted (180 degree + phase shift relative to the data lines). This is a vendor-specific + extension for boards where PCB trace length or MAC requirements + necessitate clock inversion. Only use this property after hardware + signal integrity validation. + +unevaluatedProperties: false + +examples: + - | + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + rx-internal-delay-ps = <1050>; + tx-internal-delay-ps = <1150>; + tx-inverted-clk; + }; + };
Signature · 1 line
2.43.0
PATCH 2/2 net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
In reply to Artem ShimkoAdd a new PHY driver for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY, which is commonly used in enterprise and industrial networking applications.
The driver implements extended register access via indirect addressing through corresponding registers, and provides comprehensive device tree support for RGMII delay configuration. The rx-internal-delay-ps and tx-internal-delay-ps properties allow precise tuning of clock delays in 150 ps steps from 0 to 2250 ps, with automatic selection of the nearest supported value if an exact match is not specified. Additionally, the optional tx-inverted-clk flag enables 180-degree TX clock phase shift for boards where signal integrity or MAC requirements necessitate clock inversion. The driver also exports a debugfs interface for diagnostics, exposing PHY status registers and providing runtime control over the internal packet generator, CRC corruption, and loopback functionality.
--- drivers/net/phy/Kconfig | 10 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dap8211r.c | 544 +++++++++++++++++++++++++++++++++++++ 3 files changed, 555 insertions(+) create mode 100644 drivers/net/phy/dap8211r.c
drivers/net/phy/Kconfig +10 -0
@@ -237,6 +237,16 @@ config DAVICOM_PHY help Currently supports dm9161e and dm9131 +config DAP8211R_PHY + tristate "DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY" + depends on OF + help + Support for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY. + This PHY is designed for enterprise and industrial networking + applications, supporting 10/100/1000 Mbps operation. + RGMII with: configurable TX/RX clock delays, optional flag to enable + 180-degree TX clock phase shift and internal packet generator. + config ICPLUS_PHY tristate "ICPlus PHYs" help
drivers/net/phy/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_BROADCOM_PHY) += broadcom.o obj-$(CONFIG_CICADA_PHY) += cicada.o obj-$(CONFIG_CORTINA_PHY) += cortina.o obj-$(CONFIG_DAVICOM_PHY) += davicom.o +obj-$(CONFIG_DAP8211R_PHY) += dap8211r.o obj-$(CONFIG_DP83640_PHY) += dp83640.o obj-$(CONFIG_DP83822_PHY) += dp83822.o obj-$(CONFIG_DP83848_PHY) += dp83848.o
drivers/net/phy/dap8211r.c new file +544 -0
544 lines not on this page · raw message
Signature · 1 line
2.43.0
Rob Herring (Arm)
maintainerRe: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to Artem ShimkoQuoted 8 lines · Artem Shimko
Add device tree binding documentation for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY.
The PHY supports TX and RX clock delays in 150 ps steps from 0 to 2250 ps, with a default of 1950 ps if not specified. The tx-inverted-clk flag provides a vendor-specific extension for boards where PCB trace length or MAC requirements necessitate 180-degree clock phase shift.
Quoted 6 lines
Signed-off-by Artem Shimko <[email protected]>--- .../bindings/net/dapu,dap8211r.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:./Documentation/devicetree/bindings/net/dapu,dap8211r.yaml:78:7: [error] no new line character at the end of file (new-line-at-end-of-file)
dtschema/dtc warnings/errors:
doc reference errors (make refcheckdocs):
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.
Re: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to Artem ShimkoQuoted 61 lines · Artem Shimko
Add device tree binding documentation for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY.
The PHY supports TX and RX clock delays in 150 ps steps from 0 to 2250 ps, with a default of 1950 ps if not specified. The tx-inverted-clk flag provides a vendor-specific extension for boards where PCB trace length or MAC requirements necessitate 180-degree clock phase shift.
Signed-off-by Artem Shimko <[email protected]>--- .../bindings/net/dapu,dap8211r.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yamlDocumentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +41
-0@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dapu,dap8211r.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY + +maintainers: + - Artem Shimko <[email protected]> + +description: | + The DAP8211R(I) is a Gigabit Ethernet PHY with RGMII interface, + supporting IEEE 802.3az Energy Efficient Ethernet, IEEE 1588 SyncE, + and an internal packet generator for diagnostics. + + Specifications: + - 10BASE-Te, 100BASE-TX, 1000BASE-T + - RGMII with configurable TX/RX clock delays (150 ps steps, 0-2250 ps) + - IEEE 802.3az-2010 Energy Efficient Ethernet + - IEEE 1588 SyncE support + - Internal packet generator and checker for link diagnostics + +allOf: + - $ref: ethernet-phy.yaml# + +properties: + compatible: + const: ethernet-phy-id0008.011b + + reg: + maxItems: 1 + + rx-internal-delay-ps: + description: + RGMII RX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250]
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 51
Quoted 10 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +10
-0+ default: 1950 + + tx-internal-delay-ps: + description: + RGMII TX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250]
This would also work:
multipleOf: 150
maximum: 2250
Quoted 18 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +18
-0+ default: 1950 + + tx-inverted-clk: + $ref: /schemas/types.yaml#/definitions/flag + description: + If present, the RGMII TX clock to the MAC is inverted (180 degree + phase shift relative to the data lines). This is a vendor-specific + extension for boards where PCB trace length or MAC requirements + necessitate clock inversion. Only use this property after hardware + signal integrity validation. + +unevaluatedProperties: false + +examples: + - | + mdio { + #address-cells = <1>; + #size-cells = <0>;
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 78
Quoted 10 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +9
-0+ + ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + rx-internal-delay-ps = <1050>; + tx-internal-delay-ps = <1150>; + tx-inverted-clk; + }; + };
With this fixed,
[email protected]
AI reviewRe: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to Artem ShimkoThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] The example's `compatible` string does not match the schema's required `compatible` string…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] The example's compatible string does not match the schema's required compatible string, causing the example to silently bypass this schema's validation.
- [Medium] The example uses an invalid value for tx-internal-delay-ps that violates the strict enum constraints.
- [Medium] The vendor-specific property tx-inverted-clk lacks the required vendor prefix.
--
--- Patch [1]: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding --- commit acf143bd06413ea91d469e7f087d2e96207a1bec
Author: Artem Shimko <[email protected]>
dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
Add device tree binding documentation for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY.
Quoted 5 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 54
Quoted 11 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +11
-0+ tx-internal-delay-ps: + description: + RGMII TX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250] + default: 1950 + + tx-inverted-clk:
[Severity: Medium]
Since this property is a vendor-specific extension, should it include a vendor prefix like dapu,tx-inverted-clk? Introducing custom properties without a prefix risks colliding with future standard properties.
Quoted 4 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +4
-0+ $ref: /schemas/types.yaml#/definitions/flag + description: + If present, the RGMII TX clock to the MAC is inverted (180 degree + phase shift relative to the data lines). This is a vendor-specific
[ ... ]
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 72
Quoted 8 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +8
-0+examples: + - | + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22";
[Severity: Medium]
Will this compatible string cause the example to bypass validation for this schema? The schema requires the compatible string to be exactly "ethernet-phy-id0008.011b". If the example is not evaluated against this file's schema, it can hide other validation failures.
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 75
Quoted 3 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +3
-0+ reg = <1>; + rx-internal-delay-ps = <1050>; + tx-internal-delay-ps = <1150>;
[Severity: Medium]
Will this value trigger a validation error when the compatible string mismatch is fixed? The tx-internal-delay-ps property enforces an enum with strict 150 ps steps, and 1150 is not in the list of allowed values.
Quoted 3 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +3
-0+ tx-inverted-clk; + }; + };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH net-next 2/2] net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
In reply to Artem ShimkoThank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider: - [High] PHY software reset is not actually triggered because the driver writes `0` to the reset bit…
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [High] PHY software reset is not actually triggered because the driver writes 0 to the reset bit instead of 1.
- [High] RGMII delay configurations are not explicitly cleared when the interface mode disables them.
- [Medium] The debugfs package generator interface unconditionally overwrites the Auto-Negotiation state upon disable.
- [Medium] The debugfs write callback modifies the PHY's MII_BMCR register without acquiring phydev->lock.
- [Low] The driver uses a fixed sleep instead of polling the self-clearing reset bit.
- [Low] Incorrect use of abs() macro with unsigned types causes a build failure.
- [Low] The device tree property for clock inversion in the code does not match the commit message. --
--- Patch [2]: [PATCH net-next 2/2] net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver --- commit 78567017e0db0de14fb31e8cedc75e8b75b18e2f
Author: Artem Shimko <[email protected]>
net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
This commit adds support for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY. It implements extended register access for RGMII delay configuration and provides a debugfs interface for diagnostics.
Quoted 6 lines
The rx-internal-delay-ps and
tx-internal-delay-ps properties allow precise tuning of clock delays in 150 ps steps from 0 to 2250 ps, with automatic selection of the nearest supported value if an exact match is not specified. Additionally, the optional tx-inverted-clk flag enables 180-degree TX clock phase shift for boards where signal integrity or MAC requirements necessitate clock
[Severity: Low]
The commit message documents the property as tx-inverted-clk, but the code implementation looks for tx-use-inverted-clk.
Which one is the intended property name?
Quoted 5 lines
drivers/net/phy/dap8211r.c new file +0
-0
[ ... ]
drivers/net/phy/dap8211r.c line 108
Quoted 10 lines
drivers/net/phy/dap8211r.c new file +10
-0+static u16 dap8211r_delay_ps_to_sel (struct phy_device *phydev,u32 ps) +{ +int i, best_idx =0 ; +u32 best_diff =UINT_MAX , diff =0 ; + +if (!ps) +return 0 ; + +for (i =0 ; i <DAP8211R_DELAY_COUNT ; i++) { + diff =abs (ps - delay_config[i].ps);
[Severity: Low]
Does this cause a compilation error?
The abs() macro in the kernel strictly checks for signed types, but the result of the subtraction here is unsigned.
[ ... ]
drivers/net/phy/dap8211r.c line 225
Quoted 9 lines
drivers/net/phy/dap8211r.c new file +9
-0+static int dap8211r_config_init (struct phy_device *phydev) +{ +struct device_node *phydev_node = phydev->mdio.dev.of_node; +u16 mask =0 , set =0 ; +int ret; + +switch (phydev->interface) { +case PHY_INTERFACE_MODE_RGMII : +break ;
[Severity: High]
If the bootloader configured RGMII delays, are they left intact here?
By not setting the mask to clear the delays for pure RGMII mode, this leaves the PHY with whatever delays were previously configured, violating the RGMII interface contract.
[ ... ]
drivers/net/phy/dap8211r.c line 252
Quoted 6 lines
drivers/net/phy/dap8211r.c new file +6
-0+if (of_property_read_bool (phydev_node,"tx-use-inverted-clk" )) + set |=DAP8211R_RGMII_CLK_INVERT ; + + mask |=DAP8211R_RGMII_CLK_INVERT ; + + ret =dap8211r_modify_ext (phydev,DAP8211R_PHY_CON ,DAP8211R_PHY_SW_RST ,0 );
[Severity: High]
Does this write actually trigger the software reset?
This clears the reset bit by passing 0 for the set argument, instead of asserting it by writing DAP8211R_PHY_SW_RST.
drivers/net/phy/dap8211r.c line 257
Quoted 5 lines
drivers/net/phy/dap8211r.c new file +5
-0+if (ret) +return ret; + +/* Wait for reset self-clear */ +fsleep (200 );
[Severity: Low]
Would it be safer to poll the self-clearing reset bit instead of using a fixed sleep?
A fixed sleep might fail if the hardware reset takes longer than expected, and contradicts the comment about waiting for a self-clear.
[ ... ]
Quoted 21 lines
drivers/net/phy/dap8211r.c new file +21
-0+static ssize_t pkg_gen_write (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct seq_file *sf = file->private_data; +struct dap8211r_priv *priv = sf->private; +struct phy_device *phydev =to_phy_device (priv->dev); +bool en; +u16 mask, set, set_bmcr; +int ret; + + ret =kstrtobool_from_user (user_buf, count, &en); +if (ret) +return ret; + +if (en) { + set =DAP8211R_PKG_GEN_EN |DAP8211R_PKG_CHK_EN |DAP8211R_PKG_PL_5AA5 ; + +if (priv->crc_cor) + set |=DAP8211R_PKG_COR_CRC ; +
drivers/net/phy/dap8211r.c line 421
Quoted 10 lines
drivers/net/phy/dap8211r.c new file +10
-0+if (priv->loopback) + set_bmcr =BMCR_LOOPBACK ; +else + set_bmcr =BMCR_ANENABLE ; + }else { + set =DAP8211R_PKG_GEN_MODE |DAP8211R_PKG_GATE_EN ; + set_bmcr =BMCR_ANENABLE ; + } + + ret =phy_modify (phydev,MII_BMCR ,BMCR_LOOPBACK |BMCR_ANENABLE , set_bmcr);
[Severity: Medium]
Is it safe to modify MII_BMCR here without acquiring phydev->lock?
Concurrent execution of the phylib state machine might race with this debugfs write, leading to corrupted link state.
[Severity: Medium]
Does the else branch intentionally destroy the previous BMCR state?
By unconditionally writing BMCR_ANENABLE to 1 when disabling the packet generator, any manual speed or duplex settings previously configured by the user via ethtool will be overwritten.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to Rob HerringHi Rob,
Quoted 4 lines · Rob Herring
This would also work:
multipleOf: 150
maximum: 2250
Yeah, great
Quoted 1 line
With this fixed,
It will be fixed in v2.
Thanks for your review!
--
Best Regards,
Artem
Re: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to [email protected]Quoted 4 lines · On Tue, Jul 14, 2026 at 4:17 PM <[email protected]> wrote:
[Severity: Medium]
Since this property is a vendor-specific extension, should it include a vendor prefix like dapu,tx-inverted-clk? Introducing custom properties without a prefix risks colliding with future standard properties.
It will be fixed.
Quoted 5 lines
[Severity: Medium]
Will this compatible string cause the example to bypass validation for this schema? The schema requires the compatible string to be exactly "ethernet-phy-id0008.011b". If the example is not evaluated against this file's schema, it can hide other validation failures.
It will be fixed.
Quoted 4 lines
[Severity: Medium]
Will this value trigger a validation error when the compatible string mismatch is fixed? The tx-internal-delay-ps property enforces an enum with strict 150 ps steps, and 1150 is not in the list of allowed values.
I wanted to show that you can specify values other than just multiples of 150 ps. But I think that would be unnecessary.
It will be fixed.
--
Best regards,
Artem
Re: [PATCH net-next 2/2] net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
In reply to [email protected]Quoted 5 lines · On Tue, Jul 14, 2026 at 4:17 PM <[email protected]> wrote:
[Severity: Low]
The commit message documents the property as tx-inverted-clk, but the code implementation looks for tx-use-inverted-clk.Which one is the intended property name?
"dapu,tx-inverted-clk", it will be fixed in v2.
Quoted 2 lines
[Severity: Low]
Does this cause a compilation error?
No
Quoted 2 lines
The
abs()macro in the kernel strictly checks for signed types, but the result of the subtraction here is unsigned.
I inserted abs_diff instead of abs for u32 variables. It is safer.
#define abs_diff(a, b) ({ \
typeof(a) __a = (a); \
typeof(b) __b = (b); \
(void)(&__a == &__b); \__a > __b ? (__a - __b) : (__b - __a); \
})
Quoted 6 lines
[Severity: High]
If the bootloader configured RGMII delays, are they left intact here?By not setting the mask to clear the delays for pure RGMII mode, this leaves the PHY with whatever delays were previously configured, violating the RGMII interface contract.
It will be fixed.
Quoted 5 lines
[Severity: High]
Does this write actually trigger the software reset?This clears the reset bit by passing 0 for the set argument, instead of asserting it by writing
DAP8211R_PHY_SW_RST.
In dap8211r's datasheet the low is active for this reset. I will comment it in the driver.
Quoted 6 lines
[Severity: Low]
Would it be safer to poll the self-clearing reset bit instead of using a fixed sleep?A fixed sleep might fail if the hardware reset takes longer than expected, and contradicts the comment about waiting for a self-clear.
Agree, it will be fixed.
Quoted 5 lines
[Severity: Medium]
Is it safe to modifyMII_BMCRhere without acquiringphydev->lock?Concurrent execution of the phylib state machine might race with this debugfs write, leading to corrupted link state.
As I see, the phy_modify acquires the lock internally.
/**
* phy_modify - Convenience function for modifying a given PHY register
* @phydev: the phy_device struct
* @regnum: register number to write
* @mask: bit mask of bits to clear
* @set: new value of bits set in mask to write to @regnum
*
* NOTE: MUST NOT be called from interrupt context,
* because the bus read/write functions may wait for an interrupt
* to conclude the operation.
*/
int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) {
int ret;
phy_lock_mdio_bus(phydev);
ret = __phy_modify(phydev, regnum, mask, set);phy_unlock_mdio_bus(phydev);
return ret;
}EXPORT_SYMBOL_GPL(phy_modify);
Quoted 6 lines
[Severity: Medium]
Does the else branch intentionally destroy the previous BMCR state?By unconditionally writing
BMCR_ANENABLEto 1 when disabling the packet generator, any manual speed or duplex settings previously configured by the user via ethtool will be overwritten.
No at all, it changes only loopback and AN fields.
--
Best regards,
Artem
Andrew Lunn
maintainerRe: [PATCH net-next 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
In reply to Artem ShimkoDocumentation/devicetree/bindings/net/dapu,dap8211r.yaml line 42
Quoted 9 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +9
-0+ rx-internal-delay-ps: + description: + RGMII RX clock delay in picoseconds. The PHY supports 150 ps steps + from 0 to 2250 ps. If not specified, defaults to 1950 ps. If the + requested value does not exactly match a supported step, the driver + selects the nearest supported value and issues a warning. + enum: [0, 150, 300, 450, 600, 750, 900, 1050, 1200, 1350, 1500, + 1650, 1800, 1950, 2100, 2250] + default: 1950
The cover letter says you round to the nearest, but here you list specific values.
Please remove the rounding and return EINVAL for the value is not one of the listed values.
Andrew
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml line 75
Quoted 11 lines
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +11
-0+examples: + - | + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + rx-internal-delay-ps = <1050>; + tx-internal-delay-ps = <1150>;
Using values which probably don't work is maybe not a good idea. There are too many DT developers who just cut/paste and don't think.
These are optional, so don't even bother? Or 2100 which probably does actually work.
Andrew
Andrew Lunn
maintainerRe: [PATCH net-next 2/2] net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
In reply to Artem ShimkoQuoted 3 lines
The driver also exports a debugfs interface for diagnostics, exposing PHY status registers and providing runtime control over the internal packet generator, CRC corruption, and loopback functionality.
Please drop all this. Many PHYs have this sort of facility. We want one generic API, probably via ethtool, which all PHYs can follow, not N different incompatible APIs.
drivers/net/phy/dap8211r.c line 201
Quoted 11 lines
drivers/net/phy/dap8211r.c new file +11
-0+static u32 dap8211r_get_rgmii_delay (struct phy_device *phydev,const char *prop_name) +{ +struct device_node *np = phydev->mdio.dev.of_node; +int ret; +u32 ps =0 ; + + ret =of_property_read_u32 (np, prop_name, &ps); +if (ret) { +phydev_dbg (phydev,"Using default delay (%ups)\n" ,DAP8211R_DEFAULT_DELAY_PS ); + ps =DAP8211R_DEFAULT_DELAY_PS ; + }
This can be simplified.
First off, there probably too many phydev_dbg() messages, specially for normal case things, using defaults, etc.
of_property_read_u32_array() is documented as not touching the results value, if it does not find the property. So you can do:
u32 ps = DAP8211R_DEFAULT_DELAY_PS; of_property_read_u32(np, prop_name, &ps); return dap8211r_delay_ps_to_sel(phydev, ps);
drivers/net/phy/dap8211r.c line 225
Quoted 9 lines
drivers/net/phy/dap8211r.c new file +9
-0+static int dap8211r_config_init (struct phy_device *phydev) +{ +struct device_node *phydev_node = phydev->mdio.dev.of_node; +u16 mask =0 , set =0 ; +int ret; + +switch (phydev->interface) { +case PHY_INTERFACE_MODE_RGMII : +break ;
This is one of the less well defined areas. PHY_INTERFACE_MODE_RGMII would mean either the PCB is adding the delay, or the MAC. There is no reason however why the PHY cannot perform fine tuning, adding a small delay, say 150ps. So you should respect the rx-internal-delay-ps and tx-internal-delay-ps delays here.
Andrew
Re: [PATCH net-next 2/2] net: phy: add DAPU Telecom DAP8210R(I) Gigabit Ethernet PHY driver
Hi Andrew,
Quoted 3 lines · Andrew Lunn
Please drop all this. Many PHYs have this sort of facility. We want one generic API, probably via ethtool, which all PHYs can follow, not N different incompatible APIs.
Got it. I have dropped the entire debugfs interface in v2.
Quoted 4 lines
This can be simplified.
First off, there probably too many
phydev_dbg()messages, specially for normal case things, using defaults, etc.
Okay.
Quoted 7 lines
of_property_read_u32_array()is documented as not touching the results value, if it does not find the property. So you can do:u32 ps = DAP8211R_DEFAULT_DELAY_PS; of_property_read_u32(np, prop_name, &ps); return dap8211r_delay_ps_to_sel(phydev, ps);
Agree. I will simplify the function as suggested.
Quoted 5 lines
This is one of the less well defined areas.
PHY_INTERFACE_MODE_RGMIIwould mean either the PCB is adding the delay, or the MAC. There is no reason however why the PHY cannot perform fine tuning, adding a small delay, say 150ps. So you should respect the rx-internal-delay-ps and tx-internal-delay-ps delays here.
Understood.
Thank you for your review!
--
Best regards,
Artem