Lines Matching refs:phydev

64 static int lxt970_ack_interrupt(struct phy_device *phydev)  in lxt970_ack_interrupt()  argument
68 err = phy_read(phydev, MII_BMSR); in lxt970_ack_interrupt()
73 err = phy_read(phydev, MII_LXT970_ISR); in lxt970_ack_interrupt()
81 static int lxt970_config_intr(struct phy_device *phydev) in lxt970_config_intr() argument
83 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt970_config_intr()
84 return phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN); in lxt970_config_intr()
86 return phy_write(phydev, MII_LXT970_IER, 0); in lxt970_config_intr()
89 static int lxt970_config_init(struct phy_device *phydev) in lxt970_config_init() argument
91 return phy_write(phydev, MII_LXT970_CONFIG, 0); in lxt970_config_init()
95 static int lxt971_ack_interrupt(struct phy_device *phydev) in lxt971_ack_interrupt() argument
97 int err = phy_read(phydev, MII_LXT971_ISR); in lxt971_ack_interrupt()
105 static int lxt971_config_intr(struct phy_device *phydev) in lxt971_config_intr() argument
107 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt971_config_intr()
108 return phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN); in lxt971_config_intr()
110 return phy_write(phydev, MII_LXT971_IER, 0); in lxt971_config_intr()
118 static int lxt973a2_update_link(struct phy_device *phydev) in lxt973a2_update_link() argument
125 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
130 control = phy_read(phydev, MII_BMCR); in lxt973a2_update_link()
136 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
143 phydev->link = 0; in lxt973a2_update_link()
145 phydev->link = 1; in lxt973a2_update_link()
150 static int lxt973a2_read_status(struct phy_device *phydev) in lxt973a2_read_status() argument
157 err = lxt973a2_update_link(phydev); in lxt973a2_read_status()
161 if (AUTONEG_ENABLE == phydev->autoneg) { in lxt973a2_read_status()
164 adv = phy_read(phydev, MII_ADVERTISE); in lxt973a2_read_status()
170 lpa = phy_read(phydev, MII_LPA); in lxt973a2_read_status()
180 phydev->lp_advertising = mii_lpa_to_ethtool_lpa_t(lpa); in lxt973a2_read_status()
184 phydev->speed = SPEED_10; in lxt973a2_read_status()
185 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
186 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
189 phydev->speed = SPEED_100; in lxt973a2_read_status()
192 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
195 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
198 if (phydev->duplex == DUPLEX_FULL) { in lxt973a2_read_status()
199 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; in lxt973a2_read_status()
200 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; in lxt973a2_read_status()
203 int bmcr = phy_read(phydev, MII_BMCR); in lxt973a2_read_status()
209 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
211 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
214 phydev->speed = SPEED_1000; in lxt973a2_read_status()
216 phydev->speed = SPEED_100; in lxt973a2_read_status()
218 phydev->speed = SPEED_10; in lxt973a2_read_status()
220 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
221 phydev->lp_advertising = 0; in lxt973a2_read_status()
227 static int lxt973_probe(struct phy_device *phydev) in lxt973_probe() argument
229 int val = phy_read(phydev, MII_LXT973_PCR); in lxt973_probe()
236 val = phy_read(phydev, MII_BMCR); in lxt973_probe()
239 phy_write(phydev, MII_BMCR, val); in lxt973_probe()
241 phydev->priv = lxt973_probe; in lxt973_probe()
243 phydev->priv = NULL; in lxt973_probe()
248 static int lxt973_config_aneg(struct phy_device *phydev) in lxt973_config_aneg() argument
251 return phydev->priv ? 0 : genphy_config_aneg(phydev); in lxt973_config_aneg()