Lines Matching full:phydev

358 static int marvell_read_page(struct phy_device *phydev)  in marvell_read_page()  argument
360 return __phy_read(phydev, MII_MARVELL_PHY_PAGE); in marvell_read_page()
363 static int marvell_write_page(struct phy_device *phydev, int page) in marvell_write_page() argument
365 return __phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_write_page()
368 static int marvell_set_page(struct phy_device *phydev, int page) in marvell_set_page() argument
370 return phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_set_page()
373 static int marvell_ack_interrupt(struct phy_device *phydev) in marvell_ack_interrupt() argument
378 err = phy_read(phydev, MII_M1011_IEVENT); in marvell_ack_interrupt()
386 static int marvell_config_intr(struct phy_device *phydev) in marvell_config_intr() argument
390 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in marvell_config_intr()
391 err = marvell_ack_interrupt(phydev); in marvell_config_intr()
395 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
398 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
403 err = marvell_ack_interrupt(phydev); in marvell_config_intr()
409 static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev) in marvell_handle_interrupt() argument
413 irq_status = phy_read(phydev, MII_M1011_IEVENT); in marvell_handle_interrupt()
415 phy_error(phydev); in marvell_handle_interrupt()
422 phy_trigger_machine(phydev); in marvell_handle_interrupt()
427 static int marvell_set_polarity(struct phy_device *phydev, int polarity) in marvell_set_polarity() argument
445 return phy_modify_changed(phydev, MII_M1011_PHY_SCR, in marvell_set_polarity()
449 static int marvell_config_aneg(struct phy_device *phydev) in marvell_config_aneg() argument
454 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in marvell_config_aneg()
460 err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL, in marvell_config_aneg()
465 err = genphy_config_aneg(phydev); in marvell_config_aneg()
469 if (phydev->autoneg != AUTONEG_ENABLE || changed) { in marvell_config_aneg()
474 err = genphy_soft_reset(phydev); in marvell_config_aneg()
482 static int m88e1101_config_aneg(struct phy_device *phydev) in m88e1101_config_aneg() argument
490 err = genphy_soft_reset(phydev); in m88e1101_config_aneg()
494 err = phy_write(phydev, 0x1d, 0x1f); in m88e1101_config_aneg()
498 err = phy_write(phydev, 0x1e, 0x200c); in m88e1101_config_aneg()
502 err = phy_write(phydev, 0x1d, 0x5); in m88e1101_config_aneg()
506 err = phy_write(phydev, 0x1e, 0); in m88e1101_config_aneg()
510 err = phy_write(phydev, 0x1e, 0x100); in m88e1101_config_aneg()
514 return marvell_config_aneg(phydev); in m88e1101_config_aneg()
519 * marvell,reg-init property stored in the of_node for the phydev.
531 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
536 if (!phydev->mdio.dev.of_node) in marvell_of_reg_init()
539 paddr = of_get_property(phydev->mdio.dev.of_node, in marvell_of_reg_init()
544 saved_page = phy_save_page(phydev); in marvell_of_reg_init()
559 ret = marvell_write_page(phydev, page); in marvell_of_reg_init()
566 val = __phy_read(phydev, reg); in marvell_of_reg_init()
575 ret = __phy_write(phydev, reg, val); in marvell_of_reg_init()
580 return phy_restore_page(phydev, saved_page, ret); in marvell_of_reg_init()
583 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
589 static int m88e1121_config_aneg_rgmii_delays(struct phy_device *phydev) in m88e1121_config_aneg_rgmii_delays() argument
593 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in m88e1121_config_aneg_rgmii_delays()
596 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in m88e1121_config_aneg_rgmii_delays()
598 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in m88e1121_config_aneg_rgmii_delays()
603 return phy_modify_paged_changed(phydev, MII_MARVELL_MSCR_PAGE, in m88e1121_config_aneg_rgmii_delays()
608 static int m88e1121_config_aneg(struct phy_device *phydev) in m88e1121_config_aneg() argument
613 if (phy_interface_is_rgmii(phydev)) { in m88e1121_config_aneg()
614 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1121_config_aneg()
621 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1121_config_aneg()
627 err = genphy_config_aneg(phydev); in m88e1121_config_aneg()
631 if (phydev->autoneg != AUTONEG_ENABLE || changed) { in m88e1121_config_aneg()
635 err = genphy_soft_reset(phydev); in m88e1121_config_aneg()
643 static int m88e1318_config_aneg(struct phy_device *phydev) in m88e1318_config_aneg() argument
647 err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1318_config_aneg()
653 return m88e1121_config_aneg(phydev); in m88e1318_config_aneg()
684 * @phydev: target phy_device struct
691 static int marvell_config_aneg_fiber(struct phy_device *phydev) in marvell_config_aneg_fiber() argument
697 if (phydev->autoneg != AUTONEG_ENABLE) in marvell_config_aneg_fiber()
698 return genphy_setup_forced(phydev); in marvell_config_aneg_fiber()
701 linkmode_and(phydev->advertising, phydev->advertising, in marvell_config_aneg_fiber()
702 phydev->supported); in marvell_config_aneg_fiber()
704 adv = linkmode_adv_to_fiber_adv_t(phydev->advertising); in marvell_config_aneg_fiber()
707 err = phy_modify_changed(phydev, MII_ADVERTISE, in marvell_config_aneg_fiber()
716 return genphy_check_and_restart_aneg(phydev, changed); in marvell_config_aneg_fiber()
719 static int m88e1111_config_aneg(struct phy_device *phydev) in m88e1111_config_aneg() argument
721 int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_aneg()
730 if (phydev->interface != PHY_INTERFACE_MODE_SGMII && in m88e1111_config_aneg()
733 return marvell_config_aneg(phydev); in m88e1111_config_aneg()
735 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
740 err = marvell_config_aneg(phydev); in m88e1111_config_aneg()
745 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in m88e1111_config_aneg()
749 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) in m88e1111_config_aneg()
754 err = genphy_check_and_restart_aneg(phydev, false); in m88e1111_config_aneg()
756 err = marvell_config_aneg_fiber(phydev); in m88e1111_config_aneg()
760 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
763 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_aneg()
767 static int m88e1510_config_aneg(struct phy_device *phydev) in m88e1510_config_aneg() argument
771 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
776 err = m88e1318_config_aneg(phydev); in m88e1510_config_aneg()
781 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) in m88e1510_config_aneg()
785 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in m88e1510_config_aneg()
789 err = marvell_config_aneg_fiber(phydev); in m88e1510_config_aneg()
793 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
796 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
800 static void marvell_config_led(struct phy_device *phydev) in marvell_config_led() argument
805 switch (MARVELL_PHY_FAMILY_ID(phydev->phy_id)) { in marvell_config_led()
817 if (phydev->dev_flags & MARVELL_PHY_LED0_LINK_LED1_ACTIVE) in marvell_config_led()
826 err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL, in marvell_config_led()
829 phydev_warn(phydev, "Fail to config marvell phy LED.\n"); in marvell_config_led()
832 static int marvell_config_init(struct phy_device *phydev) in marvell_config_init() argument
835 marvell_config_led(phydev); in marvell_config_init()
838 return marvell_of_reg_init(phydev); in marvell_config_init()
841 static int m88e3016_config_init(struct phy_device *phydev) in m88e3016_config_init() argument
846 ret = phy_modify(phydev, MII_88E3016_PHY_SPEC_CTRL, in m88e3016_config_init()
852 return marvell_config_init(phydev); in m88e3016_config_init()
855 static int m88e1111_config_init_hwcfg_mode(struct phy_device *phydev, in m88e1111_config_init_hwcfg_mode() argument
862 return phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_init_hwcfg_mode()
869 static int m88e1111_config_init_rgmii_delays(struct phy_device *phydev) in m88e1111_config_init_rgmii_delays() argument
873 switch (phydev->interface) { in m88e1111_config_init_rgmii_delays()
888 return phy_modify(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_config_init_rgmii_delays()
893 static int m88e1111_config_init_rgmii(struct phy_device *phydev) in m88e1111_config_init_rgmii() argument
898 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rgmii()
902 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_init_rgmii()
913 return phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); in m88e1111_config_init_rgmii()
916 static int m88e1111_config_init_sgmii(struct phy_device *phydev) in m88e1111_config_init_sgmii() argument
921 phydev, in m88e1111_config_init_sgmii()
928 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_init_sgmii()
931 static int m88e1111_config_init_rtbi(struct phy_device *phydev) in m88e1111_config_init_rtbi() argument
935 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rtbi()
940 phydev, in m88e1111_config_init_rtbi()
947 err = genphy_soft_reset(phydev); in m88e1111_config_init_rtbi()
952 phydev, in m88e1111_config_init_rtbi()
957 static int m88e1111_config_init_1000basex(struct phy_device *phydev) in m88e1111_config_init_1000basex() argument
959 int extsr = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_init_1000basex()
971 err = phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_init_1000basex()
982 static int m88e1111_config_init(struct phy_device *phydev) in m88e1111_config_init() argument
986 if (phy_interface_is_rgmii(phydev)) { in m88e1111_config_init()
987 err = m88e1111_config_init_rgmii(phydev); in m88e1111_config_init()
992 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1111_config_init()
993 err = m88e1111_config_init_sgmii(phydev); in m88e1111_config_init()
998 if (phydev->interface == PHY_INTERFACE_MODE_RTBI) { in m88e1111_config_init()
999 err = m88e1111_config_init_rtbi(phydev); in m88e1111_config_init()
1004 if (phydev->interface == PHY_INTERFACE_MODE_1000BASEX) { in m88e1111_config_init()
1005 err = m88e1111_config_init_1000basex(phydev); in m88e1111_config_init()
1010 err = marvell_of_reg_init(phydev); in m88e1111_config_init()
1014 err = genphy_soft_reset(phydev); in m88e1111_config_init()
1018 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1111_config_init()
1024 err = genphy_read_abilities(phydev); in m88e1111_config_init()
1025 linkmode_or(phydev->advertising, phydev->advertising, in m88e1111_config_init()
1026 phydev->supported); in m88e1111_config_init()
1031 static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data) in m88e1111_get_downshift() argument
1035 val = phy_read(phydev, MII_M1111_PHY_EXT_CR); in m88e1111_get_downshift()
1047 static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt) in m88e1111_set_downshift() argument
1055 err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_set_downshift()
1061 err = phy_modify(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_set_downshift()
1070 return genphy_soft_reset(phydev); in m88e1111_set_downshift()
1073 static int m88e1111_get_tunable(struct phy_device *phydev, in m88e1111_get_tunable() argument
1078 return m88e1111_get_downshift(phydev, data); in m88e1111_get_tunable()
1084 static int m88e1111_set_tunable(struct phy_device *phydev, in m88e1111_set_tunable() argument
1089 return m88e1111_set_downshift(phydev, *(const u8 *)data); in m88e1111_set_tunable()
1095 static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data) in m88e1011_get_downshift() argument
1099 val = phy_read(phydev, MII_M1011_PHY_SCR); in m88e1011_get_downshift()
1111 static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt) in m88e1011_set_downshift() argument
1119 err = phy_clear_bits(phydev, MII_M1011_PHY_SCR, in m88e1011_set_downshift()
1125 err = phy_modify(phydev, MII_M1011_PHY_SCR, in m88e1011_set_downshift()
1134 return genphy_soft_reset(phydev); in m88e1011_set_downshift()
1137 static int m88e1011_get_tunable(struct phy_device *phydev, in m88e1011_get_tunable() argument
1142 return m88e1011_get_downshift(phydev, data); in m88e1011_get_tunable()
1148 static int m88e1011_set_tunable(struct phy_device *phydev, in m88e1011_set_tunable() argument
1153 return m88e1011_set_downshift(phydev, *(const u8 *)data); in m88e1011_set_tunable()
1159 static int m88e1112_config_init(struct phy_device *phydev) in m88e1112_config_init() argument
1163 err = m88e1011_set_downshift(phydev, 3); in m88e1112_config_init()
1167 return m88e1111_config_init(phydev); in m88e1112_config_init()
1170 static int m88e1111gbe_config_init(struct phy_device *phydev) in m88e1111gbe_config_init() argument
1174 err = m88e1111_set_downshift(phydev, 3); in m88e1111gbe_config_init()
1178 return m88e1111_config_init(phydev); in m88e1111gbe_config_init()
1181 static int marvell_1011gbe_config_init(struct phy_device *phydev) in marvell_1011gbe_config_init() argument
1185 err = m88e1011_set_downshift(phydev, 3); in marvell_1011gbe_config_init()
1189 return marvell_config_init(phydev); in marvell_1011gbe_config_init()
1191 static int m88e1116r_config_init(struct phy_device *phydev) in m88e1116r_config_init() argument
1195 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
1201 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1116r_config_init()
1205 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1116r_config_init()
1209 err = m88e1011_set_downshift(phydev, 8); in m88e1116r_config_init()
1213 if (phy_interface_is_rgmii(phydev)) { in m88e1116r_config_init()
1214 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1116r_config_init()
1219 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
1223 return marvell_config_init(phydev); in m88e1116r_config_init()
1226 static int m88e1318_config_init(struct phy_device *phydev) in m88e1318_config_init() argument
1228 if (phy_interrupt_is_valid(phydev)) { in m88e1318_config_init()
1230 phydev, MII_MARVELL_LED_PAGE, in m88e1318_config_init()
1239 return marvell_config_init(phydev); in m88e1318_config_init()
1242 static int m88e1510_config_init(struct phy_device *phydev) in m88e1510_config_init() argument
1260 err = marvell_set_page(phydev, 0x00FF); in m88e1510_config_init()
1265 err = phy_write(phydev, 17, errata_vals[i].reg17); in m88e1510_config_init()
1268 err = phy_write(phydev, 16, errata_vals[i].reg16); in m88e1510_config_init()
1273 err = marvell_set_page(phydev, 0x00FB); in m88e1510_config_init()
1276 err = phy_write(phydev, 07, 0xC00D); in m88e1510_config_init()
1279 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_init()
1284 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1510_config_init()
1286 err = marvell_set_page(phydev, 18); in m88e1510_config_init()
1291 err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_config_init()
1298 err = phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_config_init()
1304 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_init()
1308 err = m88e1011_set_downshift(phydev, 3); in m88e1510_config_init()
1312 return m88e1318_config_init(phydev); in m88e1510_config_init()
1315 static int m88e1118_config_aneg(struct phy_device *phydev) in m88e1118_config_aneg() argument
1319 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1118_config_aneg()
1323 err = genphy_config_aneg(phydev); in m88e1118_config_aneg()
1327 return genphy_soft_reset(phydev); in m88e1118_config_aneg()
1330 static int m88e1118_config_init(struct phy_device *phydev) in m88e1118_config_init() argument
1336 err = phy_write_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1118_config_init()
1341 if (phy_interface_is_rgmii(phydev)) { in m88e1118_config_init()
1342 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1118_config_init()
1348 if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) in m88e1118_config_init()
1353 err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, 0x10, leds); in m88e1118_config_init()
1357 err = marvell_of_reg_init(phydev); in m88e1118_config_init()
1362 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1118_config_init()
1366 return genphy_soft_reset(phydev); in m88e1118_config_init()
1369 static int m88e1149_config_init(struct phy_device *phydev) in m88e1149_config_init() argument
1374 err = marvell_set_page(phydev, MII_MARVELL_MSCR_PAGE); in m88e1149_config_init()
1379 err = phy_write(phydev, 0x15, 0x1048); in m88e1149_config_init()
1383 err = marvell_of_reg_init(phydev); in m88e1149_config_init()
1388 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1149_config_init()
1392 return genphy_soft_reset(phydev); in m88e1149_config_init()
1395 static int m88e1145_config_init_rgmii(struct phy_device *phydev) in m88e1145_config_init_rgmii() argument
1399 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1145_config_init_rgmii()
1403 if (phydev->dev_flags & MARVELL_PHY_M1145_FLAGS_RESISTANCE) { in m88e1145_config_init_rgmii()
1404 err = phy_write(phydev, 0x1d, 0x0012); in m88e1145_config_init_rgmii()
1408 err = phy_modify(phydev, 0x1e, 0x0fc0, in m88e1145_config_init_rgmii()
1414 err = phy_write(phydev, 0x1d, 0x3); in m88e1145_config_init_rgmii()
1418 err = phy_write(phydev, 0x1e, 0x8000); in m88e1145_config_init_rgmii()
1423 static int m88e1145_config_init_sgmii(struct phy_device *phydev) in m88e1145_config_init_sgmii() argument
1426 phydev, MII_M1111_HWCFG_MODE_SGMII_NO_CLK, in m88e1145_config_init_sgmii()
1430 static int m88e1145_config_init(struct phy_device *phydev) in m88e1145_config_init() argument
1435 err = phy_write(phydev, 0x1d, 0x001b); in m88e1145_config_init()
1439 err = phy_write(phydev, 0x1e, 0x418f); in m88e1145_config_init()
1443 err = phy_write(phydev, 0x1d, 0x0016); in m88e1145_config_init()
1447 err = phy_write(phydev, 0x1e, 0xa2da); in m88e1145_config_init()
1451 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in m88e1145_config_init()
1452 err = m88e1145_config_init_rgmii(phydev); in m88e1145_config_init()
1457 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1145_config_init()
1458 err = m88e1145_config_init_sgmii(phydev); in m88e1145_config_init()
1462 err = m88e1111_set_downshift(phydev, 3); in m88e1145_config_init()
1466 err = marvell_of_reg_init(phydev); in m88e1145_config_init()
1473 static int m88e1540_get_fld(struct phy_device *phydev, u8 *msecs) in m88e1540_get_fld() argument
1477 val = phy_read(phydev, MII_88E1540_COPPER_CTRL3); in m88e1540_get_fld()
1508 static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs) in m88e1540_set_fld() argument
1514 return phy_clear_bits(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1520 ret = genphy_c45_ethtool_get_eee(phydev, &eee); in m88e1540_set_fld()
1522 phydev_warn(phydev, "Fast Link Down detection requires EEE to be disabled!\n"); in m88e1540_set_fld()
1537 ret = phy_modify(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1542 return phy_set_bits(phydev, MII_88E1540_COPPER_CTRL3, in m88e1540_set_fld()
1546 static int m88e1540_get_tunable(struct phy_device *phydev, in m88e1540_get_tunable() argument
1551 return m88e1540_get_fld(phydev, data); in m88e1540_get_tunable()
1553 return m88e1011_get_downshift(phydev, data); in m88e1540_get_tunable()
1559 static int m88e1540_set_tunable(struct phy_device *phydev, in m88e1540_set_tunable() argument
1564 return m88e1540_set_fld(phydev, data); in m88e1540_set_tunable()
1566 return m88e1011_set_downshift(phydev, *(const u8 *)data); in m88e1540_set_tunable()
1576 static int m88e6390_errata(struct phy_device *phydev) in m88e6390_errata() argument
1580 err = phy_write(phydev, MII_BMCR, in m88e6390_errata()
1587 err = phy_write_paged(phydev, 0xf8, 0x08, 0x36); in m88e6390_errata()
1591 return genphy_soft_reset(phydev); in m88e6390_errata()
1594 static int m88e6390_config_aneg(struct phy_device *phydev) in m88e6390_config_aneg() argument
1598 err = m88e6390_errata(phydev); in m88e6390_config_aneg()
1602 return m88e1510_config_aneg(phydev); in m88e6390_config_aneg()
1623 static int marvell_read_status_page_an(struct phy_device *phydev, in marvell_read_status_page_an() argument
1630 phydev->link = 0; in marvell_read_status_page_an()
1635 phydev->duplex = DUPLEX_FULL; in marvell_read_status_page_an()
1637 phydev->duplex = DUPLEX_HALF; in marvell_read_status_page_an()
1641 phydev->speed = SPEED_1000; in marvell_read_status_page_an()
1645 phydev->speed = SPEED_100; in marvell_read_status_page_an()
1649 phydev->speed = SPEED_10; in marvell_read_status_page_an()
1654 err = genphy_read_lpa(phydev); in marvell_read_status_page_an()
1658 phy_resolve_aneg_pause(phydev); in marvell_read_status_page_an()
1660 lpa = phy_read(phydev, MII_LPA); in marvell_read_status_page_an()
1665 fiber_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); in marvell_read_status_page_an()
1667 if (phydev->duplex == DUPLEX_FULL) { in marvell_read_status_page_an()
1669 phydev->pause = 0; in marvell_read_status_page_an()
1670 phydev->asym_pause = 0; in marvell_read_status_page_an()
1672 phydev->pause = 1; in marvell_read_status_page_an()
1673 phydev->asym_pause = 1; in marvell_read_status_page_an()
1675 phydev->pause = 1; in marvell_read_status_page_an()
1676 phydev->asym_pause = 0; in marvell_read_status_page_an()
1692 static int marvell_read_status_page(struct phy_device *phydev, int page) in marvell_read_status_page() argument
1698 status = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_read_status_page()
1706 phydev->link = !!(status & MII_M1011_PHY_STATUS_LINK); in marvell_read_status_page()
1708 err = genphy_update_link(phydev); in marvell_read_status_page()
1718 linkmode_zero(phydev->lp_advertising); in marvell_read_status_page()
1719 phydev->pause = 0; in marvell_read_status_page()
1720 phydev->asym_pause = 0; in marvell_read_status_page()
1721 phydev->speed = SPEED_UNKNOWN; in marvell_read_status_page()
1722 phydev->duplex = DUPLEX_UNKNOWN; in marvell_read_status_page()
1723 phydev->port = fiber ? PORT_FIBRE : PORT_TP; in marvell_read_status_page()
1725 if (phydev->autoneg == AUTONEG_ENABLE) in marvell_read_status_page()
1726 err = marvell_read_status_page_an(phydev, fiber, status); in marvell_read_status_page()
1728 err = genphy_read_status_fixed(phydev); in marvell_read_status_page()
1742 static int marvell_read_status(struct phy_device *phydev) in marvell_read_status() argument
1748 phydev->supported) && in marvell_read_status()
1749 phydev->interface != PHY_INTERFACE_MODE_SGMII) { in marvell_read_status()
1750 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1754 err = marvell_read_status_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1765 if (phydev->link) in marvell_read_status()
1769 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1774 return marvell_read_status_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1777 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1786 static int marvell_suspend(struct phy_device *phydev) in marvell_suspend() argument
1792 phydev->supported)) { in marvell_suspend()
1793 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_suspend()
1798 err = genphy_suspend(phydev); in marvell_suspend()
1803 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1809 return genphy_suspend(phydev); in marvell_suspend()
1812 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1821 static int marvell_resume(struct phy_device *phydev) in marvell_resume() argument
1827 phydev->supported)) { in marvell_resume()
1828 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_resume()
1833 err = genphy_resume(phydev); in marvell_resume()
1838 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1844 return genphy_resume(phydev); in marvell_resume()
1847 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1851 static int marvell_aneg_done(struct phy_device *phydev) in marvell_aneg_done() argument
1853 int retval = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_aneg_done()
1858 static void m88e1318_get_wol(struct phy_device *phydev, in m88e1318_get_wol() argument
1866 ret = phy_read_paged(phydev, MII_MARVELL_WOL_PAGE, in m88e1318_get_wol()
1878 static int m88e1318_set_wol(struct phy_device *phydev, in m88e1318_set_wol() argument
1883 oldpage = phy_save_page(phydev); in m88e1318_set_wol()
1889 err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1318_set_wol()
1899 if (!phy_interrupt_is_valid(phydev)) in m88e1318_set_wol()
1900 __phy_read(phydev, MII_M1011_IEVENT); in m88e1318_set_wol()
1903 err = __phy_set_bits(phydev, MII_88E1318S_PHY_CSIER, in m88e1318_set_wol()
1908 err = marvell_write_page(phydev, MII_MARVELL_LED_PAGE); in m88e1318_set_wol()
1913 err = __phy_modify(phydev, MII_88E1318S_PHY_LED_TCR, in m88e1318_set_wol()
1922 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1927 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD2, in m88e1318_set_wol()
1928 ((phydev->attached_dev->dev_addr[5] << 8) | in m88e1318_set_wol()
1929 phydev->attached_dev->dev_addr[4])); in m88e1318_set_wol()
1932 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD1, in m88e1318_set_wol()
1933 ((phydev->attached_dev->dev_addr[3] << 8) | in m88e1318_set_wol()
1934 phydev->attached_dev->dev_addr[2])); in m88e1318_set_wol()
1937 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD0, in m88e1318_set_wol()
1938 ((phydev->attached_dev->dev_addr[1] << 8) | in m88e1318_set_wol()
1939 phydev->attached_dev->dev_addr[0])); in m88e1318_set_wol()
1944 err = __phy_set_bits(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
1950 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1955 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
1963 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1968 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, 0, in m88e1318_set_wol()
1974 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1979 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
1987 return phy_restore_page(phydev, oldpage, err); in m88e1318_set_wol()
1990 static int marvell_get_sset_count(struct phy_device *phydev) in marvell_get_sset_count() argument
1993 phydev->supported)) in marvell_get_sset_count()
1999 static int marvell_get_sset_count_simple(struct phy_device *phydev) in marvell_get_sset_count_simple() argument
2004 static void marvell_get_strings(struct phy_device *phydev, u8 *data) in marvell_get_strings() argument
2006 int count = marvell_get_sset_count(phydev); in marvell_get_strings()
2015 static void marvell_get_strings_simple(struct phy_device *phydev, u8 *data) in marvell_get_strings_simple() argument
2017 int count = marvell_get_sset_count_simple(phydev); in marvell_get_strings_simple()
2026 static u64 marvell_get_stat(struct phy_device *phydev, int i) in marvell_get_stat() argument
2029 struct marvell_priv *priv = phydev->priv; in marvell_get_stat()
2033 val = phy_read_paged(phydev, stat.page, stat.reg); in marvell_get_stat()
2045 static u64 marvell_get_stat_simple(struct phy_device *phydev, int i) in marvell_get_stat_simple() argument
2048 struct marvell_priv *priv = phydev->priv; in marvell_get_stat_simple()
2052 val = phy_read(phydev, stat.reg); in marvell_get_stat_simple()
2064 static void marvell_get_stats(struct phy_device *phydev, in marvell_get_stats() argument
2067 int count = marvell_get_sset_count(phydev); in marvell_get_stats()
2071 data[i] = marvell_get_stat(phydev, i); in marvell_get_stats()
2074 static void marvell_get_stats_simple(struct phy_device *phydev, in marvell_get_stats_simple() argument
2077 int count = marvell_get_sset_count_simple(phydev); in marvell_get_stats_simple()
2081 data[i] = marvell_get_stat_simple(phydev, i); in marvell_get_stats_simple()
2084 static int m88e1510_loopback(struct phy_device *phydev, bool enable) in m88e1510_loopback() argument
2091 bmcr_ctl = mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); in m88e1510_loopback()
2093 err = phy_write(phydev, MII_BMCR, bmcr_ctl); in m88e1510_loopback()
2097 if (phydev->speed == SPEED_1000) in m88e1510_loopback()
2099 else if (phydev->speed == SPEED_100) in m88e1510_loopback()
2102 err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1510_loopback()
2109 err = genphy_soft_reset(phydev); in m88e1510_loopback()
2113 err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, in m88e1510_loopback()
2124 err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); in m88e1510_loopback()
2128 return phy_config_aneg(phydev); in m88e1510_loopback()
2132 static int marvell_vct5_wait_complete(struct phy_device *phydev) in marvell_vct5_wait_complete() argument
2138 val = __phy_read(phydev, MII_VCT5_CTRL); in marvell_vct5_wait_complete()
2146 phydev_err(phydev, "Timeout while waiting for cable test to finish\n"); in marvell_vct5_wait_complete()
2150 static int marvell_vct5_amplitude(struct phy_device *phydev, int pair) in marvell_vct5_amplitude() argument
2157 val = __phy_read(phydev, reg); in marvell_vct5_amplitude()
2181 static int marvell_vct5_amplitude_distance(struct phy_device *phydev, in marvell_vct5_amplitude_distance() argument
2189 err = __phy_write(phydev, MII_VCT5_SAMPLE_POINT_DISTANCE, in marvell_vct5_amplitude_distance()
2199 err = __phy_write(phydev, MII_VCT5_CTRL, reg); in marvell_vct5_amplitude_distance()
2203 err = marvell_vct5_wait_complete(phydev); in marvell_vct5_amplitude_distance()
2211 mV = marvell_vct5_amplitude(phydev, i); in marvell_vct5_amplitude_distance()
2212 ethnl_cable_test_amplitude(phydev, i, mV); in marvell_vct5_amplitude_distance()
2218 static int marvell_vct5_amplitude_graph(struct phy_device *phydev) in marvell_vct5_amplitude_graph() argument
2220 struct marvell_priv *priv = phydev->priv; in marvell_vct5_amplitude_graph()
2236 err = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct5_amplitude_graph()
2247 page = phy_select_page(phydev, MII_MARVELL_VCT5_PAGE); in marvell_vct5_amplitude_graph()
2254 err = marvell_vct5_amplitude_distance(phydev, distance, in marvell_vct5_amplitude_graph()
2265 err = __phy_write(phydev, MII_VCT5_TX_PULSE_CTRL, reg); in marvell_vct5_amplitude_graph()
2272 return phy_restore_page(phydev, page, err); in marvell_vct5_amplitude_graph()
2275 static int marvell_cable_test_start_common(struct phy_device *phydev) in marvell_cable_test_start_common() argument
2282 bmcr = phy_read(phydev, MII_BMCR); in marvell_cable_test_start_common()
2286 bmsr = phy_read(phydev, MII_BMSR); in marvell_cable_test_start_common()
2292 ret = phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE); in marvell_cable_test_start_common()
2295 ret = genphy_soft_reset(phydev); in marvell_cable_test_start_common()
2307 static int marvell_vct7_cable_test_start(struct phy_device *phydev) in marvell_vct7_cable_test_start() argument
2309 struct marvell_priv *priv = phydev->priv; in marvell_vct7_cable_test_start()
2312 ret = marvell_cable_test_start_common(phydev); in marvell_vct7_cable_test_start()
2321 ret = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct7_cable_test_start()
2330 ret = phy_write_paged(phydev, MII_MARVELL_VCT5_PAGE, in marvell_vct7_cable_test_start()
2335 return phy_write_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_start()
2341 static int marvell_vct5_cable_test_tdr_start(struct phy_device *phydev, in marvell_vct5_cable_test_tdr_start() argument
2344 struct marvell_priv *priv = phydev->priv; in marvell_vct5_cable_test_tdr_start()
2360 ret = phy_write_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct5_cable_test_tdr_start()
2365 ret = marvell_cable_test_start_common(phydev); in marvell_vct5_cable_test_tdr_start()
2369 ret = ethnl_cable_test_pulse(phydev, 1000); in marvell_vct5_cable_test_tdr_start()
2373 return ethnl_cable_test_step(phydev, in marvell_vct5_cable_test_tdr_start()
2398 static int marvell_vct7_report_length(struct phy_device *phydev, in marvell_vct7_report_length() argument
2404 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_report_length()
2411 ethnl_cable_test_fault_length(phydev, pair, length); in marvell_vct7_report_length()
2432 static int marvell_vct7_cable_test_report(struct phy_device *phydev) in marvell_vct7_cable_test_report() argument
2438 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_report()
2452 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in marvell_vct7_cable_test_report()
2454 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B, in marvell_vct7_cable_test_report()
2456 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_C, in marvell_vct7_cable_test_report()
2458 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_D, in marvell_vct7_cable_test_report()
2461 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, MII_VCT7_CTRL); in marvell_vct7_cable_test_report()
2468 marvell_vct7_report_length(phydev, 0, meter); in marvell_vct7_cable_test_report()
2470 marvell_vct7_report_length(phydev, 1, meter); in marvell_vct7_cable_test_report()
2472 marvell_vct7_report_length(phydev, 2, meter); in marvell_vct7_cable_test_report()
2474 marvell_vct7_report_length(phydev, 3, meter); in marvell_vct7_cable_test_report()
2479 static int marvell_vct7_cable_test_get_status(struct phy_device *phydev, in marvell_vct7_cable_test_get_status() argument
2482 struct marvell_priv *priv = phydev->priv; in marvell_vct7_cable_test_get_status()
2486 ret = marvell_vct5_amplitude_graph(phydev); in marvell_vct7_cable_test_get_status()
2493 ret = phy_read_paged(phydev, MII_MARVELL_VCT7_PAGE, in marvell_vct7_cable_test_get_status()
2502 return marvell_vct7_cable_test_report(phydev); in marvell_vct7_cable_test_get_status()
2508 static int m88e3082_vct_cable_test_start(struct phy_device *phydev) in m88e3082_vct_cable_test_start() argument
2510 struct marvell_priv *priv = phydev->priv; in m88e3082_vct_cable_test_start()
2515 ret = phy_write(phydev, 29, 0x0003); in m88e3082_vct_cable_test_start()
2519 ret = phy_write(phydev, 30, 0x6440); in m88e3082_vct_cable_test_start()
2524 ret = phy_write(phydev, 29, 0x000a); in m88e3082_vct_cable_test_start()
2528 ret = phy_write(phydev, 30, 0x0002); in m88e3082_vct_cable_test_start()
2533 ret = phy_write(phydev, MII_BMCR, in m88e3082_vct_cable_test_start()
2538 ret = phy_write(phydev, MII_VCT_TXPINS, MII_VCT_TXPINS_ENVCT); in m88e3082_vct_cable_test_start()
2542 ret = phy_write(phydev, 29, 0x0003); in m88e3082_vct_cable_test_start()
2546 ret = phy_write(phydev, 30, 0x0); in m88e3082_vct_cable_test_start()
2557 ret = phy_write(phydev, 29, 0x000a); in m88e3082_vct_cable_test_start()
2561 ret = phy_write(phydev, 30, 0x0); in m88e3082_vct_cable_test_start()
2595 static int m88e3082_vct_cable_test_get_status(struct phy_device *phydev, in m88e3082_vct_cable_test_get_status() argument
2599 struct marvell_priv *priv = phydev->priv; in m88e3082_vct_cable_test_get_status()
2605 ret = phy_read(phydev, MII_VCT_TXPINS); in m88e3082_vct_cable_test_get_status()
2615 ret = phy_read(phydev, MII_VCT_RXPINS); in m88e3082_vct_cable_test_get_status()
2632 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in m88e3082_vct_cable_test_get_status()
2634 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B, in m88e3082_vct_cable_test_get_status()
2644 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2654 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2665 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2673 ethnl_cable_test_fault_length(phydev, pair, cm); in m88e3082_vct_cable_test_get_status()
2683 return m88e3082_vct_cable_test_start(phydev); in m88e3082_vct_cable_test_get_status()
2690 static int m88e1111_vct_cable_test_start(struct phy_device *phydev) in m88e1111_vct_cable_test_start() argument
2694 ret = marvell_cable_test_start_common(phydev); in m88e1111_vct_cable_test_start()
2700 ret = phy_write(phydev, 29, 0x0018); in m88e1111_vct_cable_test_start()
2704 ret = phy_write(phydev, 30, 0x00c2); in m88e1111_vct_cable_test_start()
2708 ret = phy_write(phydev, 30, 0x00ca); in m88e1111_vct_cable_test_start()
2712 ret = phy_write(phydev, 30, 0x00c2); in m88e1111_vct_cable_test_start()
2716 ret = phy_write_paged(phydev, MII_MARVELL_COPPER_PAGE, MII_VCT_SR, in m88e1111_vct_cable_test_start()
2721 ret = phy_write(phydev, 29, 0x0018); in m88e1111_vct_cable_test_start()
2725 ret = phy_write(phydev, 30, 0x0042); in m88e1111_vct_cable_test_start()
2741 static int m88e1111_vct_cable_test_get_status(struct phy_device *phydev, in m88e1111_vct_cable_test_get_status() argument
2751 ret = phy_read_paged(phydev, i, MII_VCT_SR); in m88e1111_vct_cable_test_get_status()
2763 ethnl_cable_test_result(phydev, i, result); in m88e1111_vct_cable_test_get_status()
2768 ethnl_cable_test_fault_length(phydev, i, cm); in m88e1111_vct_cable_test_get_status()
2778 int (*config)(struct phy_device *phydev);
2779 int (*get_temp)(struct phy_device *phydev, long *temp);
2780 int (*get_temp_critical)(struct phy_device *phydev, long *temp);
2781 int (*set_temp_critical)(struct phy_device *phydev, long temp);
2782 int (*get_temp_alarm)(struct phy_device *phydev, long *alarm);
2786 to_marvell_hwmon_ops(const struct phy_device *phydev) in to_marvell_hwmon_ops() argument
2788 return phydev->drv->driver_data; in to_marvell_hwmon_ops()
2791 static int m88e1121_get_temp(struct phy_device *phydev, long *temp) in m88e1121_get_temp() argument
2799 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e1121_get_temp()
2804 ret = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
2808 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
2816 val = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
2823 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
2831 return phy_restore_page(phydev, oldpage, ret); in m88e1121_get_temp()
2834 static int m88e1510_get_temp(struct phy_device *phydev, long *temp) in m88e1510_get_temp() argument
2840 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp()
2850 static int m88e1510_get_temp_critical(struct phy_device *phydev, long *temp) in m88e1510_get_temp_critical() argument
2856 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_critical()
2869 static int m88e1510_set_temp_critical(struct phy_device *phydev, long temp) in m88e1510_set_temp_critical() argument
2874 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_set_temp_critical()
2880 static int m88e1510_get_temp_alarm(struct phy_device *phydev, long *alarm) in m88e1510_get_temp_alarm() argument
2886 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_alarm()
2896 static int m88e6390_get_temp(struct phy_device *phydev, long *temp) in m88e6390_get_temp() argument
2905 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e6390_get_temp()
2910 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
2917 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
2928 ret = __phy_read(phydev, MII_88E6390_TEMP_SENSOR); in m88e6390_get_temp()
2938 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
2945 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
2948 phy_restore_page(phydev, oldpage, ret); in m88e6390_get_temp()
2953 static int m88e6393_get_temp(struct phy_device *phydev, long *temp) in m88e6393_get_temp() argument
2957 err = m88e1510_get_temp(phydev, temp); in m88e6393_get_temp()
2967 static int m88e6393_get_temp_critical(struct phy_device *phydev, long *temp) in m88e6393_get_temp_critical() argument
2973 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_get_temp_critical()
2984 static int m88e6393_set_temp_critical(struct phy_device *phydev, long temp) in m88e6393_set_temp_critical() argument
2988 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_set_temp_critical()
2994 static int m88e6393_hwmon_config(struct phy_device *phydev) in m88e6393_hwmon_config() argument
2998 err = m88e6393_set_temp_critical(phydev, 100000); in m88e6393_hwmon_config()
3002 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e6393_hwmon_config()
3015 struct phy_device *phydev = dev_get_drvdata(dev); in marvell_hwmon_read() local
3016 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_read()
3022 err = ops->get_temp(phydev, temp); in marvell_hwmon_read()
3026 err = ops->get_temp_critical(phydev, temp); in marvell_hwmon_read()
3030 err = ops->get_temp_alarm(phydev, temp); in marvell_hwmon_read()
3040 struct phy_device *phydev = dev_get_drvdata(dev); in marvell_hwmon_write() local
3041 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_write()
3047 err = ops->set_temp_critical(phydev, temp); in marvell_hwmon_write()
3058 const struct phy_device *phydev = data; in marvell_hwmon_is_visible() local
3059 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_is_visible()
3118 static int marvell_hwmon_name(struct phy_device *phydev) in marvell_hwmon_name() argument
3120 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_name()
3121 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_name()
3138 static int marvell_hwmon_probe(struct phy_device *phydev) in marvell_hwmon_probe() argument
3140 const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev); in marvell_hwmon_probe()
3141 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_probe()
3142 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_probe()
3148 err = marvell_hwmon_name(phydev); in marvell_hwmon_probe()
3153 dev, priv->hwmon_name, phydev, &marvell_hwmon_chip_info, NULL); in marvell_hwmon_probe()
3158 err = ops->config(phydev); in marvell_hwmon_probe()
3192 static int marvell_hwmon_probe(struct phy_device *phydev) in marvell_hwmon_probe() argument
3198 static int m88e1318_led_brightness_set(struct phy_device *phydev, in m88e1318_led_brightness_set() argument
3203 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_brightness_set()
3222 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_brightness_set()
3226 static int m88e1318_led_blink_set(struct phy_device *phydev, u8 index, in m88e1318_led_blink_set() argument
3232 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_blink_set()
3251 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_blink_set()
3456 static int m88e1318_led_hw_is_supported(struct phy_device *phydev, u8 index, in m88e1318_led_hw_is_supported() argument
3474 static int m88e1318_led_hw_control_set(struct phy_device *phydev, u8 index, in m88e1318_led_hw_control_set() argument
3492 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_set()
3499 return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_set()
3503 static int m88e1318_led_hw_control_get(struct phy_device *phydev, u8 index, in m88e1318_led_hw_control_get() argument
3511 reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, in m88e1318_led_hw_control_get()
3521 static int marvell_probe(struct phy_device *phydev) in marvell_probe() argument
3525 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in marvell_probe()
3529 phydev->priv = priv; in marvell_probe()
3531 return marvell_hwmon_probe(phydev); in marvell_probe()
3537 struct phy_device *phydev = upstream; in m88e1510_sfp_insert() local
3546 dev = &phydev->mdio.dev; in m88e1510_sfp_insert()
3548 sfp_parse_support(phydev->sfp_bus, id, supported, interfaces); in m88e1510_sfp_insert()
3549 interface = sfp_select_interface(phydev->sfp_bus, supported); in m88e1510_sfp_insert()
3572 oldpage = phy_select_page(phydev, MII_MARVELL_MODE_PAGE); in m88e1510_sfp_insert()
3576 ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_sfp_insert()
3581 ret = __phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_sfp_insert()
3585 return phy_restore_page(phydev, oldpage, ret); in m88e1510_sfp_insert()
3590 struct phy_device *phydev = upstream; in m88e1510_sfp_remove() local
3594 oldpage = phy_select_page(phydev, MII_MARVELL_MODE_PAGE); in m88e1510_sfp_remove()
3598 ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_sfp_remove()
3604 ret = __phy_set_bits(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_sfp_remove()
3608 phy_restore_page(phydev, oldpage, ret); in m88e1510_sfp_remove()
3620 static int m88e1510_probe(struct phy_device *phydev) in m88e1510_probe() argument
3624 err = marvell_probe(phydev); in m88e1510_probe()
3628 return phy_sfp_probe(phydev, &m88e1510_sfp_ops); in m88e1510_probe()