The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
@ 2026-08-03 10:17 Artem Shimko
  2026-08-03 10:17 ` [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd Artem Shimko
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Artem Shimko @ 2026-08-03 10:17 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier
  Cc: Artem Shimko, linux-kernel, devicetree

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

-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.
  2026-08-03 10:17 [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
@ 2026-08-03 10:17 ` Artem Shimko
  2026-08-04  6:46   ` Krzysztof Kozlowski
  2026-08-03 10:17 ` [PATCH net-next v5 2/3] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding Artem Shimko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Artem Shimko @ 2026-08-03 10:17 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier
  Cc: Artem Shimko, linux-kernel, devicetree

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/

Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 396044f368e7..c3db857b9837 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -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,.*":
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v5 2/3] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding
  2026-08-03 10:17 [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
  2026-08-03 10:17 ` [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd Artem Shimko
@ 2026-08-03 10:17 ` Artem Shimko
  2026-08-03 10:17 ` [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
  2026-08-04  2:32 ` [PATCH net-next v5 0/3] Add " Andrew Lunn
  3 siblings, 0 replies; 16+ messages in thread
From: Artem Shimko @ 2026-08-03 10:17 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier
  Cc: Artem Shimko, linux-kernel, devicetree

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.

Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
 .../bindings/net/dapu,dap8211r.yaml           | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dapu,dap8211r.yaml

diff --git a/Documentation/devicetree/bindings/net/dapu,dap8211r.yaml b/Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
new file mode 100644
index 000000000000..fb78fa4f58ca
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dapu,dap8211r.yaml
@@ -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 <a.shimko.dev@gmail.com>
+
+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>;
+        };
+    };
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-03 10:17 [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
  2026-08-03 10:17 ` [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd Artem Shimko
  2026-08-03 10:17 ` [PATCH net-next v5 2/3] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding Artem Shimko
@ 2026-08-03 10:17 ` Artem Shimko
  2026-08-04  2:30   ` Andrew Lunn
  2026-08-04  2:32 ` [PATCH net-next v5 0/3] Add " Andrew Lunn
  3 siblings, 1 reply; 16+ messages in thread
From: Artem Shimko @ 2026-08-03 10:17 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier
  Cc: Artem Shimko, linux-kernel, devicetree

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.

Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
 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

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 099f25dceabb..395bcd35bffa 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -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
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index de660ae94945..c72f7730e25d 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -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
diff --git a/drivers/net/phy/dap8211r.c b/drivers/net/phy/dap8211r.c
new file mode 100644
index 000000000000..f010ce0c3bd1
--- /dev/null
+++ b/drivers/net/phy/dap8211r.c
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for the DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY.
+ *
+ * Specifications:
+ *   - IEEE 802.3 10BASE-Te, 100BASE-TX, 1000BASE-T
+ *   - IEEE 802.3az-2010 Energy Efficient Ethernet
+ *   - IEEE 1588 SyncE support
+ *   - RGMII
+ *
+ * Author: Artem Shimko <a.shimko.dev@gmail.com>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/errno.h>
+#include <linux/ethtool.h>
+#include <linux/kernel.h>
+#include <linux/iopoll.h>
+#include <linux/mii.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/phy.h>
+
+#define DAP8211R_PHY_ID			0x0008011B
+#define DAP8211R_PHY_ID_MASK		0xFFFFFFFF
+
+#define DAP8211R_EXT_ADD		0x1E
+#define DAP8211R_EXT_DATA		0x1F
+
+#define DAP8211R_PHY_CON		0xA001
+#define DAP8211R_PHY_SW_RST		BIT(15)
+
+#define DAP8211R_RGMII_CON		0xA003
+#define DAP8211R_RGMII_TX_DEL_MASK	GENMASK(3, 0)
+#define DAP8211R_RGMII_RX_DEL_MASK	GENMASK(13, 10)
+
+#define DAP8211R_RGMII_CONFIG_MASK	(DAP8211R_RGMII_RX_DEL_MASK | DAP8211R_RGMII_TX_DEL_MASK)
+
+/* 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 const int dap8211r_internal_delay[] = {0, 150, 300, 450, 600, 750, 900,
+					      1050, 1200, 1350, 1500, 1650, 1800,
+					      1950, 2100, 2250};
+
+#define DAP8211R_DELAY_SIZE	ARRAY_SIZE(dap8211r_internal_delay)
+
+/**
+ * dap8211r_read_ext() - Read extended register
+ * @phydev: PHY device structure
+ * @reg: Extended register address
+ *
+ * Reads a PHY extended register using the indirect access method.
+ * The caller must hold the MDIO bus lock.
+ *
+ * Return: Register value on success, or negative error code
+ */
+static int dap8211r_read_ext(struct phy_device *phydev, u16 reg)
+{
+	int ret;
+
+	phy_lock_mdio_bus(phydev);
+	ret = __phy_write(phydev, DAP8211R_EXT_ADD, reg);
+	if (ret < 0)
+		goto out;
+
+	ret = __phy_read(phydev, DAP8211R_EXT_DATA);
+out:
+	phy_unlock_mdio_bus(phydev);
+	return ret;
+}
+
+/**
+ * dap8211r_modify_ext() - Modify extended register bits
+ * @phydev: PHY device structure
+ * @reg: Extended register address
+ * @mask: Bit mask of bits to clear
+ * @set: Bit mask of bits to set
+ *
+ * Modifies a PHY extended register using the indirect access method.
+ * New value = (old value & ~mask) | set.
+ * The caller must hold the MDIO bus lock.
+ *
+ * Return: 0 on success, or negative error code
+ */
+static int dap8211r_modify_ext(struct phy_device *phydev, u16 reg, u16 mask, u16 set)
+{
+	int ret;
+
+	phy_lock_mdio_bus(phydev);
+	ret = __phy_write(phydev, DAP8211R_EXT_ADD, reg);
+	if (ret < 0)
+		goto out;
+
+	ret = __phy_modify(phydev, DAP8211R_EXT_DATA, mask, set);
+out:
+	phy_unlock_mdio_bus(phydev);
+	return ret;
+}
+
+/**
+ * dap8211r_config_init() - Initialize PHY
+ * @phydev: PHY device structure
+ *
+ * Configures the PHY during initialization:
+ * - RGMII delays based on interface mode
+ * - Software reset to apply settings (low active, self clear)
+ *
+ * Return: 0 on success, or negative error code
+ */
+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,
+							   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;
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+		if (rx_internal_delay < 0)
+			rx_internal_delay = DAP8211R_DEFAULT_DEL_SEL;
+		break;
+	case PHY_INTERFACE_MODE_RGMII_ID:
+		if (rx_internal_delay < 0)
+			rx_internal_delay = DAP8211R_DEFAULT_DEL_SEL;
+		fallthrough;
+	case PHY_INTERFACE_MODE_RGMII_TXID:
+		if (tx_internal_delay < 0)
+			tx_internal_delay = DAP8211R_DEFAULT_DEL_SEL;
+		break;
+	default:
+		phydev_err(phydev, "Unsupported interface: %d\n",
+			   phydev->interface);
+		return -EINVAL;
+	}
+
+	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),
+				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);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static struct phy_driver dap8211r_driver[] = {
+	{
+		PHY_ID_MATCH_EXACT(DAP8211R_PHY_ID),
+		.name		= "DAP8211R Gigabit Ethernet",
+		.soft_reset	= genphy_soft_reset,
+		.config_init	= dap8211r_config_init,
+		.read_status	= genphy_read_status,
+		.set_loopback	= genphy_loopback,
+		.config_aneg	= genphy_config_aneg,
+		.suspend	= genphy_suspend,
+		.resume		= genphy_resume,
+	},
+};
+module_phy_driver(dap8211r_driver);
+
+MODULE_DESCRIPTION("DAP8211R Gigabit Ethernet PHY driver");
+MODULE_AUTHOR("Artem Shimko <a.shimko.dev@gmail.com>");
+MODULE_LICENSE("GPL");
+
+static const struct mdio_device_id __maybe_unused dap8211r_tb[] = {
+	{ DAP8211R_PHY_ID, DAP8211R_PHY_ID_MASK },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(mdio, dap8211r_tb);
+
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-03 10:17 ` [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
@ 2026-08-04  2:30   ` Andrew Lunn
  2026-08-04  7:13     ` Artem Shimko
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2026-08-04  2:30 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

> +/* 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,
> +							   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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-03 10:17 [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
                   ` (2 preceding siblings ...)
  2026-08-03 10:17 ` [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
@ 2026-08-04  2:32 ` Andrew Lunn
  2026-08-04  7:03   ` Artem Shimko
  3 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2026-08-04  2:32 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

> 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>;

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

   Andrew

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.
  2026-08-03 10:17 ` [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd Artem Shimko
@ 2026-08-04  6:46   ` Krzysztof Kozlowski
  2026-08-04  7:14     ` Artem Shimko
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-04  6:46 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

On Mon, Aug 03, 2026 at 01:17:32PM +0300, Artem Shimko wrote:
> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04  2:32 ` [PATCH net-next v5 0/3] Add " Andrew Lunn
@ 2026-08-04  7:03   ` Artem Shimko
  2026-08-04 13:32     ` Andrew Lunn
  0 siblings, 1 reply; 16+ messages in thread
From: Artem Shimko @ 2026-08-04  7:03 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Andrew,

On Tue, Aug 4, 2026 at 5:32 AM Andrew Lunn <andrew@lunn.ch> wrote:

> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04  2:30   ` Andrew Lunn
@ 2026-08-04  7:13     ` Artem Shimko
  2026-08-04 13:26       ` Andrew Lunn
  0 siblings, 1 reply; 16+ messages in thread
From: Artem Shimko @ 2026-08-04  7:13 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Andrew,

On Tue, Aug 4, 2026 at 5:30 AM Andrew Lunn <andrew@lunn.ch> wrote:

> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd.
  2026-08-04  6:46   ` Krzysztof Kozlowski
@ 2026-08-04  7:14     ` Artem Shimko
  0 siblings, 0 replies; 16+ messages in thread
From: Artem Shimko @ 2026-08-04  7:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: netdev, Andrew Lunn, Heiner Kallweit, Russell King,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Krzysztof,

On Tue, Aug 4, 2026 at 9:46 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> So the prefix should be dptel, not dapu.

Got it, thank you.

--
Best regards,
Artem

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04  7:13     ` Artem Shimko
@ 2026-08-04 13:26       ` Andrew Lunn
  2026-08-04 14:05         ` Artem Shimko
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2026-08-04 13:26 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

On Tue, Aug 04, 2026 at 10:13:06AM +0300, Artem Shimko wrote:
> Hi Andrew,
> 
> On Tue, Aug 4, 2026 at 5:30 AM Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04  7:03   ` Artem Shimko
@ 2026-08-04 13:32     ` Andrew Lunn
  2026-08-04 14:08       ` Artem Shimko
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2026-08-04 13:32 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

On Tue, Aug 04, 2026 at 10:03:30AM +0300, Artem Shimko wrote:
> Hi Andrew,
> 
> On Tue, Aug 4, 2026 at 5:32 AM Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04 13:26       ` Andrew Lunn
@ 2026-08-04 14:05         ` Artem Shimko
  0 siblings, 0 replies; 16+ messages in thread
From: Artem Shimko @ 2026-08-04 14:05 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Andrew,

On Tue, Aug 4, 2026 at 4:26 PM Andrew Lunn <andrew@lunn.ch> wrote:

> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04 13:32     ` Andrew Lunn
@ 2026-08-04 14:08       ` Artem Shimko
  2026-08-04 14:41         ` Andrew Lunn
  0 siblings, 1 reply; 16+ messages in thread
From: Artem Shimko @ 2026-08-04 14:08 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Andrew,

On Tue, Aug 4, 2026 at 4:32 PM Andrew Lunn <andrew@lunn.ch> wrote:
> 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>.

> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04 14:08       ` Artem Shimko
@ 2026-08-04 14:41         ` Andrew Lunn
  2026-08-04 15:12           ` Artem Shimko
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Lunn @ 2026-08-04 14:41 UTC (permalink / raw)
  To: Artem Shimko
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

On Tue, Aug 04, 2026 at 05:08:49PM +0300, Artem Shimko wrote:
> Hi Andrew,
> 
> On Tue, Aug 4, 2026 at 4:32 PM Andrew Lunn <andrew@lunn.ch> wrote:
> > 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
  2026-08-04 14:41         ` Andrew Lunn
@ 2026-08-04 15:12           ` Artem Shimko
  0 siblings, 0 replies; 16+ messages in thread
From: Artem Shimko @ 2026-08-04 15:12 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Heiner Kallweit, Russell King, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Maxime Chevallier,
	linux-kernel, devicetree

Hi Andrew,

On Tue, Aug 4, 2026 at 5:41 PM Andrew Lunn <andrew@lunn.ch> wrote:

> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-08-04 15:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 10:17 [PATCH net-next v5 0/3] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
2026-08-03 10:17 ` [PATCH net-next v5 1/3] dt-bindings: vendor-prefixes: add Guangdong Dapu Telecom Co., Ltd Artem Shimko
2026-08-04  6:46   ` Krzysztof Kozlowski
2026-08-04  7:14     ` Artem Shimko
2026-08-03 10:17 ` [PATCH net-next v5 2/3] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding Artem Shimko
2026-08-03 10:17 ` [PATCH net-next v5 3/3] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
2026-08-04  2:30   ` Andrew Lunn
2026-08-04  7:13     ` Artem Shimko
2026-08-04 13:26       ` Andrew Lunn
2026-08-04 14:05         ` Artem Shimko
2026-08-04  2:32 ` [PATCH net-next v5 0/3] Add " Andrew Lunn
2026-08-04  7:03   ` Artem Shimko
2026-08-04 13:32     ` Andrew Lunn
2026-08-04 14:08       ` Artem Shimko
2026-08-04 14:41         ` Andrew Lunn
2026-08-04 15:12           ` Artem Shimko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox