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
85 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt970_config_intr()
86 err = phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN); in lxt970_config_intr()
88 err = phy_write(phydev, MII_LXT970_IER, 0); in lxt970_config_intr()
93 static int lxt970_config_init(struct phy_device *phydev) in lxt970_config_init() argument
97 err = phy_write(phydev, MII_LXT970_CONFIG, 0); in lxt970_config_init()
103 static int lxt971_ack_interrupt(struct phy_device *phydev) in lxt971_ack_interrupt() argument
105 int err = phy_read(phydev, MII_LXT971_ISR); in lxt971_ack_interrupt()
113 static int lxt971_config_intr(struct phy_device *phydev) in lxt971_config_intr() argument
117 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in lxt971_config_intr()
118 err = phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN); in lxt971_config_intr()
120 err = phy_write(phydev, MII_LXT971_IER, 0); in lxt971_config_intr()
130 static int lxt973a2_update_link(struct phy_device *phydev) in lxt973a2_update_link() argument
137 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
142 control = phy_read(phydev, MII_BMCR); in lxt973a2_update_link()
148 status = phy_read(phydev, MII_BMSR); in lxt973a2_update_link()
155 phydev->link = 0; in lxt973a2_update_link()
157 phydev->link = 1; in lxt973a2_update_link()
162 static int lxt973a2_read_status(struct phy_device *phydev) in lxt973a2_read_status() argument
170 err = lxt973a2_update_link(phydev); in lxt973a2_read_status()
174 if (AUTONEG_ENABLE == phydev->autoneg) { in lxt973a2_read_status()
177 adv = phy_read(phydev, MII_ADVERTISE); in lxt973a2_read_status()
183 lpa = phy_read(phydev, MII_LPA); in lxt973a2_read_status()
195 phydev->speed = SPEED_10; in lxt973a2_read_status()
196 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
197 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
200 phydev->speed = SPEED_1000; in lxt973a2_read_status()
203 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
205 phydev->speed = SPEED_100; in lxt973a2_read_status()
208 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
211 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
214 if (phydev->duplex == DUPLEX_FULL) { in lxt973a2_read_status()
215 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; in lxt973a2_read_status()
216 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; in lxt973a2_read_status()
219 int bmcr = phy_read(phydev, MII_BMCR); in lxt973a2_read_status()
225 phydev->duplex = DUPLEX_FULL; in lxt973a2_read_status()
227 phydev->duplex = DUPLEX_HALF; in lxt973a2_read_status()
230 phydev->speed = SPEED_1000; in lxt973a2_read_status()
232 phydev->speed = SPEED_100; in lxt973a2_read_status()
234 phydev->speed = SPEED_10; in lxt973a2_read_status()
236 phydev->pause = phydev->asym_pause = 0; in lxt973a2_read_status()
242 static int lxt973_probe(struct phy_device *phydev) in lxt973_probe() argument
244 int val = phy_read(phydev, MII_LXT973_PCR); in lxt973_probe()
251 val = phy_read(phydev, MII_BMCR); in lxt973_probe()
254 phy_write(phydev, MII_BMCR, val); in lxt973_probe()
256 phydev->priv = lxt973_probe; in lxt973_probe()
258 phydev->priv = NULL; in lxt973_probe()
263 static int lxt973_config_aneg(struct phy_device *phydev) in lxt973_config_aneg() argument
266 return phydev->priv ? 0 : genphy_config_aneg(phydev); in lxt973_config_aneg()