Lines Matching +full:clock +full:- +full:error +full:- +full:detect

1 // SPDX-License-Identifier: GPL-2.0
274 #define SQI_INLIERS_START ((SQI_SAMPLES - SQI_INLIERS_NUM) / 2)
282 /* TEST_MODE_NORMAL: Non-hybrid results to calculate cable status(open/short/ok)
330 struct mchp_rds_ptp_clock *clock; member
340 mutex_lock(&phydev->lock); in lan937x_dsp_workaround()
360 mutex_unlock(&phydev->lock); in lan937x_dsp_workaround()
372 return -EINVAL; in access_ereg()
394 if (phydev->phy_id == PHY_ID_LAN937X) { in access_ereg()
416 return -EINVAL; in access_ereg_modify_changed()
449 switch (phydev->interface) { in lan87xx_config_rgmii_delay()
510 /* Equalizer Full Duplex Freeze - T1 Slave */ in lan87xx_phy_init()
534 /* Lock Stage 2-3 Multi Factor Config */ in lan87xx_phy_init()
643 /* Tx AMP - 0x06 */ in lan87xx_phy_init()
675 if (phydev->master_slave_state == MASTER_SLAVE_STATE_SLAVE) { in lan87xx_phy_init()
693 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lan87xx_phy_config_intr()
785 /* If auto-negotiation is enabled, but not complete, the cable in microchip_cable_test_start_common()
786 * test never completes. So disable auto-neg. in microchip_cable_test_start_common()
831 /* clock align for each iteration */ in lan87xx_cable_test_start()
848 /* check if part is alive - if not, return diagnostic error */ in lan87xx_cable_test_start()
926 int detect = -1; in lan87xx_cable_test_report() local
930 /* read non-hybrid results */ in lan87xx_cable_test_report()
941 /* calculate non-hybrid values */ in lan87xx_cable_test_report()
950 ((pos_peak_in_phases - neg_peak_in_phases) >= min_time_diff) && in lan87xx_cable_test_report()
951 ((pos_peak_in_phases - neg_peak_in_phases) < max_time_diff) && in lan87xx_cable_test_report()
955 ((neg_peak_in_phases - pos_peak_in_phases) >= min_time_diff) && in lan87xx_cable_test_report()
956 ((neg_peak_in_phases - pos_peak_in_phases) < max_time_diff) && in lan87xx_cable_test_report()
961 detect = 2; in lan87xx_cable_test_report()
963 detect = 1; in lan87xx_cable_test_report()
967 if (detect == 1 || detect == 2) in lan87xx_cable_test_report()
972 detect = 0; in lan87xx_cable_test_report()
975 lan87xx_cable_test_report_trans(detect)); in lan87xx_cable_test_report()
1018 phydev->link = 1; in lan87xx_read_status()
1020 phydev->link = 0; in lan87xx_read_status()
1022 phydev->speed = SPEED_UNKNOWN; in lan87xx_read_status()
1023 phydev->duplex = DUPLEX_UNKNOWN; in lan87xx_read_status()
1024 phydev->pause = 0; in lan87xx_read_status()
1025 phydev->asym_pause = 0; in lan87xx_read_status()
1043 switch (phydev->master_slave_set) { in lan87xx_config_aneg()
1054 return -EOPNOTSUPP; in lan87xx_config_aneg()
1114 /* LAN887x Errata: RGMII rx clock active in SGMII mode in lan887x_rgmii_init()
1116 * Re-enabling it for RGMII mode in lan887x_rgmii_init()
1141 /* LAN887x Errata: RGMII rx clock active in SGMII mode. in lan887x_sgmii_init()
1175 * RGMII - TX & RX delays are either added by MAC or not needed, in lan887x_config_rgmii_en()
1177 * RGMII_ID - Configures phy to enable TX & RX delays, MAC shouldn't add in lan887x_config_rgmii_en()
1178 * RGMII_RX_ID - Configures the PHY to enable the RX delay. in lan887x_config_rgmii_en()
1180 * RGMII_TX_ID - Configures the PHY to enable the TX delay. in lan887x_config_rgmii_en()
1183 switch (phydev->interface) { in lan887x_config_rgmii_en()
1201 WARN_ONCE(1, "Invalid phydev interface %d\n", phydev->interface); in lan887x_config_rgmii_en()
1234 switch (phydev->interface) { in lan887x_config_phy_interface()
1240 ret = -EOPNOTSUPP; in lan887x_config_phy_interface()
1248 ret = -EOPNOTSUPP; in lan887x_config_phy_interface()
1255 ret = -EOPNOTSUPP; in lan887x_config_phy_interface()
1270 linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, phydev->supported); in lan887x_get_features()
1272 /* First patch only supports 100Mbps and 1000Mbps force-mode. in lan887x_get_features()
1273 * T1 Auto-Negotiation (Clause 98 of IEEE 802.3) will be added later. in lan887x_get_features()
1275 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in lan887x_get_features()
1282 struct lan887x_priv *priv = phydev->priv; in lan887x_phy_init()
1285 if (!priv->init_done && phy_interrupt_is_valid(phydev)) { in lan887x_phy_init()
1286 priv->clock = mchp_rds_ptp_probe(phydev, MDIO_MMD_VEND1, in lan887x_phy_init()
1289 if (IS_ERR(priv->clock)) in lan887x_phy_init()
1290 return PTR_ERR(priv->clock); in lan887x_phy_init()
1299 priv->clock->event_pin = 3; in lan887x_phy_init()
1301 priv->init_done = true; in lan887x_phy_init()
1380 if (phydev->master_slave_set == MASTER_SLAVE_CFG_MASTER_FORCE || in lan887x_100M_setup()
1381 phydev->master_slave_set == MASTER_SLAVE_CFG_MASTER_PREFERRED){ in lan887x_100M_setup()
1423 int ret = -EINVAL; in lan887x_link_setup()
1425 if (phydev->speed == SPEED_1000) in lan887x_link_setup()
1427 else if (phydev->speed == SPEED_100) in lan887x_link_setup()
1452 /* Chiptop soft-reset to allow the speed/mode change */ in lan887x_phy_reset()
1458 /* CL22 soft-reset to let the link re-train */ in lan887x_phy_reset()
1472 linkmode_zero(phydev->advertising); in lan887x_phy_reconfig()
1499 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in lan887x_probe()
1501 return -ENOMEM; in lan887x_probe()
1503 priv->init_done = false; in lan887x_probe()
1504 phydev->priv = priv; in lan887x_probe()
1512 struct lan887x_priv *priv = phydev->priv; in lan887x_get_stat()
1524 val = val & ((1 << stat.bits) - 1); in lan887x_get_stat()
1525 priv->stats[i] += val; in lan887x_get_stat()
1526 ret = priv->stats[i]; in lan887x_get_stat()
1552 struct lan887x_priv *priv = phydev->priv; in lan887x_config_intr()
1555 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lan887x_config_intr()
1576 return mchp_rds_ptp_top_config_intr(priv->clock, in lan887x_config_intr()
1579 (phydev->interrupts == in lan887x_config_intr()
1588 struct lan887x_priv *priv = phydev->priv; in lan887x_handle_interrupt()
1604 rc = mchp_rds_ptp_handle_interrupt(priv->clock); in lan887x_handle_interrupt()
1615 /* Chip hard-reset */ in lan887x_cd_reset()
1758 return -EAGAIN; in lan887x_cable_test_chk()
1793 int detect; in lan887x_cable_test_report() local
1798 /* Read non-hybrid results */ in lan887x_cable_test_report()
1803 goto error; in lan887x_cable_test_report()
1810 goto error; in lan887x_cable_test_report()
1817 goto error; in lan887x_cable_test_report()
1824 goto error; in lan887x_cable_test_report()
1831 goto error; in lan887x_cable_test_report()
1834 /* Calculate non-hybrid values */ in lan887x_cable_test_report()
1844 ((pos_peak_in_phases - neg_peak_in_phases) >= in lan887x_cable_test_report()
1846 ((pos_peak_in_phases - neg_peak_in_phases) < in lan887x_cable_test_report()
1849 detect = LAN87XX_CABLE_TEST_SAME_SHORT; in lan887x_cable_test_report()
1851 ((neg_peak_in_phases - pos_peak_in_phases) >= in lan887x_cable_test_report()
1853 ((neg_peak_in_phases - pos_peak_in_phases) < in lan887x_cable_test_report()
1856 detect = LAN87XX_CABLE_TEST_OPEN; in lan887x_cable_test_report()
1858 detect = LAN87XX_CABLE_TEST_OK; in lan887x_cable_test_report()
1861 detect = LAN87XX_CABLE_TEST_OK; in lan887x_cable_test_report()
1864 if (detect == LAN87XX_CABLE_TEST_OK) { in lan887x_cable_test_report()
1869 /* Re-initialize PHY and start cable diag test */ in lan887x_cable_test_report()
1884 goto error; in lan887x_cable_test_report()
1891 goto error; in lan887x_cable_test_report()
1901 * distance = (peak_in_phases - peak_in_phases_hybrid) * in lan887x_cable_test_report()
1909 if (detect == LAN87XX_CABLE_TEST_OPEN) { in lan887x_cable_test_report()
1910 distance = (((pos_peak_in_phases - pos_peak_in_phases_hybrid) in lan887x_cable_test_report()
1912 } else if (detect == LAN87XX_CABLE_TEST_SAME_SHORT) { in lan887x_cable_test_report()
1913 distance = (((neg_peak_in_phases - pos_peak_in_phases_hybrid) in lan887x_cable_test_report()
1926 lan87xx_cable_test_report_trans(detect)); in lan887x_cable_test_report()
1939 error: in lan887x_cable_test_report()
1945 /* Return error in failure case */ in lan887x_cable_test_report()
1957 if (rc == -EAGAIN) in lan887x_cable_test_get_status()
1972 return *(u16 *)a - *(u16 *)b; in sqi_compare()
1996 return -EINVAL; in lan887x_get_sqi_100M()
2014 if (!phydev->link) in lan887x_get_sqi_100M()
2015 return -ENETDOWN; in lan887x_get_sqi_100M()
2038 if (!phydev->link) in lan887x_get_sqi_100M()
2039 return -ENETDOWN; in lan887x_get_sqi_100M()
2078 if (phydev->speed != SPEED_1000 && in lan887x_get_sqi()
2079 phydev->speed != SPEED_100) in lan887x_get_sqi()
2080 return -ENETDOWN; in lan887x_get_sqi()
2082 if (phydev->speed == SPEED_100) in lan887x_get_sqi()