net: phy: dp83867: default to 2ns delay if unspecified in device-tree
Subsystems (2)
PATCH 1/1 net: phy: dp83867: default to 2ns delay if unspecified in device-tree
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").
---
Hello,
This patch is based on commit47e064f1317 Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
of the master branch of U-Boot.
This patch fixes Ethernet issues on AM62D2-EVM with the DP83867 Ethernet PHY. Although all platforms using the DP83867 Ethernet PHY have switched from "rgmii-rxid" to "rgmii-id" in the device-tree, they haven't faced any issues due to the "ti,rx-internal-delay" property being retained. For AM62D2 however, the device-tree had "rgmii-id" specified as the phy-mode from the start, as a result of which, the delay was never specified. This issue has been handled in Linux by an update to the DP83867 driver as mentioned in the commit message above. A similar update is required for U-Boot as well, which is being implemented by this patch.
Patch has been tested on AM62D2-EVM (using 'rgmii-id' and doesn't have the delay property) and on J7200-EVM (using 'rgmii-id' but has the delay property).
AM62D2 Logs:
https://gist.github.com/Siddharth-Vadapalli-at-TI/230497066b1f746e074ea230e9d10fdd
J7200 Logs:
https://gist.github.com/Siddharth-Vadapalli-at-TI/bc55607aedffa9a51df4e3557298ff92
Regards,
Siddharth.
drivers/net/phy/dp83867.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/phy/dp83867.c +4 -12
@@ -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 ;
Signature · 1 line
2.51.1
Quoted 14 lines · Siddharth Vadapalli
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.
Quoted 4 lines
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 <[email protected]>
--
Anshul Dalal <[email protected]>