Lines Matching full:phydev
192 static int marvell_read_page(struct phy_device *phydev) in marvell_read_page() argument
194 return __phy_read(phydev, MII_MARVELL_PHY_PAGE); in marvell_read_page()
197 static int marvell_write_page(struct phy_device *phydev, int page) in marvell_write_page() argument
199 return __phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_write_page()
202 static int marvell_set_page(struct phy_device *phydev, int page) in marvell_set_page() argument
204 return phy_write(phydev, MII_MARVELL_PHY_PAGE, page); in marvell_set_page()
207 static int marvell_ack_interrupt(struct phy_device *phydev) in marvell_ack_interrupt() argument
212 err = phy_read(phydev, MII_M1011_IEVENT); in marvell_ack_interrupt()
220 static int marvell_config_intr(struct phy_device *phydev) in marvell_config_intr() argument
224 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in marvell_config_intr()
225 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
228 err = phy_write(phydev, MII_M1011_IMASK, in marvell_config_intr()
234 static int marvell_set_polarity(struct phy_device *phydev, int polarity) in marvell_set_polarity() argument
241 reg = phy_read(phydev, MII_M1011_PHY_SCR); in marvell_set_polarity()
263 err = phy_write(phydev, MII_M1011_PHY_SCR, val); in marvell_set_polarity()
271 static int marvell_set_downshift(struct phy_device *phydev, bool enable, in marvell_set_downshift() argument
276 reg = phy_read(phydev, MII_M1011_PHY_SCR); in marvell_set_downshift()
285 return phy_write(phydev, MII_M1011_PHY_SCR, reg); in marvell_set_downshift()
288 static int marvell_config_aneg(struct phy_device *phydev) in marvell_config_aneg() argument
292 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in marvell_config_aneg()
296 err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL, in marvell_config_aneg()
301 err = genphy_config_aneg(phydev); in marvell_config_aneg()
305 if (phydev->autoneg != AUTONEG_ENABLE) { in marvell_config_aneg()
310 err = genphy_soft_reset(phydev); in marvell_config_aneg()
318 static int m88e1101_config_aneg(struct phy_device *phydev) in m88e1101_config_aneg() argument
326 err = genphy_soft_reset(phydev); in m88e1101_config_aneg()
330 err = phy_write(phydev, 0x1d, 0x1f); in m88e1101_config_aneg()
334 err = phy_write(phydev, 0x1e, 0x200c); in m88e1101_config_aneg()
338 err = phy_write(phydev, 0x1d, 0x5); in m88e1101_config_aneg()
342 err = phy_write(phydev, 0x1e, 0); in m88e1101_config_aneg()
346 err = phy_write(phydev, 0x1e, 0x100); in m88e1101_config_aneg()
350 return marvell_config_aneg(phydev); in m88e1101_config_aneg()
353 static int m88e1111_config_aneg(struct phy_device *phydev) in m88e1111_config_aneg() argument
361 err = genphy_soft_reset(phydev); in m88e1111_config_aneg()
363 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1111_config_aneg()
367 err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL, in m88e1111_config_aneg()
372 err = genphy_config_aneg(phydev); in m88e1111_config_aneg()
376 if (phydev->autoneg != AUTONEG_ENABLE) { in m88e1111_config_aneg()
381 err = genphy_soft_reset(phydev); in m88e1111_config_aneg()
391 * marvell,reg-init property stored in the of_node for the phydev.
403 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
408 if (!phydev->mdio.dev.of_node) in marvell_of_reg_init()
411 paddr = of_get_property(phydev->mdio.dev.of_node, in marvell_of_reg_init()
416 saved_page = phy_save_page(phydev); in marvell_of_reg_init()
431 ret = marvell_write_page(phydev, page); in marvell_of_reg_init()
438 val = __phy_read(phydev, reg); in marvell_of_reg_init()
447 ret = __phy_write(phydev, reg, val); in marvell_of_reg_init()
452 return phy_restore_page(phydev, saved_page, ret); in marvell_of_reg_init()
455 static int marvell_of_reg_init(struct phy_device *phydev) in marvell_of_reg_init() argument
461 static int m88e1121_config_aneg_rgmii_delays(struct phy_device *phydev) in m88e1121_config_aneg_rgmii_delays() argument
465 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in m88e1121_config_aneg_rgmii_delays()
468 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in m88e1121_config_aneg_rgmii_delays()
470 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in m88e1121_config_aneg_rgmii_delays()
475 return phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1121_config_aneg_rgmii_delays()
480 static int m88e1121_config_aneg(struct phy_device *phydev) in m88e1121_config_aneg() argument
484 if (phy_interface_is_rgmii(phydev)) { in m88e1121_config_aneg()
485 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1121_config_aneg()
490 err = genphy_soft_reset(phydev); in m88e1121_config_aneg()
494 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1121_config_aneg()
498 return genphy_config_aneg(phydev); in m88e1121_config_aneg()
501 static int m88e1318_config_aneg(struct phy_device *phydev) in m88e1318_config_aneg() argument
505 err = phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, in m88e1318_config_aneg()
511 return m88e1121_config_aneg(phydev); in m88e1318_config_aneg()
542 * @phydev: target phy_device struct
549 static int marvell_config_aneg_fiber(struct phy_device *phydev) in marvell_config_aneg_fiber() argument
556 if (phydev->autoneg != AUTONEG_ENABLE) in marvell_config_aneg_fiber()
557 return genphy_setup_forced(phydev); in marvell_config_aneg_fiber()
560 phydev->advertising &= phydev->supported; in marvell_config_aneg_fiber()
561 advertise = phydev->advertising; in marvell_config_aneg_fiber()
564 adv = phy_read(phydev, MII_ADVERTISE); in marvell_config_aneg_fiber()
574 err = phy_write(phydev, MII_ADVERTISE, adv); in marvell_config_aneg_fiber()
585 int ctl = phy_read(phydev, MII_BMCR); in marvell_config_aneg_fiber()
598 changed = genphy_restart_aneg(phydev); in marvell_config_aneg_fiber()
603 static int m88e1510_config_aneg(struct phy_device *phydev) in m88e1510_config_aneg() argument
607 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
612 err = m88e1318_config_aneg(phydev); in m88e1510_config_aneg()
617 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) in m88e1510_config_aneg()
621 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in m88e1510_config_aneg()
625 err = marvell_config_aneg_fiber(phydev); in m88e1510_config_aneg()
629 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
632 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_aneg()
636 static void marvell_config_led(struct phy_device *phydev) in marvell_config_led() argument
641 switch (MARVELL_PHY_FAMILY_ID(phydev->phy_id)) { in marvell_config_led()
659 err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL, in marvell_config_led()
665 static int marvell_config_init(struct phy_device *phydev) in marvell_config_init() argument
668 marvell_config_led(phydev); in marvell_config_init()
671 return marvell_of_reg_init(phydev); in marvell_config_init()
674 static int m88e1116r_config_init(struct phy_device *phydev) in m88e1116r_config_init() argument
678 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
684 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1116r_config_init()
688 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1116r_config_init()
692 err = marvell_set_downshift(phydev, true, 8); in m88e1116r_config_init()
696 if (phy_interface_is_rgmii(phydev)) { in m88e1116r_config_init()
697 err = m88e1121_config_aneg_rgmii_delays(phydev); in m88e1116r_config_init()
702 err = genphy_soft_reset(phydev); in m88e1116r_config_init()
706 return marvell_config_init(phydev); in m88e1116r_config_init()
709 static int m88e3016_config_init(struct phy_device *phydev) in m88e3016_config_init() argument
714 ret = phy_modify(phydev, MII_88E3016_PHY_SPEC_CTRL, in m88e3016_config_init()
720 return marvell_config_init(phydev); in m88e3016_config_init()
723 static int m88e1111_config_init_hwcfg_mode(struct phy_device *phydev, in m88e1111_config_init_hwcfg_mode() argument
730 return phy_modify(phydev, MII_M1111_PHY_EXT_SR, in m88e1111_config_init_hwcfg_mode()
737 static int m88e1111_config_init_rgmii_delays(struct phy_device *phydev) in m88e1111_config_init_rgmii_delays() argument
741 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in m88e1111_config_init_rgmii_delays()
743 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { in m88e1111_config_init_rgmii_delays()
745 } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in m88e1111_config_init_rgmii_delays()
751 return phy_modify(phydev, MII_M1111_PHY_EXT_CR, in m88e1111_config_init_rgmii_delays()
756 static int m88e1111_config_init_rgmii(struct phy_device *phydev) in m88e1111_config_init_rgmii() argument
761 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rgmii()
765 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); in m88e1111_config_init_rgmii()
776 return phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); in m88e1111_config_init_rgmii()
779 static int m88e1111_config_init_sgmii(struct phy_device *phydev) in m88e1111_config_init_sgmii() argument
784 phydev, in m88e1111_config_init_sgmii()
791 return marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1111_config_init_sgmii()
794 static int m88e1111_config_init_rtbi(struct phy_device *phydev) in m88e1111_config_init_rtbi() argument
798 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1111_config_init_rtbi()
803 phydev, in m88e1111_config_init_rtbi()
810 err = genphy_soft_reset(phydev); in m88e1111_config_init_rtbi()
815 phydev, in m88e1111_config_init_rtbi()
820 static int m88e1111_config_init(struct phy_device *phydev) in m88e1111_config_init() argument
824 if (phy_interface_is_rgmii(phydev)) { in m88e1111_config_init()
825 err = m88e1111_config_init_rgmii(phydev); in m88e1111_config_init()
830 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1111_config_init()
831 err = m88e1111_config_init_sgmii(phydev); in m88e1111_config_init()
836 if (phydev->interface == PHY_INTERFACE_MODE_RTBI) { in m88e1111_config_init()
837 err = m88e1111_config_init_rtbi(phydev); in m88e1111_config_init()
842 err = marvell_of_reg_init(phydev); in m88e1111_config_init()
846 return genphy_soft_reset(phydev); in m88e1111_config_init()
849 static int m88e1318_config_init(struct phy_device *phydev) in m88e1318_config_init() argument
851 if (phy_interrupt_is_valid(phydev)) { in m88e1318_config_init()
853 phydev, MII_MARVELL_LED_PAGE, in m88e1318_config_init()
862 return marvell_config_init(phydev); in m88e1318_config_init()
865 static int m88e1510_config_init(struct phy_device *phydev) in m88e1510_config_init() argument
870 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1510_config_init()
872 err = marvell_set_page(phydev, 18); in m88e1510_config_init()
877 err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, in m88e1510_config_init()
884 err = phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1, 0, in m88e1510_config_init()
890 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1510_config_init()
895 return m88e1318_config_init(phydev); in m88e1510_config_init()
898 static int m88e1118_config_aneg(struct phy_device *phydev) in m88e1118_config_aneg() argument
902 err = genphy_soft_reset(phydev); in m88e1118_config_aneg()
906 err = marvell_set_polarity(phydev, phydev->mdix_ctrl); in m88e1118_config_aneg()
910 err = genphy_config_aneg(phydev); in m88e1118_config_aneg()
914 static int m88e1118_config_init(struct phy_device *phydev) in m88e1118_config_init() argument
919 err = marvell_set_page(phydev, MII_MARVELL_MSCR_PAGE); in m88e1118_config_init()
924 err = phy_write(phydev, 0x15, 0x1070); in m88e1118_config_init()
929 err = marvell_set_page(phydev, MII_MARVELL_LED_PAGE); in m88e1118_config_init()
934 if (phydev->dev_flags & MARVELL_PHY_M1118_DNS323_LEDS) in m88e1118_config_init()
935 err = phy_write(phydev, 0x10, 0x1100); in m88e1118_config_init()
937 err = phy_write(phydev, 0x10, 0x021e); in m88e1118_config_init()
941 err = marvell_of_reg_init(phydev); in m88e1118_config_init()
946 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1118_config_init()
950 return genphy_soft_reset(phydev); in m88e1118_config_init()
953 static int m88e1149_config_init(struct phy_device *phydev) in m88e1149_config_init() argument
958 err = marvell_set_page(phydev, MII_MARVELL_MSCR_PAGE); in m88e1149_config_init()
963 err = phy_write(phydev, 0x15, 0x1048); in m88e1149_config_init()
967 err = marvell_of_reg_init(phydev); in m88e1149_config_init()
972 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1149_config_init()
976 return genphy_soft_reset(phydev); in m88e1149_config_init()
979 static int m88e1145_config_init_rgmii(struct phy_device *phydev) in m88e1145_config_init_rgmii() argument
983 err = m88e1111_config_init_rgmii_delays(phydev); in m88e1145_config_init_rgmii()
987 if (phydev->dev_flags & MARVELL_PHY_M1145_FLAGS_RESISTANCE) { in m88e1145_config_init_rgmii()
988 err = phy_write(phydev, 0x1d, 0x0012); in m88e1145_config_init_rgmii()
992 err = phy_modify(phydev, 0x1e, 0x0fc0, in m88e1145_config_init_rgmii()
998 err = phy_write(phydev, 0x1d, 0x3); in m88e1145_config_init_rgmii()
1002 err = phy_write(phydev, 0x1e, 0x8000); in m88e1145_config_init_rgmii()
1007 static int m88e1145_config_init_sgmii(struct phy_device *phydev) in m88e1145_config_init_sgmii() argument
1010 phydev, MII_M1111_HWCFG_MODE_SGMII_NO_CLK, in m88e1145_config_init_sgmii()
1014 static int m88e1145_config_init(struct phy_device *phydev) in m88e1145_config_init() argument
1019 err = phy_write(phydev, 0x1d, 0x001b); in m88e1145_config_init()
1023 err = phy_write(phydev, 0x1e, 0x418f); in m88e1145_config_init()
1027 err = phy_write(phydev, 0x1d, 0x0016); in m88e1145_config_init()
1031 err = phy_write(phydev, 0x1e, 0xa2da); in m88e1145_config_init()
1035 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in m88e1145_config_init()
1036 err = m88e1145_config_init_rgmii(phydev); in m88e1145_config_init()
1041 if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { in m88e1145_config_init()
1042 err = m88e1145_config_init_sgmii(phydev); in m88e1145_config_init()
1047 err = marvell_of_reg_init(phydev); in m88e1145_config_init()
1058 static int m88e6390_errata(struct phy_device *phydev) in m88e6390_errata() argument
1062 err = phy_write(phydev, MII_BMCR, in m88e6390_errata()
1069 err = phy_write_paged(phydev, 0xf8, 0x08, 0x36); in m88e6390_errata()
1073 return genphy_soft_reset(phydev); in m88e6390_errata()
1076 static int m88e6390_config_aneg(struct phy_device *phydev) in m88e6390_config_aneg() argument
1080 err = m88e6390_errata(phydev); in m88e6390_config_aneg()
1084 return m88e1510_config_aneg(phydev); in m88e6390_config_aneg()
1107 * marvell_update_link - update link status in real time in @phydev
1108 * @phydev: target phy_device struct
1110 * Description: Update the value in phydev->link to reflect the
1113 static int marvell_update_link(struct phy_device *phydev, int fiber) in marvell_update_link() argument
1121 status = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_update_link()
1126 phydev->link = 0; in marvell_update_link()
1128 phydev->link = 1; in marvell_update_link()
1130 return genphy_update_link(phydev); in marvell_update_link()
1136 static int marvell_read_status_page_an(struct phy_device *phydev, in marvell_read_status_page_an() argument
1143 status = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_read_status_page_an()
1147 lpa = phy_read(phydev, MII_LPA); in marvell_read_status_page_an()
1151 lpagb = phy_read(phydev, MII_STAT1000); in marvell_read_status_page_an()
1156 phydev->duplex = DUPLEX_FULL; in marvell_read_status_page_an()
1158 phydev->duplex = DUPLEX_HALF; in marvell_read_status_page_an()
1161 phydev->pause = 0; in marvell_read_status_page_an()
1162 phydev->asym_pause = 0; in marvell_read_status_page_an()
1166 phydev->speed = SPEED_1000; in marvell_read_status_page_an()
1170 phydev->speed = SPEED_100; in marvell_read_status_page_an()
1174 phydev->speed = SPEED_10; in marvell_read_status_page_an()
1179 phydev->lp_advertising = in marvell_read_status_page_an()
1183 if (phydev->duplex == DUPLEX_FULL) { in marvell_read_status_page_an()
1184 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; in marvell_read_status_page_an()
1185 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; in marvell_read_status_page_an()
1189 phydev->lp_advertising = fiber_lpa_to_ethtool_lpa_t(lpa); in marvell_read_status_page_an()
1191 if (phydev->duplex == DUPLEX_FULL) { in marvell_read_status_page_an()
1193 phydev->pause = 0; in marvell_read_status_page_an()
1194 phydev->asym_pause = 0; in marvell_read_status_page_an()
1196 phydev->pause = 1; in marvell_read_status_page_an()
1197 phydev->asym_pause = 1; in marvell_read_status_page_an()
1199 phydev->pause = 1; in marvell_read_status_page_an()
1200 phydev->asym_pause = 0; in marvell_read_status_page_an()
1207 static int marvell_read_status_page_fixed(struct phy_device *phydev) in marvell_read_status_page_fixed() argument
1209 int bmcr = phy_read(phydev, MII_BMCR); in marvell_read_status_page_fixed()
1215 phydev->duplex = DUPLEX_FULL; in marvell_read_status_page_fixed()
1217 phydev->duplex = DUPLEX_HALF; in marvell_read_status_page_fixed()
1220 phydev->speed = SPEED_1000; in marvell_read_status_page_fixed()
1222 phydev->speed = SPEED_100; in marvell_read_status_page_fixed()
1224 phydev->speed = SPEED_10; in marvell_read_status_page_fixed()
1226 phydev->pause = 0; in marvell_read_status_page_fixed()
1227 phydev->asym_pause = 0; in marvell_read_status_page_fixed()
1228 phydev->lp_advertising = 0; in marvell_read_status_page_fixed()
1241 static int marvell_read_status_page(struct phy_device *phydev, int page) in marvell_read_status_page() argument
1254 err = marvell_update_link(phydev, fiber); in marvell_read_status_page()
1258 if (phydev->autoneg == AUTONEG_ENABLE) in marvell_read_status_page()
1259 err = marvell_read_status_page_an(phydev, fiber); in marvell_read_status_page()
1261 err = marvell_read_status_page_fixed(phydev); in marvell_read_status_page()
1275 static int marvell_read_status(struct phy_device *phydev) in marvell_read_status() argument
1280 if (phydev->supported & SUPPORTED_FIBRE && in marvell_read_status()
1281 phydev->interface != PHY_INTERFACE_MODE_SGMII) { in marvell_read_status()
1282 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1286 err = marvell_read_status_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_read_status()
1297 if (phydev->link) in marvell_read_status()
1301 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1306 return marvell_read_status_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1309 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_read_status()
1318 static int marvell_suspend(struct phy_device *phydev) in marvell_suspend() argument
1323 if (!(phydev->supported & SUPPORTED_FIBRE)) { in marvell_suspend()
1324 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_suspend()
1329 err = genphy_suspend(phydev); in marvell_suspend()
1334 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1340 return genphy_suspend(phydev); in marvell_suspend()
1343 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_suspend()
1352 static int marvell_resume(struct phy_device *phydev) in marvell_resume() argument
1357 if (!(phydev->supported & SUPPORTED_FIBRE)) { in marvell_resume()
1358 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); in marvell_resume()
1363 err = genphy_resume(phydev); in marvell_resume()
1368 err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1374 return genphy_resume(phydev); in marvell_resume()
1377 marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); in marvell_resume()
1381 static int marvell_aneg_done(struct phy_device *phydev) in marvell_aneg_done() argument
1383 int retval = phy_read(phydev, MII_M1011_PHY_STATUS); in marvell_aneg_done()
1388 static int m88e1121_did_interrupt(struct phy_device *phydev) in m88e1121_did_interrupt() argument
1392 imask = phy_read(phydev, MII_M1011_IEVENT); in m88e1121_did_interrupt()
1400 static void m88e1318_get_wol(struct phy_device *phydev, in m88e1318_get_wol() argument
1408 oldpage = phy_select_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_get_wol()
1412 ret = __phy_read(phydev, MII_88E1318S_PHY_WOL_CTRL); in m88e1318_get_wol()
1417 phy_restore_page(phydev, oldpage, ret); in m88e1318_get_wol()
1420 static int m88e1318_set_wol(struct phy_device *phydev, in m88e1318_set_wol() argument
1425 oldpage = phy_save_page(phydev); in m88e1318_set_wol()
1431 err = marvell_write_page(phydev, MII_MARVELL_COPPER_PAGE); in m88e1318_set_wol()
1441 if (!phy_interrupt_is_valid(phydev)) in m88e1318_set_wol()
1442 __phy_read(phydev, MII_M1011_IEVENT); in m88e1318_set_wol()
1445 err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, in m88e1318_set_wol()
1450 err = marvell_write_page(phydev, MII_MARVELL_LED_PAGE); in m88e1318_set_wol()
1455 err = __phy_modify(phydev, MII_88E1318S_PHY_LED_TCR, in m88e1318_set_wol()
1462 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1467 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD2, in m88e1318_set_wol()
1468 ((phydev->attached_dev->dev_addr[5] << 8) | in m88e1318_set_wol()
1469 phydev->attached_dev->dev_addr[4])); in m88e1318_set_wol()
1472 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD1, in m88e1318_set_wol()
1473 ((phydev->attached_dev->dev_addr[3] << 8) | in m88e1318_set_wol()
1474 phydev->attached_dev->dev_addr[2])); in m88e1318_set_wol()
1477 err = __phy_write(phydev, MII_88E1318S_PHY_MAGIC_PACKET_WORD0, in m88e1318_set_wol()
1478 ((phydev->attached_dev->dev_addr[1] << 8) | in m88e1318_set_wol()
1479 phydev->attached_dev->dev_addr[0])); in m88e1318_set_wol()
1484 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, 0, in m88e1318_set_wol()
1490 err = marvell_write_page(phydev, MII_MARVELL_WOL_PAGE); in m88e1318_set_wol()
1495 err = __phy_modify(phydev, MII_88E1318S_PHY_WOL_CTRL, in m88e1318_set_wol()
1503 return phy_restore_page(phydev, oldpage, err); in m88e1318_set_wol()
1506 static int marvell_get_sset_count(struct phy_device *phydev) in marvell_get_sset_count() argument
1508 if (phydev->supported & SUPPORTED_FIBRE) in marvell_get_sset_count()
1514 static void marvell_get_strings(struct phy_device *phydev, u8 *data) in marvell_get_strings() argument
1516 int count = marvell_get_sset_count(phydev); in marvell_get_strings()
1525 static u64 marvell_get_stat(struct phy_device *phydev, int i) in marvell_get_stat() argument
1528 struct marvell_priv *priv = phydev->priv; in marvell_get_stat()
1532 val = phy_read_paged(phydev, stat.page, stat.reg); in marvell_get_stat()
1544 static void marvell_get_stats(struct phy_device *phydev, in marvell_get_stats() argument
1547 int count = marvell_get_sset_count(phydev); in marvell_get_stats()
1551 data[i] = marvell_get_stat(phydev, i); in marvell_get_stats()
1555 static int m88e1121_get_temp(struct phy_device *phydev, long *temp) in m88e1121_get_temp() argument
1563 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e1121_get_temp()
1568 ret = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
1572 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
1580 val = __phy_read(phydev, MII_88E1121_MISC_TEST); in m88e1121_get_temp()
1587 ret = __phy_write(phydev, MII_88E1121_MISC_TEST, in m88e1121_get_temp()
1595 return phy_restore_page(phydev, oldpage, ret); in m88e1121_get_temp()
1602 struct phy_device *phydev = dev_get_drvdata(dev); in m88e1121_hwmon_read() local
1607 err = m88e1121_get_temp(phydev, temp); in m88e1121_hwmon_read()
1667 static int m88e1510_get_temp(struct phy_device *phydev, long *temp) in m88e1510_get_temp() argument
1673 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp()
1683 static int m88e1510_get_temp_critical(struct phy_device *phydev, long *temp) in m88e1510_get_temp_critical() argument
1689 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_critical()
1702 static int m88e1510_set_temp_critical(struct phy_device *phydev, long temp) in m88e1510_set_temp_critical() argument
1707 return phy_modify_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_set_temp_critical()
1713 static int m88e1510_get_temp_alarm(struct phy_device *phydev, long *alarm) in m88e1510_get_temp_alarm() argument
1719 ret = phy_read_paged(phydev, MII_MARVELL_MISC_TEST_PAGE, in m88e1510_get_temp_alarm()
1733 struct phy_device *phydev = dev_get_drvdata(dev); in m88e1510_hwmon_read() local
1738 err = m88e1510_get_temp(phydev, temp); in m88e1510_hwmon_read()
1741 err = m88e1510_get_temp_critical(phydev, temp); in m88e1510_hwmon_read()
1744 err = m88e1510_get_temp_alarm(phydev, temp); in m88e1510_hwmon_read()
1757 struct phy_device *phydev = dev_get_drvdata(dev); in m88e1510_hwmon_write() local
1762 err = m88e1510_set_temp_critical(phydev, temp); in m88e1510_hwmon_write()
1815 static int m88e6390_get_temp(struct phy_device *phydev, long *temp) in m88e6390_get_temp() argument
1824 oldpage = phy_select_page(phydev, MII_MARVELL_MISC_TEST_PAGE); in m88e6390_get_temp()
1829 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
1837 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
1848 ret = __phy_read(phydev, MII_88E6390_TEMP_SENSOR); in m88e6390_get_temp()
1858 ret = __phy_read(phydev, MII_88E6390_MISC_TEST); in m88e6390_get_temp()
1865 ret = __phy_write(phydev, MII_88E6390_MISC_TEST, ret); in m88e6390_get_temp()
1868 phy_restore_page(phydev, oldpage, ret); in m88e6390_get_temp()
1877 struct phy_device *phydev = dev_get_drvdata(dev); in m88e6390_hwmon_read() local
1882 err = m88e6390_get_temp(phydev, temp); in m88e6390_hwmon_read()
1932 static int marvell_hwmon_name(struct phy_device *phydev) in marvell_hwmon_name() argument
1934 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_name()
1935 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_name()
1952 static int marvell_hwmon_probe(struct phy_device *phydev, in marvell_hwmon_probe() argument
1955 struct marvell_priv *priv = phydev->priv; in marvell_hwmon_probe()
1956 struct device *dev = &phydev->mdio.dev; in marvell_hwmon_probe()
1959 err = marvell_hwmon_name(phydev); in marvell_hwmon_probe()
1964 dev, priv->hwmon_name, phydev, chip, NULL); in marvell_hwmon_probe()
1969 static int m88e1121_hwmon_probe(struct phy_device *phydev) in m88e1121_hwmon_probe() argument
1971 return marvell_hwmon_probe(phydev, &m88e1121_hwmon_chip_info); in m88e1121_hwmon_probe()
1974 static int m88e1510_hwmon_probe(struct phy_device *phydev) in m88e1510_hwmon_probe() argument
1976 return marvell_hwmon_probe(phydev, &m88e1510_hwmon_chip_info); in m88e1510_hwmon_probe()
1979 static int m88e6390_hwmon_probe(struct phy_device *phydev) in m88e6390_hwmon_probe() argument
1981 return marvell_hwmon_probe(phydev, &m88e6390_hwmon_chip_info); in m88e6390_hwmon_probe()
1984 static int m88e1121_hwmon_probe(struct phy_device *phydev) in m88e1121_hwmon_probe() argument
1989 static int m88e1510_hwmon_probe(struct phy_device *phydev) in m88e1510_hwmon_probe() argument
1994 static int m88e6390_hwmon_probe(struct phy_device *phydev) in m88e6390_hwmon_probe() argument
2000 static int marvell_probe(struct phy_device *phydev) in marvell_probe() argument
2004 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); in marvell_probe()
2008 phydev->priv = priv; in marvell_probe()
2013 static int m88e1121_probe(struct phy_device *phydev) in m88e1121_probe() argument
2017 err = marvell_probe(phydev); in m88e1121_probe()
2021 return m88e1121_hwmon_probe(phydev); in m88e1121_probe()
2024 static int m88e1510_probe(struct phy_device *phydev) in m88e1510_probe() argument
2028 err = marvell_probe(phydev); in m88e1510_probe()
2032 return m88e1510_hwmon_probe(phydev); in m88e1510_probe()
2035 static int m88e6390_probe(struct phy_device *phydev) in m88e6390_probe() argument
2039 err = marvell_probe(phydev); in m88e6390_probe()
2043 return m88e6390_hwmon_probe(phydev); in m88e6390_probe()