Lines Matching refs:phydev

359 static int marvell_read_page(struct phy_device *phydev)  in marvell_read_page()  argument
361 return __phy_read(phydev, MII_MARVELL_PHY_PAGE); in marvell_read_page()
364 static int marvell_write_page(struct phy_device *phydev, int page) in marvell_write_page() argument
366 return __phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_write_page()
369 static int marvell_set_page(struct phy_device *phydev, int page) in marvell_set_page() argument
371 return phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_set_page()
374 static int marvell_ack_interrupt(struct phy_device *phydev) in marvell_ack_interrupt() argument
379 err = phy_read(phydev, MII_M1011_IEVENT); in marvell_ack_interrupt()
387 static int marvell_config_intr(struct phy_device *phydev) in marvell_config_intr() argument
391 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in marvell_config_intr()
392 err = marvell_ack_interrupt(phydev); in marvell_config_intr()
396 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
399 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
404 err = marvell_ack_interrupt(phydev); in marvell_config_intr()
410 static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev) in marvell_handle_interrupt() argument
414 irq_status = phy_read(phydev, MII_M1011_IEVENT); in marvell_handle_interrupt()
416 phy_error(phydev); in marvell_handle_interrupt()
423 phy_trigger_machine(phydev); in marvell_handle_interrupt()
428 static int marvell_set_polarity(struct phy_device *phydev, int polarity) in marvell_set_polarity() argument
446 return phy_modify_changed(phydev, MII_M1011_PHY_SCR, in marvell_set_polarity()
450 static int marvell_config_aneg(struct phy_device *phydev) in marvell_config_aneg() argument
455 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in marvell_config_aneg()
461 err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL, in marvell_config_aneg()
466 err = genphy_config_aneg(phydev); in marvell_config_aneg()
470 if (phydev->autoneg != AUTONEG_ENABLE || changed) { in marvell_config_aneg()
475 err = genphy_soft_reset(phydev); in marvell_config_aneg()
483 static int m88e1101_config_aneg(struct phy_device *phydev) in m88e1101_config_aneg() argument
491 err = genphy_soft_reset(phydev); in m88e1101_config_aneg()
495 err = phy_write(phydev, 0x1d, 0x1f); in m88e1101_config_aneg()
499 err = phy_write(phydev, 0x1e, 0x200c); in m88e1101_config_aneg()
503 err = phy_write(phydev, 0x1d, 0x5); in m88e1101_config_aneg()
507 err = phy_write(phydev, 0x1e, 0); in m88e1101_config_aneg()
511 err = phy_write(phydev, 0x1e, 0x100); in m88e1101_config_aneg()
515 return marvell_config_aneg(phydev); in m88e1101_config_aneg()
532 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
537 if (!phydev->mdio.dev.of_node) in marvell_of_reg_init()
540 paddr = of_get_property(phydev->mdio.dev.of_node, in marvell_of_reg_init()
545 saved_page = phy_save_page(phydev); in marvell_of_reg_init()
560 ret = marvell_write_page(phydev, page); in marvell_of_reg_init()
567 val = __phy_read(phydev, reg); in marvell_of_reg_init()
576 ret = __phy_write(phydev, reg, val); in marvell_of_reg_init()
581 return phy_restore_page(phydev, saved_page, ret); in marvell_of_reg_init()
584 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
590 static int m88e1121_config_aneg_rgmii_delays(struct phy_device *phydev) in m88e1121_config_aneg_rgmii_delays() argument
594 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in m88e1121_config_aneg_rgmii_delays()
597 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in m88e1121_config_aneg_rgmii_delays()
599 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in m88e1121_config_aneg_rgmii_delays()
604 return phy_modify_paged_changed(phydev, MII_MARVELL_MSCR_PAGE, in m88e1121_config_aneg_rgmii_delays()
609 static int m88e1121_config_aneg(struct phy_device *phydev) in m88e1121_config_aneg() argument
614 if (phy_interface_is_rgmii(phydev)) { in m88e1121_config_aneg()
615 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1121_config_aneg()
622 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1121_config_aneg()
628 err = genphy_config_aneg(phydev); in m88e1121_config_aneg()
632 if (phydev->autoneg != AUTONEG_ENABLE || changed) { in m88e1121_config_aneg()
636 err = genphy_soft_reset(phydev); in m88e1121_config_aneg()
644 static int m88e1318_config_aneg(struct phy_device *phydev) in m88e1318_config_aneg() argument
648 err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1318_config_aneg()
654 return m88e1121_config_aneg(phydev); in m88e1318_config_aneg()
692 static int marvell_config_aneg_fiber(struct phy_device *phydev) in marvell_config_aneg_fiber() argument
698 if (phydev->autoneg != AUTONEG_ENABLE) in marvell_config_aneg_fiber()
699 return genphy_setup_forced(phydev); in marvell_config_aneg_fiber()
702 linkmode_and(phydev->advertising, phydev->advertising, in marvell_config_aneg_fiber()
703 phydev->supported); in marvell_config_aneg_fiber()
705 adv = linkmode_adv_to_fiber_adv_t(phydev->advertising); in marvell_config_aneg_fiber()
708 err = phy_modify_changed(phydev, MII_ADVERTISE, in marvell_config_aneg_fiber()
717 return genphy_check_and_restart_aneg(phydev, changed); in marvell_config_aneg_fiber()
720 static unsigned int m88e1111_inband_caps(struct phy_device *phydev, in m88e1111_inband_caps() argument
734 static int m88e1111_config_inband(struct phy_device *phydev, unsigned int modes) in m88e1111_config_inband() argument
739 if (phydev->interface != PHY_INTERFACE_MODE_1000BASEX && in m88e1111_config_inband()
740 phydev->interface != PHY_INTERFACE_MODE_SGMII) in m88e1111_config_inband()
753 err = phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_inband()
758 return phy_modify_paged(phydev, MII_MARVELL_FIBER_PAGE, MII_BMCR, in m88e1111_config_inband()
762 static int m88e1111_config_aneg(struct phy_device *phydev) in m88e1111_config_aneg() argument
764 int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_aneg()
773 if (phydev->interface != PHY_INTERFACE_MODE_SGMII && in m88e1111_config_aneg()
776 return marvell_config_aneg(phydev); in m88e1111_config_aneg()
778 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
783 err = marvell_config_aneg(phydev); in m88e1111_config_aneg()
788 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in m88e1111_config_aneg()
792 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) in m88e1111_config_aneg()
797 err = genphy_check_and_restart_aneg(phydev, false); in m88e1111_config_aneg()
799 err = marvell_config_aneg_fiber(phydev); in m88e1111_config_aneg()
803 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
806 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
810 static int m88e1510_config_aneg(struct phy_device *phydev) in m88e1510_config_aneg() argument
814 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
819 err = m88e1318_config_aneg(phydev); in m88e1510_config_aneg()
824 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) in m88e1510_config_aneg()
828 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in m88e1510_config_aneg()
832 err = marvell_config_aneg_fiber(phydev); in m88e1510_config_aneg()
836 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
839 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
843 static void marvell_config_led(struct phy_device *phydev) in marvell_config_led() argument
848 switch (MARVELL_PHY_FAMILY_ID(phydev->phy_id)) { in marvell_config_led()
860 if (phydev->dev_flags & MARVELL_PHY_LED0_LINK_LED1_ACTIVE) in marvell_config_led()
869 err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL, in marvell_config_led()
872 phydev_warn(phydev, "Fail to config marvell phy LED.\n"); in marvell_config_led()
875 static int marvell_config_init(struct phy_device *phydev) in marvell_config_init() argument
878 marvell_config_led(phydev); in marvell_config_init()
881 return marvell_of_reg_init(phydev); in marvell_config_init()
884 static int m88e3016_config_init(struct phy_device *phydev) in m88e3016_config_init() argument
889 ret = phy_modify(phydev, MII_88E3016_PHY_SPEC_CTRL, in m88e3016_config_init()
895 return marvell_config_init(phydev); in m88e3016_config_init()
898 static int m88e1111_config_init_hwcfg_mode(struct phy_device *phydev, in m88e1111_config_init_hwcfg_mode() argument
905 return phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_init_hwcfg_mode()
912 static int m88e1111_config_init_rgmii_delays(struct phy_device *phydev) in m88e1111_config_init_rgmii_delays() argument
916 switch (phydev->interface) { in m88e1111_config_init_rgmii_delays()
931 return phy_modify(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_config_init_rgmii_delays()
936 static int m88e1111_config_init_rgmii(struct phy_device *phydev) in m88e1111_config_init_rgmii() argument
941 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rgmii()
945 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_init_rgmii()
956 return phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); in m88e1111_config_init_rgmii()
959 static int m88e1111_config_init_sgmii(struct phy_device *phydev) in m88e1111_config_init_sgmii() argument
964 phydev, in m88e1111_config_init_sgmii()
971 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_init_sgmii()
974 static int m88e1111_config_init_rtbi(struct phy_device *phydev) in m88e1111_config_init_rtbi() argument
978 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rtbi()
983 phydev, in m88e1111_config_init_rtbi()
990 err = genphy_soft_reset(phydev); in m88e1111_config_init_rtbi()
995 phydev, in m88e1111_config_init_rtbi()
1000 static int m88e1111_config_init_1000basex(struct phy_device *phydev) in m88e1111_config_init_1000basex() argument
1002 int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_init_1000basex()
1014 err = phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_init_1000basex()
1025 static int m88e1111_config_init(struct phy_device *phydev) in m88e1111_config_init() argument
1029 if (phy_interface_is_rgmii(phydev)) { in m88e1111_config_init()
1030 err = m88e1111_config_init_rgmii(phydev); in m88e1111_config_init()
1035 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1111_config_init()
1036 err = m88e1111_config_init_sgmii(phydev); in m88e1111_config_init()
1041 if (phydev->interface == PHY_INTERFACE_MODE_RTBI) { in m88e1111_config_init()
1042 err = m88e1111_config_init_rtbi(phydev); in m88e1111_config_init()
1047 if (phydev->interface == PHY_INTERFACE_MODE_1000BASEX) { in m88e1111_config_init()
1048 err = m88e1111_config_init_1000basex(phydev); in m88e1111_config_init()
1053 err = marvell_of_reg_init(phydev); in m88e1111_config_init()
1057 err = genphy_soft_reset(phydev); in m88e1111_config_init()
1061 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1111_config_init()
1067 err = genphy_read_abilities(phydev); in m88e1111_config_init()
1068 linkmode_or(phydev->advertising, phydev->advertising, in m88e1111_config_init()
1069 phydev->supported); in m88e1111_config_init()
1074 static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data) in m88e1111_get_downshift() argument
1078 val = phy_read(phydev, MII_M1111_PHY_EXT_CR); in m88e1111_get_downshift()
1090 static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt) in m88e1111_set_downshift() argument
1098 err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_set_downshift()
1104 err = phy_modify(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_set_downshift()
1113 return genphy_soft_reset(phydev); in m88e1111_set_downshift()
1116 static int m88e1111_get_tunable(struct phy_device *phydev, in m88e1111_get_tunable() argument
1121 return m88e1111_get_downshift(phydev, data); in m88e1111_get_tunable()
1127 static int m88e1111_set_tunable(struct phy_device *phydev, in m88e1111_set_tunable() argument
1132 return m88e1111_set_downshift(phydev, *(const u8 *)data); in m88e1111_set_tunable()
1138 static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data) in m88e1011_get_downshift() argument
1142 val = phy_read(phydev, MII_M1011_PHY_SCR); in m88e1011_get_downshift()
1154 static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt) in m88e1011_set_downshift() argument
1162 err = phy_clear_bits(phydev, MII_M1011_PHY_SCR, in m88e1011_set_downshift()
1168 err = phy_modify(phydev, MII_M1011_PHY_SCR, in m88e1011_set_downshift()
1177 return genphy_soft_reset(phydev); in m88e1011_set_downshift()
1180 static int m88e1011_get_tunable(struct phy_device *phydev, in m88e1011_get_tunable() argument
1185 return m88e1011_get_downshift(phydev, data); in m88e1011_get_tunable()
1191 static int m88e1011_set_tunable(struct phy_device *phydev, in m88e1011_set_tunable() argument
1196 return m88e1011_set_downshift(phydev, *(const u8 *)data); in m88e1011_set_tunable()
1202 static int m88e1112_config_init(struct phy_device *phydev) in m88e1112_config_init() argument
1206 err = m88e1011_set_downshift(phydev, 3); in m88e1112_config_init()
1210 return m88e1111_config_init(phydev); in m88e1112_config_init()
1213 static int m88e1111gbe_config_init(struct phy_device *phydev) in m88e1111gbe_config_init() argument
1217 err = m88e1111_set_downshift(phydev, 3); in m88e1111gbe_config_init()
1221 return m88e1111_config_init(phydev); in m88e1111gbe_config_init()
1224 static int marvell_1011gbe_config_init(struct phy_device *phydev) in marvell_1011gbe_config_init() argument
1228 err = m88e1011_set_downshift(phydev, 3); in marvell_1011gbe_config_init()
1232 return marvell_config_init(phydev); in marvell_1011gbe_config_init()
1234 static int m88e1116r_config_init(struct phy_device *phydev) in m88e1116r_config_init() argument
1238 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
1244 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1116r_config_init()
1248 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1116r_config_init()
1252 err = m88e1011_set_downshift(phydev, 8); in m88e1116r_config_init()
1256 if (phy_interface_is_rgmii(phydev)) { in m88e1116r_config_init()
1257 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1116r_config_init()
1262 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
1266 return marvell_config_init(phydev); in m88e1116r_config_init()
1269 static int m88e1318_config_init(struct phy_device *phydev) in m88e1318_config_init() argument
1271 if (phy_interrupt_is_valid(phydev)) { in m88e1318_config_init()
1273 phydev, MII_MARVELL_LED_PAGE, in m88e1318_config_init()
1282 return marvell_config_init(phydev); in m88e1318_config_init()
1285 static int m88e1510_config_init(struct phy_device *phydev) in m88e1510_config_init() argument
1303 err = marvell_set_page(phydev, 0x00FF); in m88e1510_config_init()
1308 err = phy_write(phydev, 17, errata_vals[i].reg17); in m88e1510_config_init()
1311 err = phy_write(phydev, 16, errata_vals[i].reg16); in m88e1510_config_init()
1316 err = marvell_set_page(phydev, 0x00FB); in m88e1510_config_init()
1319 err = phy_write(phydev, 07, 0xC00D); in m88e1510_config_init()
1322 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_init()
1327 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1510_config_init()
1329 err = marvell_set_page(phydev, 18); in m88e1510_config_init()
1334 err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_config_init()
1341 err = phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_config_init()
1347 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_init()
1351 err = m88e1011_set_downshift(phydev, 3); in m88e1510_config_init()
1355 return m88e1318_config_init(phydev); in m88e1510_config_init()
1358 static int m88e1118_config_aneg(struct phy_device *phydev) in m88e1118_config_aneg() argument
1362 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1118_config_aneg()
1366 err = genphy_config_aneg(phydev); in m88e1118_config_aneg()
1370 return genphy_soft_reset(phydev); in m88e1118_config_aneg()
1373 static int m88e1118_config_init(struct phy_device *phydev) in m88e1118_config_init() argument
1379 err = phy_write_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1118_config_init()
1384 if (phy_interface_is_rgmii(phydev)) { in m88e1118_config_init()
1385 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1118_config_init()
1391 if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) in m88e1118_config_init()
1396 err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, 0x10, leds); in m88e1118_config_init()
1400 err = marvell_of_reg_init(phydev); in m88e1118_config_init()
1405 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1118_config_init()
1409 return genphy_soft_reset(phydev); in m88e1118_config_init()
1412 static int m88e1149_config_init(struct phy_device *phydev) in m88e1149_config_init() argument
1417 err = marvell_set_page(phydev, MII_MARVELL_MSCR_PAGE); in m88e1149_config_init()
1422 err = phy_write(phydev, 0x15, 0x1048); in m88e1149_config_init()
1426 err = marvell_of_reg_init(phydev); in m88e1149_config_init()
1431 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1149_config_init()
1435 return genphy_soft_reset(phydev); in m88e1149_config_init()
1438 static int m88e1145_config_init_rgmii(struct phy_device *phydev) in m88e1145_config_init_rgmii() argument
1442 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1145_config_init_rgmii()
1446 if (phydev->dev_flags & MARVELL_PHY_M1145_FLAGS_RESISTANCE) { in m88e1145_config_init_rgmii()
1447 err = phy_write(phydev, 0x1d, 0x0012); in m88e1145_config_init_rgmii()
1451 err = phy_modify(phydev, 0x1e, 0x0fc0, in m88e1145_config_init_rgmii()
1457 err = phy_write(phydev, 0x1d, 0x3); in m88e1145_config_init_rgmii()
1461 err = phy_write(phydev, 0x1e, 0x8000); in m88e1145_config_init_rgmii()
1466 static int m88e1145_config_init_sgmii(struct phy_device *phydev) in m88e1145_config_init_sgmii() argument
1469 phydev, MII_M1111_HWCFG_MODE_SGMII_NO_CLK, in m88e1145_config_init_sgmii()
1473 static int m88e1145_config_init(struct phy_device *phydev) in m88e1145_config_init() argument
1478 err = phy_write(phydev, 0x1d, 0x001b); in m88e1145_config_init()
1482 err = phy_write(phydev, 0x1e, 0x418f); in m88e1145_config_init()
1486 err = phy_write(phydev, 0x1d, 0x0016); in m88e1145_config_init()
1490 err = phy_write(phydev, 0x1e, 0xa2da); in m88e1145_config_init()
1494 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in m88e1145_config_init()
1495 err = m88e1145_config_init_rgmii(phydev); in m88e1145_config_init()
1500 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1145_config_init()
1501 err = m88e1145_config_init_sgmii(phydev); in m88e1145_config_init()
1505 err = m88e1111_set_downshift(phydev, 3); in m88e1145_config_init()
1509 err = marvell_of_reg_init(phydev); in m88e1145_config_init()
1516 static int m88e1540_get_fld(struct phy_device *phydev, u8 *msecs) in m88e1540_get_fld() argument
1520 val = phy_read(phydev, MII_88E1540_COPPER_CTRL3); in m88e1540_get_fld()
1551 static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs) in m88e1540_set_fld() argument
1556 return phy_clear_bits(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1562 if (phydev->eee_cfg.eee_enabled) { in m88e1540_set_fld()
1563 phydev_warn(phydev, "Fast Link Down detection requires EEE to be disabled!\n"); in m88e1540_set_fld()
1578 ret = phy_modify(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1583 return phy_set_bits(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1587 static int m88e1540_get_tunable(struct phy_device *phydev, in m88e1540_get_tunable() argument
1592 return m88e1540_get_fld(phydev, data); in m88e1540_get_tunable()
1594 return m88e1011_get_downshift(phydev, data); in m88e1540_get_tunable()
1600 static int m88e1540_set_tunable(struct phy_device *phydev, in m88e1540_set_tunable() argument
1605 return m88e1540_set_fld(phydev, data); in m88e1540_set_tunable()
1607 return m88e1011_set_downshift(phydev, *(const u8 *)data); in m88e1540_set_tunable()
1617 static int m88e6390_errata(struct phy_device *phydev) in m88e6390_errata() argument
1621 err = phy_write(phydev, MII_BMCR, in m88e6390_errata()
1628 err = phy_write_paged(phydev, 0xf8, 0x08, 0x36); in m88e6390_errata()
1632 return genphy_soft_reset(phydev); in m88e6390_errata()
1635 static int m88e6390_config_aneg(struct phy_device *phydev) in m88e6390_config_aneg() argument
1639 err = m88e6390_errata(phydev); in m88e6390_config_aneg()
1643 return m88e1510_config_aneg(phydev); in m88e6390_config_aneg()
1664 static int marvell_read_status_page_an(struct phy_device *phydev, in marvell_read_status_page_an() argument
1671 phydev->link = 0; in marvell_read_status_page_an()
1676 phydev->duplex = DUPLEX_FULL; in marvell_read_status_page_an()
1678 phydev->duplex = DUPLEX_HALF; in marvell_read_status_page_an()
1682 phydev->speed = SPEED_1000; in marvell_read_status_page_an()
1686 phydev->speed = SPEED_100; in marvell_read_status_page_an()
1690 phydev->speed = SPEED_10; in marvell_read_status_page_an()
1695 err = genphy_read_lpa(phydev); in marvell_read_status_page_an()
1699 phy_resolve_aneg_pause(phydev); in marvell_read_status_page_an()
1701 lpa = phy_read(phydev, MII_LPA); in marvell_read_status_page_an()
1706 fiber_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); in marvell_read_status_page_an()
1708 if (phydev->duplex == DUPLEX_FULL) { in marvell_read_status_page_an()
1710 phydev->pause = 0; in marvell_read_status_page_an()
1711 phydev->asym_pause = 0; in marvell_read_status_page_an()
1713 phydev->pause = 1; in marvell_read_status_page_an()
1714 phydev->asym_pause = 1; in marvell_read_status_page_an()
1716 phydev->pause = 1; in marvell_read_status_page_an()
1717 phydev->asym_pause = 0; in marvell_read_status_page_an()
1733 static int marvell_read_status_page(struct phy_device *phydev, int page) in marvell_read_status_page() argument
1739 status = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_read_status_page()
1747 phydev->link = !!(status & MII_M1011_PHY_STATUS_LINK); in marvell_read_status_page()
1749 err = genphy_update_link(phydev); in marvell_read_status_page()
1759 linkmode_zero(phydev->lp_advertising); in marvell_read_status_page()
1760 phydev->pause = 0; in marvell_read_status_page()
1761 phydev->asym_pause = 0; in marvell_read_status_page()
1762 phydev->speed = SPEED_UNKNOWN; in marvell_read_status_page()
1763 phydev->duplex = DUPLEX_UNKNOWN; in marvell_read_status_page()
1764 phydev->port = fiber ? PORT_FIBRE : PORT_TP; in marvell_read_status_page()
1767 phydev->mdix = ETH_TP_MDI_INVALID; in marvell_read_status_page()
1773 phydev->mdix = status & MII_M1011_PHY_STATUS_MDIX ? in marvell_read_status_page()
1776 phydev->mdix = ETH_TP_MDI_INVALID; in marvell_read_status_page()
1779 if (phydev->autoneg == AUTONEG_ENABLE) in marvell_read_status_page()
1780 err = marvell_read_status_page_an(phydev, fiber, status); in marvell_read_status_page()
1782 err = genphy_read_status_fixed(phydev); in marvell_read_status_page()
1796 static int marvell_read_status(struct phy_device *phydev) in marvell_read_status() argument
1802 phydev->supported) && in marvell_read_status()
1803 phydev->interface != PHY_INTERFACE_MODE_SGMII) { in marvell_read_status()
1804 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1808 err = marvell_read_status_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1819 if (phydev->link) in marvell_read_status()
1823 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1828 return marvell_read_status_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1831 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1840 static int marvell_suspend(struct phy_device *phydev) in marvell_suspend() argument
1846 phydev->supported)) { in marvell_suspend()
1847 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_suspend()
1852 err = genphy_suspend(phydev); in marvell_suspend()
1857 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1863 return genphy_suspend(phydev); in marvell_suspend()
1866 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1875 static int marvell_resume(struct phy_device *phydev) in marvell_resume() argument
1881 phydev->supported)) { in marvell_resume()
1882 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_resume()
1887 err = genphy_resume(phydev); in marvell_resume()
1892 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1898 return genphy_resume(phydev); in marvell_resume()
1901 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1915 static int m88e1510_resume(struct phy_device *phydev) in m88e1510_resume() argument
1920 err = marvell_resume(phydev); in m88e1510_resume()
1925 err = m88e1011_get_downshift(phydev, &cnt); in m88e1510_resume()
1931 err = m88e1011_set_downshift(phydev, 0); in m88e1510_resume()
1936 err = m88e1011_set_downshift(phydev, cnt); in m88e1510_resume()
1942 static int marvell_aneg_done(struct phy_device *phydev) in marvell_aneg_done() argument
1944 int retval = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_aneg_done()
1949 static void m88e1318_get_wol(struct phy_device *phydev, in m88e1318_get_wol() argument
1957 ret = phy_read_paged(phydev, MII_MARVELL_WOL_PAGE, in m88e1318_get_wol()
1969 static int m88e1318_set_wol(struct phy_device *phydev, in m88e1318_set_wol() argument
1974 oldpage = phy_save_page(phydev); in m88e1318_set_wol()
1980 err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1318_set_wol()
1990 if (!phy_interrupt_is_valid(phydev)) in m88e1318_set_wol()
1991 __phy_read(phydev, MII_M1011_IEVENT); in m88e1318_set_wol()
1994 err = __phy_set_bits(phydev, MII_88E1318S_PHY_CSIER, in m88e1318_set_wol()
1999 err = marvell_write_page(phydev, MII_MARVELL_LED_PAGE); in m88e1318_set_wol()
2004 err = __phy_modify(phydev, MII_88E1318S_PHY_LED_TCR, in m88e1318_set_wol()
2013 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
2018 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD2, in m88e1318_set_wol()
2019 ((phydev->attached_dev->dev_addr[5] << 8) | in m88e1318_set_wol()
2020 phydev->attached_dev->dev_addr[4])); in m88e1318_set_wol()
2023 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD1, in m88e1318_set_wol()
2024 ((phydev->attached_dev->dev_addr[3] << 8) | in m88e1318_set_wol()
2025 phydev->attached_dev->dev_addr[2])); in m88e1318_set_wol()
2028 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD0, in m88e1318_set_wol()
2029 ((phydev->attached_dev->dev_addr[1] << 8) | in m88e1318_set_wol()
2030 phydev->attached_dev->dev_addr[0])); in m88e1318_set_wol()
2035 err = __phy_set_bits(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
2041 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
2046 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
2054 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
2059 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, 0, in m88e1318_set_wol()
2065 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
2070 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
2078 return phy_restore_page(phydev, oldpage, err); in m88e1318_set_wol()
2081 static int marvell_get_sset_count(struct phy_device *phydev) in marvell_get_sset_count() argument
2084 phydev->supported)) in marvell_get_sset_count()
2090 static int marvell_get_sset_count_simple(struct phy_device *phydev) in marvell_get_sset_count_simple() argument
2095 static void marvell_get_strings(struct phy_device *phydev, u8 *data) in marvell_get_strings() argument
2097 int count = marvell_get_sset_count(phydev); in marvell_get_strings()
2104 static void marvell_get_strings_simple(struct phy_device *phydev, u8 *data) in marvell_get_strings_simple() argument
2106 int count = marvell_get_sset_count_simple(phydev); in marvell_get_strings_simple()
2113 static u64 marvell_get_stat(struct phy_device *phydev, int i) in marvell_get_stat() argument
2116 struct marvell_priv *priv = phydev->priv; in marvell_get_stat()
2120 val = phy_read_paged(phydev, stat.page, stat.reg); in marvell_get_stat()
2132 static u64 marvell_get_stat_simple(struct phy_device *phydev, int i) in marvell_get_stat_simple() argument
2135 struct marvell_priv *priv = phydev->priv; in marvell_get_stat_simple()
2139 val = phy_read(phydev, stat.reg); in marvell_get_stat_simple()
2151 static void marvell_get_stats(struct phy_device *phydev, in marvell_get_stats() argument
2154 int count = marvell_get_sset_count(phydev); in marvell_get_stats()
2158 data[i] = marvell_get_stat(phydev, i); in marvell_get_stats()
2161 static void marvell_get_stats_simple(struct phy_device *phydev, in marvell_get_stats_simple() argument
2164 int count = marvell_get_sset_count_simple(phydev); in marvell_get_stats_simple()
2168 data[i] = marvell_get_stat_simple(phydev, i); in marvell_get_stats_simple()
2171 static int m88e1510_loopback(struct phy_device *phydev, bool enable, int speed) in m88e1510_loopback() argument
2177 return genphy_loopback(phydev, enable, 0); in m88e1510_loopback()
2180 phydev->speed = speed; in m88e1510_loopback()
2184 bmcr_ctl = mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); in m88e1510_loopback()
2186 err = phy_write(phydev, MII_BMCR, bmcr_ctl); in m88e1510_loopback()
2190 if (phydev->speed == SPEED_1000) in m88e1510_loopback()
2192 else if (phydev->speed == SPEED_100) in m88e1510_loopback()
2195 err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1510_loopback()
2202 err = genphy_soft_reset(phydev); in m88e1510_loopback()
2206 err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, in m88e1510_loopback()
2219 static int marvell_vct5_wait_complete(struct phy_device *phydev) in marvell_vct5_wait_complete() argument
2225 val = __phy_read(phydev, MII_VCT5_CTRL); in marvell_vct5_wait_complete()
2233 phydev_err(phydev, "Timeout while waiting for cable test to finish\n"); in marvell_vct5_wait_complete()
2237 static int marvell_vct5_amplitude(struct phy_device *phydev, int pair) in marvell_vct5_amplitude() argument
2244 val = __phy_read(phydev, reg); in marvell_vct5_amplitude()
2268 static int marvell_vct5_amplitude_distance(struct phy_device *phydev, in marvell_vct5_amplitude_distance() argument
2276 err = __phy_write(phydev, MII_VCT5_SAMPLE_POINT_DISTANCE, in marvell_vct5_amplitude_distance()
2286 err = __phy_write(phydev, MII_VCT5_CTRL, reg); in marvell_vct5_amplitude_distance()
2290 err = marvell_vct5_wait_complete(phydev); in marvell_vct5_amplitude_distance()
2298 mV = marvell_vct5_amplitude(phydev, i); in marvell_vct5_amplitude_distance()
2299 ethnl_cable_test_amplitude(phydev, i, mV); in marvell_vct5_amplitude_distance()
2305 static int marvell_vct5_amplitude_graph(struct phy_device *phydev) in marvell_vct5_amplitude_graph() argument
2307 struct marvell_priv *priv = phydev->priv; in marvell_vct5_amplitude_graph()
2323 err = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct5_amplitude_graph()
2334 page = phy_select_page(phydev, MII_MARVELL_VCT5_PAGE); in marvell_vct5_amplitude_graph()
2341 err = marvell_vct5_amplitude_distance(phydev, distance, in marvell_vct5_amplitude_graph()
2352 err = __phy_write(phydev, MII_VCT5_TX_PULSE_CTRL, reg); in marvell_vct5_amplitude_graph()
2359 return phy_restore_page(phydev, page, err); in marvell_vct5_amplitude_graph()
2362 static int marvell_cable_test_start_common(struct phy_device *phydev) in marvell_cable_test_start_common() argument
2369 bmcr = phy_read(phydev, MII_BMCR); in marvell_cable_test_start_common()
2373 bmsr = phy_read(phydev, MII_BMSR); in marvell_cable_test_start_common()
2379 ret = phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE); in marvell_cable_test_start_common()
2382 ret = genphy_soft_reset(phydev); in marvell_cable_test_start_common()
2394 static int marvell_vct7_cable_test_start(struct phy_device *phydev) in marvell_vct7_cable_test_start() argument
2396 struct marvell_priv *priv = phydev->priv; in marvell_vct7_cable_test_start()
2399 ret = marvell_cable_test_start_common(phydev); in marvell_vct7_cable_test_start()
2408 ret = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct7_cable_test_start()
2417 ret = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct7_cable_test_start()
2422 return phy_write_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_start()
2428 static int marvell_vct5_cable_test_tdr_start(struct phy_device *phydev, in marvell_vct5_cable_test_tdr_start() argument
2431 struct marvell_priv *priv = phydev->priv; in marvell_vct5_cable_test_tdr_start()
2447 ret = phy_write_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct5_cable_test_tdr_start()
2452 ret = marvell_cable_test_start_common(phydev); in marvell_vct5_cable_test_tdr_start()
2456 ret = ethnl_cable_test_pulse(phydev, 1000); in marvell_vct5_cable_test_tdr_start()
2460 return ethnl_cable_test_step(phydev, in marvell_vct5_cable_test_tdr_start()
2485 static int marvell_vct7_report_length(struct phy_device *phydev, in marvell_vct7_report_length() argument
2491 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_report_length()
2498 ethnl_cable_test_fault_length(phydev, pair, length); in marvell_vct7_report_length()
2519 static int marvell_vct7_cable_test_report(struct phy_device *phydev) in marvell_vct7_cable_test_report() argument
2525 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_report()
2539 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in marvell_vct7_cable_test_report()
2541 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B, in marvell_vct7_cable_test_report()
2543 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_C, in marvell_vct7_cable_test_report()
2545 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_D, in marvell_vct7_cable_test_report()
2548 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, MII_VCT7_CTRL); in marvell_vct7_cable_test_report()
2555 marvell_vct7_report_length(phydev, 0, meter); in marvell_vct7_cable_test_report()
2557 marvell_vct7_report_length(phydev, 1, meter); in marvell_vct7_cable_test_report()
2559 marvell_vct7_report_length(phydev, 2, meter); in marvell_vct7_cable_test_report()
2561 marvell_vct7_report_length(phydev, 3, meter); in marvell_vct7_cable_test_report()
2566 static int marvell_vct7_cable_test_get_status(struct phy_device *phydev, in marvell_vct7_cable_test_get_status() argument
2569 struct marvell_priv *priv = phydev->priv; in marvell_vct7_cable_test_get_status()
2573 ret = marvell_vct5_amplitude_graph(phydev); in marvell_vct7_cable_test_get_status()
2580 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_get_status()
2589 return marvell_vct7_cable_test_report(phydev); in marvell_vct7_cable_test_get_status()
2595 static int m88e3082_vct_cable_test_start(struct phy_device *phydev) in m88e3082_vct_cable_test_start() argument
2597 struct marvell_priv *priv = phydev->priv; in m88e3082_vct_cable_test_start()
2602 ret = phy_write(phydev, 29, 0x0003); in m88e3082_vct_cable_test_start()
2606 ret = phy_write(phydev, 30, 0x6440); in m88e3082_vct_cable_test_start()
2611 ret = phy_write(phydev, 29, 0x000a); in m88e3082_vct_cable_test_start()
2615 ret = phy_write(phydev, 30, 0x0002); in m88e3082_vct_cable_test_start()
2620 ret = phy_write(phydev, MII_BMCR, in m88e3082_vct_cable_test_start()
2625 ret = phy_write(phydev, MII_VCT_TXPINS, MII_VCT_TXPINS_ENVCT); in m88e3082_vct_cable_test_start()
2629 ret = phy_write(phydev, 29, 0x0003); in m88e3082_vct_cable_test_start()
2633 ret = phy_write(phydev, 30, 0x0); in m88e3082_vct_cable_test_start()
2644 ret = phy_write(phydev, 29, 0x000a); in m88e3082_vct_cable_test_start()
2648 ret = phy_write(phydev, 30, 0x0); in m88e3082_vct_cable_test_start()
2682 static int m88e3082_vct_cable_test_get_status(struct phy_device *phydev, in m88e3082_vct_cable_test_get_status() argument
2686 struct marvell_priv *priv = phydev->priv; in m88e3082_vct_cable_test_get_status()
2692 ret = phy_read(phydev, MII_VCT_TXPINS); in m88e3082_vct_cable_test_get_status()
2702 ret = phy_read(phydev, MII_VCT_RXPINS); in m88e3082_vct_cable_test_get_status()
2719 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in m88e3082_vct_cable_test_get_status()
2721 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B, in m88e3082_vct_cable_test_get_status()
2731 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2741 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2752 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2760 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2770 return m88e3082_vct_cable_test_start(phydev); in m88e3082_vct_cable_test_get_status()
2777 static int m88e1111_vct_cable_test_start(struct phy_device *phydev) in m88e1111_vct_cable_test_start() argument
2781 ret = marvell_cable_test_start_common(phydev); in m88e1111_vct_cable_test_start()
2787 ret = phy_write(phydev, 29, 0x0018); in m88e1111_vct_cable_test_start()
2791 ret = phy_write(phydev, 30, 0x00c2); in m88e1111_vct_cable_test_start()
2795 ret = phy_write(phydev, 30, 0x00ca); in m88e1111_vct_cable_test_start()
2799 ret = phy_write(phydev, 30, 0x00c2); in m88e1111_vct_cable_test_start()
2803 ret = phy_write_paged(phydev, MII_MARVELL_COPPER_PAGE, MII_VCT_SR, in m88e1111_vct_cable_test_start()
2808 ret = phy_write(phydev, 29, 0x0018); in m88e1111_vct_cable_test_start()
2812 ret = phy_write(phydev, 30, 0x0042); in m88e1111_vct_cable_test_start()
2828 static int m88e1111_vct_cable_test_get_status(struct phy_device *phydev, in m88e1111_vct_cable_test_get_status() argument
2838 ret = phy_read_paged(phydev, i, MII_VCT_SR); in m88e1111_vct_cable_test_get_status()
2850 ethnl_cable_test_result(phydev, i, result); in m88e1111_vct_cable_test_get_status()
2855 ethnl_cable_test_fault_length(phydev, i, cm); in m88e1111_vct_cable_test_get_status()
2865 int (*config)(struct phy_device *phydev);
2866 int (*get_temp)(struct phy_device *phydev, long *temp);
2867 int (*get_temp_critical)(struct phy_device *phydev, long *temp);
2868 int (*set_temp_critical)(struct phy_device *phydev, long temp);
2869 int (*get_temp_alarm)(struct phy_device *phydev, long *alarm);
2873 to_marvell_hwmon_ops(const struct phy_device *phydev) in to_marvell_hwmon_ops() argument
2875 return phydev->drv->driver_data; in to_marvell_hwmon_ops()
2878 static int m88e1121_get_temp(struct phy_device *phydev, long *temp) in m88e1121_get_temp() argument
2886 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e1121_get_temp()
2891 ret = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
2895 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
2903 val = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
2910 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
2918 return phy_restore_page(phydev, oldpage, ret); in m88e1121_get_temp()
2921 static int m88e1510_get_temp(struct phy_device *phydev, long *temp) in m88e1510_get_temp() argument
2927 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp()
2937 static int m88e1510_get_temp_critical(struct phy_device *phydev, long *temp) in m88e1510_get_temp_critical() argument
2943 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_critical()
2956 static int m88e1510_set_temp_critical(struct phy_device *phydev, long temp) in m88e1510_set_temp_critical() argument
2961 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_set_temp_critical()
2967 static int m88e1510_get_temp_alarm(struct phy_device *phydev, long *alarm) in m88e1510_get_temp_alarm() argument
2973 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_alarm()
2983 static int m88e6390_get_temp(struct phy_device *phydev, long *temp) in m88e6390_get_temp() argument
2992 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e6390_get_temp()
2997 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
3004 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
3015 ret = __phy_read(phydev, MII_88E6390_TEMP_SENSOR); in m88e6390_get_temp()
3025 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
3032 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
3035 phy_restore_page(phydev, oldpage, ret); in m88e6390_get_temp()
3040 static int m88e6393_get_temp(struct phy_device *phydev, long *temp) in m88e6393_get_temp() argument
3044 err = m88e1510_get_temp(phydev, temp); in m88e6393_get_temp()
3054 static int m88e6393_get_temp_critical(struct phy_device *phydev, long *temp) in m88e6393_get_temp_critical() argument
3060 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_get_temp_critical()
3071 static int m88e6393_set_temp_critical(struct phy_device *phydev, long temp) in m88e6393_set_temp_critical() argument
3075 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_set_temp_critical()
3081 static int m88e6393_hwmon_config(struct phy_device *phydev) in m88e6393_hwmon_config() argument
3085 err = m88e6393_set_temp_critical(phydev, 100000); in m88e6393_hwmon_config()
3089 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_hwmon_config()
3102 struct phy_device *phydev = dev_get_drvdata(dev); in marvell_hwmon_read() local
3103 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_read()
3109 err = ops->get_temp(phydev, temp); in marvell_hwmon_read()
3113 err = ops->get_temp_critical(phydev, temp); in marvell_hwmon_read()
3117 err = ops->get_temp_alarm(phydev, temp); in marvell_hwmon_read()
3127 struct phy_device *phydev = dev_get_drvdata(dev); in marvell_hwmon_write() local
3128 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_write()
3134 err = ops->set_temp_critical(phydev, temp); in marvell_hwmon_write()
3145 const struct phy_device *phydev = data; in marvell_hwmon_is_visible() local
3146 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_is_visible()
3185 static int marvell_hwmon_name(struct phy_device *phydev) in marvell_hwmon_name() argument
3187 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_name()
3188 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_name()
3205 static int marvell_hwmon_probe(struct phy_device *phydev) in marvell_hwmon_probe() argument
3207 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_probe()
3208 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_probe()
3209 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_probe()
3215 err = marvell_hwmon_name(phydev); in marvell_hwmon_probe()
3220 dev, priv->hwmon_name, phydev, &marvell_hwmon_chip_info, NULL); in marvell_hwmon_probe()
3225 err = ops->config(phydev); in marvell_hwmon_probe()
3259 static int marvell_hwmon_probe(struct phy_device *phydev) in marvell_hwmon_probe() argument
3265 static int m88e1318_led_brightness_set(struct phy_device *phydev, in m88e1318_led_brightness_set() argument
3270 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_brightness_set()
3289 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_brightness_set()
3293 static int m88e1318_led_blink_set(struct phy_device *phydev, u8 index, in m88e1318_led_blink_set() argument
3299 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_blink_set()
3318 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_blink_set()
3523 static int m88e1318_led_hw_is_supported(struct phy_device *phydev, u8 index, in m88e1318_led_hw_is_supported() argument
3541 static int m88e1318_led_hw_control_set(struct phy_device *phydev, u8 index, in m88e1318_led_hw_control_set() argument
3559 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_set()
3566 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_set()
3570 static int m88e1318_led_hw_control_get(struct phy_device *phydev, u8 index, in m88e1318_led_hw_control_get() argument
3578 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_get()
3588 static int marvell_probe(struct phy_device *phydev) in marvell_probe() argument
3592 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in marvell_probe()
3596 phydev->priv = priv; in marvell_probe()
3598 return marvell_hwmon_probe(phydev); in marvell_probe()
3604 struct phy_device *phydev = port_phydev(port); in m88e1510_port_configure_serdes() local
3610 dev = &phydev->mdio.dev; in m88e1510_port_configure_serdes()
3635 oldpage = phy_select_page(phydev, MII_MARVELL_MODE_PAGE); in m88e1510_port_configure_serdes()
3639 ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_port_configure_serdes()
3644 ret = __phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_port_configure_serdes()
3648 return phy_restore_page(phydev, oldpage, ret); in m88e1510_port_configure_serdes()