Skip to contentSkip to conversation

Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

PATCH Superseded Artem Shimko 4 participants 18 messages Aug 3 – Aug 4

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

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

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.

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.

$ make dt_binding_check DT_SCHEMA_FILES=dapu,dap8211r.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json
  CHKDT   ./Documentation/devicetree/bindings
  LINT    ./Documentation/devicetree/bindings
  STYLE   ./Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/net/dapu,dap8211r.example.dts
  DTC [C] Documentation/devicetree/bindings/net/dapu,dap8211r.example.dtb
$ yamllint Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
$ grep -i "dap8211r" Documentation/devicetree/bindings/processed-schema.json
    "http://devicetree.org/schemas/net/dapu,dap8211r.yaml": {
        "$filename": "/home/a-shimko/patchwork/linux/Documentation/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:

$ 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:
...
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 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 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 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 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

DTS node example:
&ethernet_1g_tile {
...
phy-mode = "rgmii-rxid";
phy-handle = <&phy1>;
...

  mdio: mdio {
    phy1: ethernet-phy@1 {
      ...
      compatible = "ethernet-phy-id0008.011b";
      rx-internal-delay-ps = <1050>;
      ...
    };

};
};

--
Best regards,
Artem Shimko

ChangeLog:
v4 --> v5
- Add Guangdong Dapu to vendor-prefixes
- Remov unimplemented features from Kconfig help text
- Fix inconsistent handling of RGMII delay properties
- Add hardware-specified initial delay values for RX (0) and TX (1)
v3 --> v4
- Drop dapu,tx-inverted-clk (vendor-specific property removed)
- Fix driver behavior in relation to rgmii modes
- Apply software reset before RGMII register writes
v2 --> v3
- Use phy_get_internal_delay() for delay validation and selection
- Add poll timeout for reset using read_poll_timeout()
v1 --> v2
- Drop debugfs interface
- Simplify RGMII delay reading logic using of_property_read_u32()
- Fix missing newline at end of dapu,dap8211r.yaml (yamllint error)
- Simplify delay property description in DT binding
- Rename tx-inverted-clk to dapu,tx-inverted-clk (vendor prefix)
- Replace enum with multipleOf + maximum for delay validation
- Fix compatible string and tx-internal-delay-ps value in example
- Remove rounding logic, return -EINVAL for unsupported delay values
- Respect DT delay properties for all RGMII modes
- Add polling for self-clearing reset bit instead of fixed sleep
- Remove unused packet generator macros (DAP8211R_PKGC5 and related)

Artem Shimko (3):
dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.
dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

 .../bindings/net/dapu,dap8211r.yaml           |  62 ++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/net/phy/Kconfig                       |   9 +
 drivers/net/phy/Makefile                      |   1 +
 drivers/net/phy/dap8211r.c                    | 206 ++++++++++++++++++
 5 files changed, 280 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
#1 lore raw

PATCH v5 1/3 dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.

Add vendor prefix for Guangdong Dapu Telecom Co., Ltd. [1], a manufacturer of Ethernet PHYs, networking and other equipment. The prefix will be used in the DAP8211R(I) Gigabit Ethernet PHY binding.

[1] https://www.dptel.com/

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 396044f368e7..c3db857b9837 100644
@@ -403,6 +403,8 @@ patternProperties:
     description: CZ.NIC, z.s.p.o.
   "^dallas,.*":
     description: Maxim Integrated Products (formerly Dallas Semiconductor)
+  "^dapu,.*":
+    description: Guangdong Dapu Telecom Co., Ltd.
   "^dataimage,.*":
     description: DataImage, Inc.
   "^davicom,.*":
Signature · 1 line
2.43.0
#4 lore raw

PATCH v5 2/3 dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding

In reply to 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.

---
 .../bindings/net/dapu,dap8211r.yaml           | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
Documentation/devicetree/bindings/net/dapu,dap8211r.yaml new file +62 -0
new file mode 100644
index 000000000000..fb78fa4f58ca
@@ -0,0 +1,62 @@
+# 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 (0 to maximum).
+    multipleOf: 150
+    maximum: 2250
+    default: 1950
+
+  tx-internal-delay-ps:
+    description:
+      RGMII TX clock delay in picoseconds (0 to maximum).
+    multipleOf: 150
+    maximum: 2250
+    default: 1950
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethernet-phy@1 {
+            compatible = "ethernet-phy-id0008.011b";
+            reg = <1>;
+            rx-internal-delay-ps = <2100>;
+            tx-internal-delay-ps = <2100>;
+        };
+    };
Signature · 1 line
2.43.0
#5 lore raw

PATCH v5 3/3 net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

In reply to Artem Shimko

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

---
 drivers/net/phy/Kconfig    |   9 ++
 drivers/net/phy/Makefile   |   1 +
 drivers/net/phy/dap8211r.c | 206 +++++++++++++++++++++++++++++++++++++
 3 files changed, 216 insertions(+)
 create mode 100644 drivers/net/phy/dap8211r.c
drivers/net/phy/Kconfig +9 -0
index 099f25dceabb..395bcd35bffa 100644
@@ -232,6 +232,15 @@ config CORTINA_PHY
 	help
 	  Currently supports the CS4340 phy.
 
+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. Supports
+	  RGMII interface with configurable TX/RX clock delays.
+
 config DAVICOM_PHY
 	tristate "Davicom PHYs"
 	help
drivers/net/phy/Makefile +1 -0
index de660ae94945..c72f7730e25d 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_BCM_NET_PHYPTP)	+= bcm-phy-ptp.o
 obj-$(CONFIG_BROADCOM_PHY)	+= broadcom.o
 obj-$(CONFIG_CICADA_PHY)	+= cicada.o
 obj-$(CONFIG_CORTINA_PHY)	+= cortina.o
+obj-$(CONFIG_DAP8211R_PHY)	+= dap8211r.o
 obj-$(CONFIG_DAVICOM_PHY)	+= davicom.o
 obj-$(CONFIG_DP83640_PHY)	+= dp83640.o
 obj-$(CONFIG_DP83822_PHY)	+= dp83822.o
drivers/net/phy/dap8211r.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer
#6 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

Quoted 24 lines
drivers/net/phy/dap8211r.c new file +22 -0
+/* Initial RGMII RX delay per hardware specification: 0 * 150ps == 0.00ns */
+#define DAP8211R_INITIAL_RX_DEL_VAL	0
+/* Initial RGMII TX delay per hardware specification: 1 * 150ps == 0.15ns*/
+#define DAP8211R_INITIAL_TX_DEL_VAL	1
+/* Default RGMII delay: 13 * 150 == 1.95ns */
+#define DAP8211R_DEFAULT_DEL_SEL	0xD
 
 
+static int dap8211r_config_init(struct phy_device *phydev)
+{
+	u16 set = 0;
+	int ret, val;
+	s32 rx_internal_delay = DAP8211R_INITIAL_RX_DEL_VAL;
+	s32 tx_internal_delay = DAP8211R_INITIAL_TX_DEL_VAL;
+
+	if (!phy_interface_is_rgmii(phydev))
+		return 0;
+
+	if (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)
+		rx_internal_delay = phy_get_internal_delay(phydev, dap8211r_internal_delay,
+							   DAP8211R_DELAY_SIZE, true);
+
+	if (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)
+		tx_internal_delay = phy_get_internal_delay(phydev, dap8211r_internal_delay,

drivers/net/phy/dap8211r.c line 140

Quoted 10 lines
drivers/net/phy/dap8211r.c new file +10 -0
+							   DAP8211R_DELAY_SIZE, false);
+
+	switch (phydev->interface) {
+	case PHY_INTERFACE_MODE_RGMII:
+		if (rx_internal_delay < 0)
+			rx_internal_delay = DAP8211R_INITIAL_RX_DEL_VAL;
+
+		if (tx_internal_delay < 0)
+			tx_internal_delay = DAP8211R_INITIAL_TX_DEL_VAL;
+		break;

Why 0.00 for one and 0.15ns for the other? PHY_INTERFACE_MODE_RGMII means no delays.

Andrew

maintainer
#12 lore raw
In reply to Artem Shimko
Quoted 7 lines

DTS node example:
&ethernet_1g_tile {
...
phy-mode = "rgmii-rxid";
phy-handle = <&phy1>;
...

Quoted 5 lines
  mdio: mdio {
    phy1: ethernet-phy@1 {
      ...
      compatible = "ethernet-phy-id0008.011b";
      rx-internal-delay-ps = <1050>;

Is this a random example, or what you are actually using?

Andrew

#2 lore raw

Re: [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.

In reply to Artem Shimko
Quoted 5 lines · Artem Shimko

Add vendor prefix for Guangdong Dapu Telecom Co., Ltd. [1], a manufacturer of Ethernet PHYs, networking and other equipment. The prefix will be used in the DAP8211R(I) Gigabit Ethernet PHY binding.

[1] https://www.dptel.com/

So the prefix should be dptel, not dapu.

Best regards,
Krzysztof

#13 lore raw
In reply to Andrew Lunn

Hi Andrew,

Quoted 1 line · Andrew Lunn

Is this a random example, or what you are actually using?

This is actually the configuration we're using on our hardware.
--
Best regards,
Artem

#7 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

In reply to Andrew Lunn

Hi Andrew,

Quoted 2 lines · Andrew Lunn

Why 0.00 for one and 0.15ns for the other? PHY_INTERFACE_MODE_RGMII means no delays.

The 0x1 for TX is the hardware reset default from the datasheet, not a value we choose for RGMII mode. For PHY_INTERFACE_MODE_RGMII, we explicitly set both delays to 0.

Sorry, could you please advise me should I explicitly set TX delay in this case to 0 or the default value specified in the datasheet == 1 (150ps)?

Thank you for your review!
--
Best regards,
Artem

#3 lore raw

Re: [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.

In reply to Krzysztof Kozlowski

Hi Krzysztof,

Quoted 1 line · Krzysztof Kozlowski

So the prefix should be dptel, not dapu.

Got it, thank you.

--
Best regards,
Artem

#10 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

In reply to Artem Shimko
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] Incorrect initialization order: RGMII delay settings are written after the PHY software reset.…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Incorrect initialization order: RGMII delay settings are written after the PHY software reset.
- [Low] Brittle error handling in read_poll_timeout relies on mathematical coincidence of negative error codes. --

--- Patch [3]: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver --- commit a53a9ce41047cdc6842142dab15fe0303b0f860a
Author: Artem Shimko <[email protected]>

net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

Adds a new PHY driver for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY. The driver implements extended register access for RGMII delay configuration.

Quoted 4 lines
drivers/net/phy/dap8211r.c new file +0 -0
new file mode 100644

[ ... ]

Quoted 2 lines
drivers/net/phy/dap8211r.c new file +2 -0
+static int dap8211r_config_init(struct phy_device *phydev)
+{

[ ... ]

drivers/net/phy/dap8211r.c line 168

Quoted 10 lines
drivers/net/phy/dap8211r.c new file +10 -0
+	set |= FIELD_PREP(DAP8211R_RGMII_RX_DEL_MASK, rx_internal_delay);
+	set |= FIELD_PREP(DAP8211R_RGMII_TX_DEL_MASK, tx_internal_delay);
+
+	ret = dap8211r_modify_ext(phydev, DAP8211R_PHY_CON, DAP8211R_PHY_SW_RST, 0);
+	if (ret)
+		return ret;
+
+	/* Wait for reset self-clear (from low active to high) */
+	ret = read_poll_timeout(dap8211r_read_ext, val,
+				(val & DAP8211R_PHY_SW_RST),

[Severity: Low]
Should this exit condition explicitly check for val < 0?

If dap8211r_read_ext() returns a negative error code, this loop currently terminates only because negative values in two's complement happen to have BIT(15) set. Relying on this coincidence might mask errors if a different register or bit is polled in the future.

drivers/net/phy/dap8211r.c line 175

Quoted 7 lines
drivers/net/phy/dap8211r.c new file +7 -0
+				20, 200, false, phydev, DAP8211R_PHY_CON);
+	if (ret)
+		return ret;
+	if (val < 0)
+		return val;
+
+	ret = dap8211r_modify_ext(phydev, DAP8211R_RGMII_CON, DAP8211R_RGMII_CONFIG_MASK, set);

[Severity: Medium]
The function's docstring mentions "Software reset to apply settings", but here the RGMII configuration is written after the reset completes.

Does this PHY require the settings to be written before the software reset in order to latch them properly?

Quoted 5 lines
drivers/net/phy/dap8211r.c new file +5 -0
+	if (ret)
+		return ret;
+
+	return 0;
+}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#11 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

Quoted 7 lines · On Tue, Aug 4, 2026 at 1:17 PM <[email protected]> wrote:

[Severity: Low]
Should this exit condition explicitly check for val < 0?

If dap8211r_read_ext() returns a negative error code, this loop currently terminates only because negative values in two's complement happen to have BIT(15) set. Relying on this coincidence might mask errors if a different register or bit is polled in the future.

The driver already checks this after read_poll_timeout() returns. The check is present and handles negative error values.

Quoted 6 lines

[Severity: Medium]
The function's docstring mentions "Software reset to apply settings", but here the RGMII configuration is written after the reset completes.

Does this PHY require the settings to be written before the software reset in order to latch them properly?

This was already discussed. The reset is active low and self-clearing; RGMII configuration is applied after the reset completes, which is the correct sequence.

--
Best regards,
Artem

maintainer
#8 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

In reply to Artem Shimko
Quoted 8 lines · Artem Shimko

Hi Andrew,

Quoted 2 lines · Andrew Lunn

Why 0.00 for one and 0.15ns for the other? PHY_INTERFACE_MODE_RGMII means no delays.

The 0x1 for TX is the hardware reset default from the datasheet, not a value we choose for RGMII mode.

Ah, please add a comment about that. It could be there is a minor design issue within the PHY, and this is their workaround. So keep it. A comment will then stop reviewers like me asking...

Part of producing a good patch is to try to think of all the questions reviewers will ask, and answer them as part of the patch. Either comments in the code, to text in the commit message.

Andrew

maintainer
#14 lore raw
In reply to Artem Shimko
Quoted 7 lines · Artem Shimko

Hi Andrew,

Quoted 1 line · Andrew Lunn

Is this a random example, or what you are actually using?

This is actually the configuration we're using on our hardware.

phy-mode = "rgmii-rxid";
phy-handle = <&phy1>;
...

mdio: mdio {

   phy1: ethernet-phy@1 {                                                                                             
     ...                                                                                                              
     compatible = "ethernet-phy-id0008.011b";                                                                         
     rx-internal-delay-ps = <1050>;                                                                                   

That is a very odd setup, half the 2ns delay the RGMII standard asks for? Do you have an explanation for this?

Have you verified the writing of the delays in the PHY register don't have a 1 bit shift error?

Andrew

#9 lore raw

Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

In reply to Andrew Lunn

Hi Andrew,

Quoted 7 lines · Andrew Lunn

Ah, please add a comment about that. It could be there is a minor design issue within the PHY, and this is their workaround. So keep it. A comment will then stop reviewers like me asking...

Part of producing a good patch is to try to think of all the questions reviewers will ask, and answer them as part of the patch. Either comments in the code, to text in the commit message.

Will do. I'll add a comment explaining the hardware reset defaults and update the commit message.

Thanks for the review!
---
Best regards,
Artem

#15 lore raw
In reply to Andrew Lunn

Hi Andrew,

Quoted 2 lines · Andrew Lunn

That is a very odd setup, half the 2ns delay the RGMII standard asks for? Do you have an explanation for this?

I think this is a poor example, as the delay is due to clock inversion due to a mismatch in the PCB parameters.
Perhaps I should use a more standard delay as an example as <1950>.

Quoted 2 lines

Have you verified the writing of the delays in the PHY register don't have a 1 bit shift error?

I verified them by reading back the RGMII_CON register (0xA003) after configuration,
and the values are being applied correctly with no bit-shift error. Just my failed in example value =)

Thank you for your time and review.

--
Best regards,
Artem

maintainer
#16 lore raw
Quoted 7 lines · Artem Shimko

Hi Andrew,

Quoted 2 lines · Andrew Lunn

That is a very odd setup, half the 2ns delay the RGMII standard asks for? Do you have an explanation for this?

I think this is a poor example, as the delay is due to clock inversion due to a mismatch in the PCB parameters.

Ah!

Another things to explain with a comment...

Andrew

#17 lore raw

Hi Andrew,

Quoted 1 line · Andrew Lunn

Another things to explain with a comment...

If you don't mind, I'll simply update the DT binding example to use the standard 1950 ps value,
instead of the platform-specific 1050 ps value. This should avoid confusion for other developers. I think it's more appropriate.

--
Best regards,
Artem