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