Lines Matching refs:phydev
59 static int lxt970_ack_interrupt(struct phy_device *phydev) in lxt970_ack_interrupt() argument
63 err = phy_read(phydev, MII_BMSR); in lxt970_ack_interrupt()
68 err = phy_read(phydev, MII_LXT970_ISR); in lxt970_ack_interrupt()
76 static int lxt970_config_intr(struct phy_device *phydev) in lxt970_config_intr() argument
78 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt970_config_intr()
79 return phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN); in lxt970_config_intr()
81 return phy_write(phydev, MII_LXT970_IER, 0); in lxt970_config_intr()
84 static int lxt970_config_init(struct phy_device *phydev) in lxt970_config_init() argument
86 return phy_write(phydev, MII_LXT970_CONFIG, 0); in lxt970_config_init()
90 static int lxt971_ack_interrupt(struct phy_device *phydev) in lxt971_ack_interrupt() argument
92 int err = phy_read(phydev, MII_LXT971_ISR); in lxt971_ack_interrupt()
100 static int lxt971_config_intr(struct phy_device *phydev) in lxt971_config_intr() argument
102 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt971_config_intr()
103 return phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN); in lxt971_config_intr()
105 return phy_write(phydev, MII_LXT971_IER, 0); in lxt971_config_intr()
113 static int lxt973a2_update_link(struct phy_device *phydev) in lxt973a2_update_link() argument
120 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
125 control = phy_read(phydev, MII_BMCR); in lxt973a2_update_link()
131 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
138 phydev->link = 0; in lxt973a2_update_link()
140 phydev->link = 1; in lxt973a2_update_link()
145 static int lxt973a2_read_status(struct phy_device *phydev) in lxt973a2_read_status() argument
152 err = lxt973a2_update_link(phydev); in lxt973a2_read_status()
156 if (AUTONEG_ENABLE == phydev->autoneg) { in lxt973a2_read_status()
159 adv = phy_read(phydev, MII_ADVERTISE); in lxt973a2_read_status()
165 lpa = phy_read(phydev, MII_LPA); in lxt973a2_read_status()
175 mii_lpa_to_linkmode_lpa_t(phydev->lp_advertising, lpa); in lxt973a2_read_status()
179 phydev->speed = SPEED_10; in lxt973a2_read_status()
180 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
181 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
184 phydev->speed = SPEED_100; in lxt973a2_read_status()
187 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
190 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
193 if (phydev->duplex == DUPLEX_FULL) { in lxt973a2_read_status()
194 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; in lxt973a2_read_status()
195 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; in lxt973a2_read_status()
198 int bmcr = phy_read(phydev, MII_BMCR); in lxt973a2_read_status()
204 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
206 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
209 phydev->speed = SPEED_1000; in lxt973a2_read_status()
211 phydev->speed = SPEED_100; in lxt973a2_read_status()
213 phydev->speed = SPEED_10; in lxt973a2_read_status()
215 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
216 linkmode_zero(phydev->lp_advertising); in lxt973a2_read_status()
222 static int lxt973_probe(struct phy_device *phydev) in lxt973_probe() argument
224 int val = phy_read(phydev, MII_LXT973_PCR); in lxt973_probe()
231 val = phy_read(phydev, MII_BMCR); in lxt973_probe()
234 phy_write(phydev, MII_BMCR, val); in lxt973_probe()
236 phydev->priv = lxt973_probe; in lxt973_probe()
238 phydev->priv = NULL; in lxt973_probe()
243 static int lxt973_config_aneg(struct phy_device *phydev) in lxt973_config_aneg() argument
246 return phydev->priv ? 0 : genphy_config_aneg(phydev); in lxt973_config_aneg()