Lines Matching full:phydev
85 static int at803x_debug_reg_read(struct phy_device *phydev, u16 reg) in at803x_debug_reg_read() argument
89 ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg); in at803x_debug_reg_read()
93 return phy_read(phydev, AT803X_DEBUG_DATA); in at803x_debug_reg_read()
96 static int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, in at803x_debug_reg_mask() argument
102 ret = at803x_debug_reg_read(phydev, reg); in at803x_debug_reg_mask()
110 return phy_write(phydev, AT803X_DEBUG_DATA, val); in at803x_debug_reg_mask()
113 static inline int at803x_enable_rx_delay(struct phy_device *phydev) in at803x_enable_rx_delay() argument
115 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, in at803x_enable_rx_delay()
119 static inline int at803x_enable_tx_delay(struct phy_device *phydev) in at803x_enable_tx_delay() argument
121 return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, in at803x_enable_tx_delay()
126 static void at803x_context_save(struct phy_device *phydev, in at803x_context_save() argument
129 context->bmcr = phy_read(phydev, MII_BMCR); in at803x_context_save()
130 context->advertise = phy_read(phydev, MII_ADVERTISE); in at803x_context_save()
131 context->control1000 = phy_read(phydev, MII_CTRL1000); in at803x_context_save()
132 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_context_save()
133 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); in at803x_context_save()
134 context->led_control = phy_read(phydev, AT803X_LED_CONTROL); in at803x_context_save()
138 static void at803x_context_restore(struct phy_device *phydev, in at803x_context_restore() argument
141 phy_write(phydev, MII_BMCR, context->bmcr); in at803x_context_restore()
142 phy_write(phydev, MII_ADVERTISE, context->advertise); in at803x_context_restore()
143 phy_write(phydev, MII_CTRL1000, context->control1000); in at803x_context_restore()
144 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); in at803x_context_restore()
145 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); in at803x_context_restore()
146 phy_write(phydev, AT803X_LED_CONTROL, context->led_control); in at803x_context_restore()
149 static int at803x_set_wol(struct phy_device *phydev, in at803x_set_wol() argument
152 struct net_device *ndev = phydev->attached_dev; in at803x_set_wol()
172 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, in at803x_set_wol()
174 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, in at803x_set_wol()
176 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, in at803x_set_wol()
178 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, in at803x_set_wol()
182 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_set_wol()
184 ret = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_set_wol()
187 value = phy_read(phydev, AT803X_INTR_STATUS); in at803x_set_wol()
189 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_set_wol()
191 ret = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_set_wol()
194 value = phy_read(phydev, AT803X_INTR_STATUS); in at803x_set_wol()
200 static void at803x_get_wol(struct phy_device *phydev, in at803x_get_wol() argument
208 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_get_wol()
213 static int at803x_suspend(struct phy_device *phydev) in at803x_suspend() argument
218 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_suspend()
226 phy_modify(phydev, MII_BMCR, 0, value); in at803x_suspend()
231 static int at803x_resume(struct phy_device *phydev) in at803x_resume() argument
233 return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0); in at803x_resume()
236 static int at803x_probe(struct phy_device *phydev) in at803x_probe() argument
238 struct device *dev = &phydev->mdio.dev; in at803x_probe()
245 phydev->priv = priv; in at803x_probe()
250 static int at803x_config_init(struct phy_device *phydev) in at803x_config_init() argument
254 ret = genphy_config_init(phydev); in at803x_config_init()
258 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID || in at803x_config_init()
259 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in at803x_config_init()
260 ret = at803x_enable_rx_delay(phydev); in at803x_config_init()
265 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID || in at803x_config_init()
266 phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { in at803x_config_init()
267 ret = at803x_enable_tx_delay(phydev); in at803x_config_init()
275 static int at803x_ack_interrupt(struct phy_device *phydev) in at803x_ack_interrupt() argument
279 err = phy_read(phydev, AT803X_INTR_STATUS); in at803x_ack_interrupt()
284 static int at803x_config_intr(struct phy_device *phydev) in at803x_config_intr() argument
289 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_config_intr()
291 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in at803x_config_intr()
298 err = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_config_intr()
301 err = phy_write(phydev, AT803X_INTR_ENABLE, 0); in at803x_config_intr()
306 static void at803x_link_change_notify(struct phy_device *phydev) in at803x_link_change_notify() argument
308 struct at803x_priv *priv = phydev->priv; in at803x_link_change_notify()
317 if (phydev->state == PHY_NOLINK) { in at803x_link_change_notify()
318 if (phydev->mdio.reset && !priv->phy_reset) { in at803x_link_change_notify()
321 at803x_context_save(phydev, &context); in at803x_link_change_notify()
323 phy_device_reset(phydev, 1); in at803x_link_change_notify()
325 phy_device_reset(phydev, 0); in at803x_link_change_notify()
328 at803x_context_restore(phydev, &context); in at803x_link_change_notify()
330 phydev_dbg(phydev, "%s(): phy was reset\n", in at803x_link_change_notify()
339 static int at803x_aneg_done(struct phy_device *phydev) in at803x_aneg_done() argument
343 int aneg_done = genphy_aneg_done(phydev); in at803x_aneg_done()
351 ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG); in at803x_aneg_done()
356 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr & ~AT803X_BT_BX_REG_SEL); in at803x_aneg_done()
359 if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) { in at803x_aneg_done()
364 phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL); in at803x_aneg_done()