Lines Matching refs:phydev
62 static int lxt970_ack_interrupt(struct phy_device *phydev) in lxt970_ack_interrupt() argument
66 err = phy_read(phydev, MII_BMSR); in lxt970_ack_interrupt()
71 err = phy_read(phydev, MII_LXT970_ISR); in lxt970_ack_interrupt()
79 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 err = lxt970_ack_interrupt(phydev); in lxt970_config_intr()
88 err = phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN); in lxt970_config_intr()
90 err = phy_write(phydev, MII_LXT970_IER, 0); in lxt970_config_intr()
94 err = lxt970_ack_interrupt(phydev); in lxt970_config_intr()
100 static irqreturn_t lxt970_handle_interrupt(struct phy_device *phydev) in lxt970_handle_interrupt() argument
107 irq_status = phy_read(phydev, MII_BMSR); in lxt970_handle_interrupt()
109 phy_error(phydev); in lxt970_handle_interrupt()
113 irq_status = phy_read(phydev, MII_LXT970_ISR); in lxt970_handle_interrupt()
115 phy_error(phydev); in lxt970_handle_interrupt()
122 phy_trigger_machine(phydev); in lxt970_handle_interrupt()
127 static int lxt970_config_init(struct phy_device *phydev) in lxt970_config_init() argument
129 return phy_write(phydev, MII_LXT970_CONFIG, 0); in lxt970_config_init()
133 static int lxt971_ack_interrupt(struct phy_device *phydev) in lxt971_ack_interrupt() argument
135 int err = phy_read(phydev, MII_LXT971_ISR); in lxt971_ack_interrupt()
143 static int lxt971_config_intr(struct phy_device *phydev) in lxt971_config_intr() argument
147 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lxt971_config_intr()
148 err = lxt971_ack_interrupt(phydev); in lxt971_config_intr()
152 err = phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN); in lxt971_config_intr()
154 err = phy_write(phydev, MII_LXT971_IER, 0); in lxt971_config_intr()
158 err = lxt971_ack_interrupt(phydev); in lxt971_config_intr()
164 static irqreturn_t lxt971_handle_interrupt(struct phy_device *phydev) in lxt971_handle_interrupt() argument
168 irq_status = phy_read(phydev, MII_LXT971_ISR); in lxt971_handle_interrupt()
170 phy_error(phydev); in lxt971_handle_interrupt()
177 phy_trigger_machine(phydev); in lxt971_handle_interrupt()
187 static int lxt973a2_update_link(struct phy_device *phydev) in lxt973a2_update_link() argument
194 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
199 control = phy_read(phydev, MII_BMCR); in lxt973a2_update_link()
205 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
212 phydev->link = 0; in lxt973a2_update_link()
214 phydev->link = 1; in lxt973a2_update_link()
219 static int lxt973a2_read_status(struct phy_device *phydev) in lxt973a2_read_status() argument
226 err = lxt973a2_update_link(phydev); in lxt973a2_read_status()
230 if (AUTONEG_ENABLE == phydev->autoneg) { in lxt973a2_read_status()
233 adv = phy_read(phydev, MII_ADVERTISE); in lxt973a2_read_status()
239 lpa = phy_read(phydev, MII_LPA); in lxt973a2_read_status()
249 mii_lpa_to_linkmode_lpa_t(phydev->lp_advertising, lpa); in lxt973a2_read_status()
253 phydev->speed = SPEED_10; in lxt973a2_read_status()
254 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
255 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
258 phydev->speed = SPEED_100; in lxt973a2_read_status()
261 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
264 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
267 phy_resolve_aneg_pause(phydev); in lxt973a2_read_status()
269 err = genphy_read_status_fixed(phydev); in lxt973a2_read_status()
273 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
274 linkmode_zero(phydev->lp_advertising); in lxt973a2_read_status()
280 static int lxt973_probe(struct phy_device *phydev) in lxt973_probe() argument
282 int val = phy_read(phydev, MII_LXT973_PCR); in lxt973_probe()
289 val = phy_read(phydev, MII_BMCR); in lxt973_probe()
292 phy_write(phydev, MII_BMCR, val); in lxt973_probe()
294 phydev->priv = lxt973_probe; in lxt973_probe()
295 phydev->port = PORT_FIBRE; in lxt973_probe()
297 phydev->priv = NULL; in lxt973_probe()
302 static int lxt973_config_aneg(struct phy_device *phydev) in lxt973_config_aneg() argument
305 return phydev->priv ? 0 : genphy_config_aneg(phydev); in lxt973_config_aneg()