Lines Matching refs:phydev

334 static int lan937x_dsp_workaround(struct phy_device *phydev, u16 ereg, u8 bank)  in lan937x_dsp_workaround()  argument
340 mutex_lock(&phydev->lock); in lan937x_dsp_workaround()
342 rc = phy_read(phydev, LAN87XX_EXT_REG_CTL); in lan937x_dsp_workaround()
356 rc = phy_write(phydev, LAN87XX_EXT_REG_CTL, val); in lan937x_dsp_workaround()
360 mutex_unlock(&phydev->lock); in lan937x_dsp_workaround()
365 static int access_ereg(struct phy_device *phydev, u8 mode, u8 bank, in access_ereg() argument
376 rc = phy_write(phydev, offset, val); in access_ereg()
378 rc = phy_read(phydev, offset); in access_ereg()
384 rc = phy_write(phydev, LAN87XX_EXT_REG_WR_DATA, val); in access_ereg()
394 if (phydev->phy_id == PHY_ID_LAN937X) { in access_ereg()
395 rc = lan937x_dsp_workaround(phydev, ereg, bank); in access_ereg()
400 rc = phy_write(phydev, LAN87XX_EXT_REG_CTL, ereg); in access_ereg()
405 rc = phy_read(phydev, LAN87XX_EXT_REG_RD_DATA); in access_ereg()
410 static int access_ereg_modify_changed(struct phy_device *phydev, in access_ereg_modify_changed() argument
418 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, bank, offset, val); in access_ereg_modify_changed()
423 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, bank, offset, new); in access_ereg_modify_changed()
428 static int access_smi_poll_timeout(struct phy_device *phydev, in access_smi_poll_timeout() argument
433 return phy_read_poll_timeout(phydev, offset, val, (val & mask) == clr, in access_smi_poll_timeout()
437 static int lan87xx_config_rgmii_delay(struct phy_device *phydev) in lan87xx_config_rgmii_delay() argument
441 if (!phy_interface_is_rgmii(phydev)) in lan87xx_config_rgmii_delay()
444 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_config_rgmii_delay()
449 switch (phydev->interface) { in lan87xx_config_rgmii_delay()
470 return access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_config_rgmii_delay()
474 static int lan87xx_phy_init_cmd(struct phy_device *phydev, in lan87xx_phy_init_cmd() argument
482 ret = access_smi_poll_timeout(phydev, in lan87xx_phy_init_cmd()
487 ret = access_ereg(phydev, cmd_seq[i].mode, in lan87xx_phy_init_cmd()
498 static int lan87xx_phy_init(struct phy_device *phydev) in lan87xx_phy_init() argument
659 rc = genphy_soft_reset(phydev); in lan87xx_phy_init()
664 rc = lan87xx_phy_init_cmd(phydev, hw_init, ARRAY_SIZE(hw_init)); in lan87xx_phy_init()
668 rc = genphy_read_master_slave(phydev); in lan87xx_phy_init()
675 if (phydev->master_slave_state == MASTER_SLAVE_STATE_SLAVE) { in lan87xx_phy_init()
676 rc = lan87xx_phy_init_cmd(phydev, slave_init, in lan87xx_phy_init()
682 rc = lan87xx_phy_init_cmd(phydev, phy_init, ARRAY_SIZE(phy_init)); in lan87xx_phy_init()
686 return lan87xx_config_rgmii_delay(phydev); in lan87xx_phy_init()
689 static int lan87xx_phy_config_intr(struct phy_device *phydev) in lan87xx_phy_config_intr() argument
693 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lan87xx_phy_config_intr()
695 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
699 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); in lan87xx_phy_config_intr()
703 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
709 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_phy_config_intr()
717 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
722 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
726 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
730 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); in lan87xx_phy_config_intr()
734 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
740 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_phy_config_intr()
748 static irqreturn_t lan87xx_handle_interrupt(struct phy_device *phydev) in lan87xx_handle_interrupt() argument
752 irq_status = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_handle_interrupt()
756 phy_error(phydev); in lan87xx_handle_interrupt()
760 irq_status = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); in lan87xx_handle_interrupt()
762 phy_error(phydev); in lan87xx_handle_interrupt()
769 phy_trigger_machine(phydev); in lan87xx_handle_interrupt()
774 static int lan87xx_config_init(struct phy_device *phydev) in lan87xx_config_init() argument
776 int rc = lan87xx_phy_init(phydev); in lan87xx_config_init()
781 static int microchip_cable_test_start_common(struct phy_device *phydev) in microchip_cable_test_start_common() argument
788 bmcr = phy_read(phydev, MII_BMCR); in microchip_cable_test_start_common()
792 bmsr = phy_read(phydev, MII_BMSR); in microchip_cable_test_start_common()
798 ret = phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0); in microchip_cable_test_start_common()
801 ret = genphy_soft_reset(phydev); in microchip_cable_test_start_common()
813 static int lan87xx_cable_test_start(struct phy_device *phydev) in lan87xx_cable_test_start() argument
843 rc = microchip_cable_test_start_common(phydev); in lan87xx_cable_test_start()
849 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
855 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
862 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_AFE, in lan87xx_cable_test_start()
866 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
872 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
880 rc = access_ereg_modify_changed(phydev, in lan87xx_cable_test_start()
888 rc = access_ereg(phydev, cable_test[i].mode, in lan87xx_cable_test_start()
916 static int lan87xx_cable_test_report(struct phy_device *phydev) in lan87xx_cable_test_report() argument
928 gain_idx = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_cable_test_report()
931 pos_peak = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_cable_test_report()
933 neg_peak = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_cable_test_report()
935 pos_peak_time = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_cable_test_report()
937 neg_peak_time = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_cable_test_report()
974 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in lan87xx_cable_test_report()
977 return phy_init_hw(phydev); in lan87xx_cable_test_report()
980 static int lan87xx_cable_test_get_status(struct phy_device *phydev, in lan87xx_cable_test_get_status() argument
988 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_DSP, in lan87xx_cable_test_get_status()
995 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_cable_test_get_status()
1003 return lan87xx_cable_test_report(phydev); in lan87xx_cable_test_get_status()
1009 static int lan87xx_read_status(struct phy_device *phydev) in lan87xx_read_status() argument
1013 rc = phy_read(phydev, T1_MODE_STAT_REG); in lan87xx_read_status()
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()
1027 rc = genphy_read_master_slave(phydev); in lan87xx_read_status()
1031 return genphy_read_status_fixed(phydev); in lan87xx_read_status()
1034 static int lan87xx_config_aneg(struct phy_device *phydev) in lan87xx_config_aneg() argument
1039 switch (phydev->master_slave_set) { in lan87xx_config_aneg()
1049 phydev_warn(phydev, "Unsupported Master/Slave mode\n"); in lan87xx_config_aneg()
1053 ret = phy_modify_changed(phydev, MII_CTRL1000, CTL1000_AS_MASTER, ctl); in lan87xx_config_aneg()
1055 return phy_init_hw(phydev); in lan87xx_config_aneg()
1060 static int lan87xx_get_sqi(struct phy_device *phydev) in lan87xx_get_sqi() argument
1065 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_get_sqi()
1070 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_get_sqi()
1080 static int lan87xx_get_sqi_max(struct phy_device *phydev) in lan87xx_get_sqi_max() argument
1085 static int lan887x_rgmii_init(struct phy_device *phydev) in lan887x_rgmii_init() argument
1090 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_rgmii_init()
1097 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_CFG_REG0, in lan887x_rgmii_init()
1104 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_rgmii_init()
1114 return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_rgmii_init()
1119 static int lan887x_sgmii_init(struct phy_device *phydev) in lan887x_sgmii_init() argument
1124 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_sgmii_init()
1131 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_CFG_REG0, in lan887x_sgmii_init()
1140 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_CFG_REG0, in lan887x_sgmii_init()
1146 return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, LAN887X_SGMII_PCS_CFG, in lan887x_sgmii_init()
1150 static int lan887x_config_rgmii_en(struct phy_device *phydev) in lan887x_config_rgmii_en() argument
1156 ret = lan887x_rgmii_init(phydev); in lan887x_config_rgmii_en()
1161 txc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_DLL_CFG_REG0); in lan887x_config_rgmii_en()
1166 rxc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_DLL_CFG_REG1); in lan887x_config_rgmii_en()
1179 switch (phydev->interface) { in lan887x_config_rgmii_en()
1197 WARN_ONCE(1, "Invalid phydev interface %d\n", phydev->interface); in lan887x_config_rgmii_en()
1202 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_DLL_CFG_REG1, in lan887x_config_rgmii_en()
1208 return phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_MIS_DLL_CFG_REG0, in lan887x_config_rgmii_en()
1212 static int lan887x_config_phy_interface(struct phy_device *phydev) in lan887x_config_phy_interface() argument
1219 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_EFUSE_READ_DAT9); in lan887x_config_phy_interface()
1230 switch (phydev->interface) { in lan887x_config_phy_interface()
1240 ret = lan887x_config_rgmii_en(phydev); in lan887x_config_phy_interface()
1247 ret = lan887x_sgmii_init(phydev); in lan887x_config_phy_interface()
1257 static int lan887x_get_features(struct phy_device *phydev) in lan887x_get_features() argument
1261 ret = genphy_c45_pma_read_abilities(phydev); in lan887x_get_features()
1266 linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, phydev->supported); in lan887x_get_features()
1271 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in lan887x_get_features()
1276 static int lan887x_phy_init(struct phy_device *phydev) in lan887x_phy_init() argument
1278 struct lan887x_priv *priv = phydev->priv; in lan887x_phy_init()
1281 if (!priv->init_done && phy_interrupt_is_valid(phydev)) { in lan887x_phy_init()
1282 priv->clock = mchp_rds_ptp_probe(phydev, MDIO_MMD_VEND1, in lan887x_phy_init()
1289 phy_modify_mmd(phydev, MDIO_MMD_VEND1, in lan887x_phy_init()
1301 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_phy_init()
1310 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, in lan887x_phy_init()
1318 return lan887x_config_phy_interface(phydev); in lan887x_phy_init()
1321 static int lan887x_phy_config(struct phy_device *phydev, in lan887x_phy_config() argument
1327 ret = phy_write_mmd(phydev, reg_map[i].mmd, in lan887x_phy_config()
1336 static int lan887x_phy_setup(struct phy_device *phydev) in lan887x_phy_setup() argument
1368 return lan887x_phy_config(phydev, phy_cfg, ARRAY_SIZE(phy_cfg)); in lan887x_phy_setup()
1371 static int lan887x_100M_setup(struct phy_device *phydev) in lan887x_100M_setup() argument
1376 if (phydev->master_slave_set == MASTER_SLAVE_CFG_MASTER_FORCE || in lan887x_100M_setup()
1377 phydev->master_slave_set == MASTER_SLAVE_CFG_MASTER_PREFERRED){ in lan887x_100M_setup()
1384 ret = lan887x_phy_config(phydev, phy_cfg, ARRAY_SIZE(phy_cfg)); in lan887x_100M_setup()
1391 ret = lan887x_phy_config(phydev, phy_cfg, ARRAY_SIZE(phy_cfg)); in lan887x_100M_setup()
1396 return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, LAN887X_REG_REG26, in lan887x_100M_setup()
1400 static int lan887x_1000M_setup(struct phy_device *phydev) in lan887x_1000M_setup() argument
1409 ret = lan887x_phy_config(phydev, phy_cfg, ARRAY_SIZE(phy_cfg)); in lan887x_1000M_setup()
1413 return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, LAN887X_DSP_PMA_CONTROL, in lan887x_1000M_setup()
1417 static int lan887x_link_setup(struct phy_device *phydev) in lan887x_link_setup() argument
1421 if (phydev->speed == SPEED_1000) in lan887x_link_setup()
1422 ret = lan887x_1000M_setup(phydev); in lan887x_link_setup()
1423 else if (phydev->speed == SPEED_100) in lan887x_link_setup()
1424 ret = lan887x_100M_setup(phydev); in lan887x_link_setup()
1432 static int lan887x_phy_reset(struct phy_device *phydev) in lan887x_phy_reset() argument
1437 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_PMAPMD, LAN887X_DSP_PMA_CONTROL, in lan887x_phy_reset()
1443 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, LAN887X_REG_REG26, in lan887x_phy_reset()
1449 ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, LAN887X_CHIP_SOFT_RST, in lan887x_phy_reset()
1455 ret = phy_modify(phydev, MII_BMCR, BMCR_RESET, BMCR_RESET); in lan887x_phy_reset()
1460 return phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET), in lan887x_phy_reset()
1464 static int lan887x_phy_reconfig(struct phy_device *phydev) in lan887x_phy_reconfig() argument
1468 linkmode_zero(phydev->advertising); in lan887x_phy_reconfig()
1470 ret = genphy_c45_pma_setup_forced(phydev); in lan887x_phy_reconfig()
1474 return lan887x_link_setup(phydev); in lan887x_phy_reconfig()
1477 static int lan887x_config_aneg(struct phy_device *phydev) in lan887x_config_aneg() argument
1484 ret = lan887x_phy_reset(phydev); in lan887x_config_aneg()
1488 return lan887x_phy_reconfig(phydev); in lan887x_config_aneg()
1491 static int lan887x_probe(struct phy_device *phydev) in lan887x_probe() argument
1495 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in lan887x_probe()
1500 phydev->priv = priv; in lan887x_probe()
1502 return lan887x_phy_setup(phydev); in lan887x_probe()
1505 static u64 lan887x_get_stat(struct phy_device *phydev, int i) in lan887x_get_stat() argument
1508 struct lan887x_priv *priv = phydev->priv; in lan887x_get_stat()
1513 val = phy_read_mmd(phydev, stat.mmd, stat.reg); in lan887x_get_stat()
1515 val = phy_read(phydev, stat.reg); in lan887x_get_stat()
1528 static void lan887x_get_stats(struct phy_device *phydev, in lan887x_get_stats() argument
1532 data[i] = lan887x_get_stat(phydev, i); in lan887x_get_stats()
1535 static int lan887x_get_sset_count(struct phy_device *phydev) in lan887x_get_sset_count() argument
1540 static void lan887x_get_strings(struct phy_device *phydev, u8 *data) in lan887x_get_strings() argument
1546 static int lan887x_config_intr(struct phy_device *phydev) in lan887x_config_intr() argument
1548 struct lan887x_priv *priv = phydev->priv; in lan887x_config_intr()
1551 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lan887x_config_intr()
1553 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_INT_STS); in lan887x_config_intr()
1558 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, LAN887X_INT_MSK, in lan887x_config_intr()
1561 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, LAN887X_INT_MSK, in lan887x_config_intr()
1566 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_INT_STS); in lan887x_config_intr()
1571 if (phy_is_default_hwtstamp(phydev)) { in lan887x_config_intr()
1575 (phydev->interrupts == in lan887x_config_intr()
1582 static irqreturn_t lan887x_handle_interrupt(struct phy_device *phydev) in lan887x_handle_interrupt() argument
1584 struct lan887x_priv *priv = phydev->priv; in lan887x_handle_interrupt()
1588 irq_status = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_INT_STS); in lan887x_handle_interrupt()
1590 phy_error(phydev); in lan887x_handle_interrupt()
1595 phy_trigger_machine(phydev); in lan887x_handle_interrupt()
1605 static int lan887x_cd_reset(struct phy_device *phydev, in lan887x_cd_reset() argument
1612 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, LAN887X_CHIP_HARD_RST, in lan887x_cd_reset()
1618 rc = phy_read_poll_timeout(phydev, MII_PHYSID2, val, in lan887x_cd_reset()
1627 rc = lan887x_phy_setup(phydev); in lan887x_cd_reset()
1631 rc = lan887x_phy_init(phydev); in lan887x_cd_reset()
1635 rc = lan887x_config_intr(phydev); in lan887x_cd_reset()
1639 rc = lan887x_phy_reconfig(phydev); in lan887x_cd_reset()
1647 static int lan887x_cable_test_prep(struct phy_device *phydev, in lan887x_cable_test_prep() argument
1664 rc = lan887x_cd_reset(phydev, CD_TEST_INIT); in lan887x_cable_test_prep()
1671 rc = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL, in lan887x_cable_test_prep()
1676 rc = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, 0x80b0, 0x0038); in lan887x_cable_test_prep()
1680 rc = phy_modify_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_prep()
1687 rc = phy_write_mmd(phydev, values[i].mmd, values[i].reg, in lan887x_cable_test_prep()
1694 rc = phy_write_mmd(phydev, values[i].mmd, in lan887x_cable_test_prep()
1702 rc = phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, in lan887x_cable_test_prep()
1710 rc = phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_REG_REG26, in lan887x_cable_test_prep()
1723 return phy_write_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_prep()
1728 static int lan887x_cable_test_chk(struct phy_device *phydev, in lan887x_cable_test_chk() argument
1740 rc = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_chk()
1748 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_chk()
1758 return phy_write_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_chk()
1763 static int lan887x_cable_test_start(struct phy_device *phydev) in lan887x_cable_test_start() argument
1767 rc = lan887x_cable_test_prep(phydev, TEST_MODE_NORMAL); in lan887x_cable_test_start()
1769 ret = lan887x_cd_reset(phydev, CD_TEST_DONE); in lan887x_cable_test_start()
1779 static int lan887x_cable_test_report(struct phy_device *phydev) in lan887x_cable_test_report() argument
1795 gain_idx = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1802 pos_peak = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1809 neg_peak = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1816 pos_peak_time = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1823 neg_peak_time = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1866 rc = lan887x_cable_test_prep(phydev, TEST_MODE_HYBRID); in lan887x_cable_test_report()
1871 rc = lan887x_cable_test_chk(phydev, TEST_MODE_HYBRID); in lan887x_cable_test_report()
1876 gain_idx_hybrid = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1883 pos_peak_time_hybrid = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1916 rc = lan887x_cd_reset(phydev, CD_TEST_DONE); in lan887x_cable_test_report()
1921 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in lan887x_cable_test_report()
1923 ethnl_cable_test_fault_length(phydev, ETHTOOL_A_CABLE_PAIR_A, length); in lan887x_cable_test_report()
1929 ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, in lan887x_cable_test_report()
1937 ret = lan887x_cd_reset(phydev, CD_TEST_DONE); in lan887x_cable_test_report()
1945 static int lan887x_cable_test_get_status(struct phy_device *phydev, in lan887x_cable_test_get_status() argument
1950 rc = lan887x_cable_test_chk(phydev, TEST_MODE_NORMAL); in lan887x_cable_test_get_status()
1962 return lan887x_cable_test_report(phydev); in lan887x_cable_test_get_status()
1971 static int lan887x_get_sqi_100M(struct phy_device *phydev) in lan887x_get_sqi_100M() argument
1979 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, in lan887x_get_sqi_100M()
1985 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, LAN887X_SQI_CONFIG_100, in lan887x_get_sqi_100M()
1990 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_SQI_CONFIG_100); in lan887x_get_sqi_100M()
1994 rc = phy_modify_mmd(phydev, MDIO_MMD_VEND1, LAN887X_POKE_PEEK_100, in lan887x_get_sqi_100M()
2006 rc = genphy_c45_read_link(phydev); in lan887x_get_sqi_100M()
2010 if (!phydev->link) in lan887x_get_sqi_100M()
2015 rc = phy_write_mmd(phydev, MDIO_MMD_VEND1, in lan887x_get_sqi_100M()
2021 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, in lan887x_get_sqi_100M()
2030 rc = genphy_c45_read_link(phydev); in lan887x_get_sqi_100M()
2034 if (!phydev->link) in lan887x_get_sqi_100M()
2070 static int lan887x_get_sqi(struct phy_device *phydev) in lan887x_get_sqi() argument
2074 if (phydev->speed != SPEED_1000 && in lan887x_get_sqi()
2075 phydev->speed != SPEED_100) in lan887x_get_sqi()
2078 if (phydev->speed == SPEED_100) in lan887x_get_sqi()
2079 return lan887x_get_sqi_100M(phydev); in lan887x_get_sqi()
2082 rc = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, in lan887x_get_sqi()
2089 rc = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, in lan887x_get_sqi()
2097 rc = phy_read_mmd(phydev, MDIO_MMD_VEND1, LAN887X_DCQ_SQI_STATUS); in lan887x_get_sqi()