Lines Matching refs:phydev
23 static int bcm84881_wait_init(struct phy_device *phydev) in bcm84881_wait_init() argument
27 return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, in bcm84881_wait_init()
32 static int bcm84881_config_init(struct phy_device *phydev) in bcm84881_config_init() argument
34 switch (phydev->interface) { in bcm84881_config_init()
45 static int bcm84881_probe(struct phy_device *phydev) in bcm84881_probe() argument
50 if (!phydev->is_c45 || in bcm84881_probe()
51 (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) in bcm84881_probe()
57 static int bcm84881_get_features(struct phy_device *phydev) in bcm84881_get_features() argument
61 ret = genphy_c45_pma_read_abilities(phydev); in bcm84881_get_features()
67 phydev->supported); in bcm84881_get_features()
69 phydev->supported); in bcm84881_get_features()
74 static int bcm84881_config_aneg(struct phy_device *phydev) in bcm84881_config_aneg() argument
83 ret = bcm84881_wait_init(phydev); in bcm84881_config_aneg()
88 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in bcm84881_config_aneg()
91 if (phydev->autoneg == AUTONEG_DISABLE) in bcm84881_config_aneg()
94 ret = genphy_c45_an_config_aneg(phydev); in bcm84881_config_aneg()
100 adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); in bcm84881_config_aneg()
101 ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, in bcm84881_config_aneg()
110 return genphy_c45_check_and_restart_aneg(phydev, changed); in bcm84881_config_aneg()
113 static int bcm84881_aneg_done(struct phy_device *phydev) in bcm84881_aneg_done() argument
117 val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); in bcm84881_aneg_done()
121 bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); in bcm84881_aneg_done()
129 static int bcm84881_read_status(struct phy_device *phydev) in bcm84881_read_status() argument
134 val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_CTRL1); in bcm84881_read_status()
139 phydev->link = 0; in bcm84881_read_status()
143 val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); in bcm84881_read_status()
147 bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); in bcm84881_read_status()
151 phydev->autoneg_complete = !!(val & MDIO_AN_STAT1_COMPLETE) && in bcm84881_read_status()
153 phydev->link = !!(val & MDIO_STAT1_LSTATUS) && in bcm84881_read_status()
155 if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) in bcm84881_read_status()
156 phydev->link = false; in bcm84881_read_status()
158 linkmode_zero(phydev->lp_advertising); in bcm84881_read_status()
159 phydev->speed = SPEED_UNKNOWN; in bcm84881_read_status()
160 phydev->duplex = DUPLEX_UNKNOWN; in bcm84881_read_status()
161 phydev->pause = 0; in bcm84881_read_status()
162 phydev->asym_pause = 0; in bcm84881_read_status()
163 phydev->mdix = 0; in bcm84881_read_status()
165 if (!phydev->link) in bcm84881_read_status()
168 if (phydev->autoneg_complete) { in bcm84881_read_status()
169 val = genphy_c45_read_lpa(phydev); in bcm84881_read_status()
173 val = phy_read_mmd(phydev, MDIO_MMD_AN, in bcm84881_read_status()
178 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); in bcm84881_read_status()
180 if (phydev->autoneg == AUTONEG_ENABLE) in bcm84881_read_status()
181 phy_resolve_aneg_linkmode(phydev); in bcm84881_read_status()
184 if (phydev->autoneg == AUTONEG_DISABLE) { in bcm84881_read_status()
188 phydev->link = 0; in bcm84881_read_status()
197 val = phy_read_mmd(phydev, MDIO_MMD_VEND1, 0x4011); in bcm84881_read_status()
200 phydev->interface = PHY_INTERFACE_MODE_SGMII; in bcm84881_read_status()
202 phydev->interface = PHY_INTERFACE_MODE_10GBASER; in bcm84881_read_status()
204 phydev->interface = PHY_INTERFACE_MODE_2500BASEX; in bcm84881_read_status()
207 phydev->speed = SPEED_100; in bcm84881_read_status()
210 phydev->speed = SPEED_1000; in bcm84881_read_status()
213 phydev->speed = SPEED_10000; in bcm84881_read_status()
216 phydev->speed = SPEED_2500; in bcm84881_read_status()
219 phydev->speed = SPEED_5000; in bcm84881_read_status()
223 return genphy_c45_read_mdix(phydev); in bcm84881_read_status()