]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: phy: dp83867: default to 2ns delay if unspecified in device-tree
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Mon, 6 Apr 2026 12:45:57 +0000 (18:15 +0530)
committerJerome Forissier <jerome.forissier@arm.com>
Wed, 6 May 2026 09:07:22 +0000 (11:07 +0200)
Since Linux commit c360eb0c3ccb ("dt-bindings: net: ethernet-controller:
Add informative text about RGMII delays"), the interpretation of RGMII
delays has changed. Prior to the commit, the RGMII Variant among "rgmii",
"rgmii-id", "rgmii-rxid" and "rgmii-txid" clearly specified whether it is
the MAC or the PHY that "should" add the delay. However, post that commit,
the RGMII Variant only specifies whether or not there is a delay on the
PCB traces between the MAC and the PHY, leaving it open as to who adds the
delay.

Hence, instead of enforcing the existence of the device-tree properties
"ti,rx-internal-delay" and "ti,tx-internal-delay", default to a delay
of 2ns, while continuing to override this delay with the aforementioned
properties, if they exist in the device-tree.

This is in line with the Linux driver implementation updated by commit
6bf78849371d ("net: phy: dp83867: use 2ns delay if not specified in DTB").

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Anshul Dalal <anshuld@ti.com>
drivers/net/phy/dp83867.c

index 7ce03b59b6aba17f674a53d1e882939af564e5b6..ebed61de13382ee684e0cbb2675263f9e5eb9ffc 100644 (file)
@@ -203,32 +203,24 @@ static int dp83867_of_init(struct phy_device *phydev)
                                "Should be 'rgmii-id' to use internal delays\n");
        }
 
-       /* RX delay *must* be specified if internal delay of RX is used. */
+       dp83867->rx_id_delay = DP83867_RGMIIDCTL_2_00_NS;
        if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
            phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
                ret = ofnode_read_u32(node, "ti,rx-internal-delay",
                                      &dp83867->rx_id_delay);
-               if (ret) {
-                       pr_debug("ti,rx-internal-delay must be specified\n");
-                       return ret;
-               }
-               if (dp83867->rx_id_delay > DP83867_RGMII_RX_CLK_DELAY_MAX) {
+               if (!ret && dp83867->rx_id_delay > DP83867_RGMII_RX_CLK_DELAY_MAX) {
                        pr_debug("ti,rx-internal-delay value of %u out of range\n",
                                 dp83867->rx_id_delay);
                        return -EINVAL;
                }
        }
 
-       /* TX delay *must* be specified if internal delay of RX is used. */
+       dp83867->tx_id_delay = DP83867_RGMIIDCTL_2_00_NS;
        if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
            phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
                ret = ofnode_read_u32(node, "ti,tx-internal-delay",
                                      &dp83867->tx_id_delay);
-               if (ret) {
-                       debug("ti,tx-internal-delay must be specified\n");
-                       return ret;
-               }
-               if (dp83867->tx_id_delay > DP83867_RGMII_TX_CLK_DELAY_MAX) {
+               if (!ret && dp83867->tx_id_delay > DP83867_RGMII_TX_CLK_DELAY_MAX) {
                        pr_debug("ti,tx-internal-delay value of %u out of range\n",
                                 dp83867->tx_id_delay);
                        return -EINVAL;