Lines Matching refs:phydev

65 static void at803x_context_save(struct phy_device *phydev,  in at803x_context_save()  argument
68 context->bmcr = phy_read(phydev, MII_BMCR); in at803x_context_save()
69 context->advertise = phy_read(phydev, MII_ADVERTISE); in at803x_context_save()
70 context->control1000 = phy_read(phydev, MII_CTRL1000); in at803x_context_save()
71 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_context_save()
72 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); in at803x_context_save()
73 context->led_control = phy_read(phydev, AT803X_LED_CONTROL); in at803x_context_save()
77 static void at803x_context_restore(struct phy_device *phydev, in at803x_context_restore() argument
80 phy_write(phydev, MII_BMCR, context->bmcr); in at803x_context_restore()
81 phy_write(phydev, MII_ADVERTISE, context->advertise); in at803x_context_restore()
82 phy_write(phydev, MII_CTRL1000, context->control1000); in at803x_context_restore()
83 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); in at803x_context_restore()
84 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); in at803x_context_restore()
85 phy_write(phydev, AT803X_LED_CONTROL, context->led_control); in at803x_context_restore()
88 static int at803x_set_wol(struct phy_device *phydev, in at803x_set_wol() argument
91 struct net_device *ndev = phydev->attached_dev; in at803x_set_wol()
111 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, in at803x_set_wol()
113 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, in at803x_set_wol()
115 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, in at803x_set_wol()
117 phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, in at803x_set_wol()
121 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_set_wol()
123 ret = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_set_wol()
126 value = phy_read(phydev, AT803X_INTR_STATUS); in at803x_set_wol()
128 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_set_wol()
130 ret = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_set_wol()
133 value = phy_read(phydev, AT803X_INTR_STATUS); in at803x_set_wol()
139 static void at803x_get_wol(struct phy_device *phydev, in at803x_get_wol() argument
147 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_get_wol()
152 static int at803x_suspend(struct phy_device *phydev) in at803x_suspend() argument
157 mutex_lock(&phydev->lock); in at803x_suspend()
159 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_suspend()
162 value = phy_read(phydev, MII_BMCR); in at803x_suspend()
169 phy_write(phydev, MII_BMCR, value); in at803x_suspend()
171 mutex_unlock(&phydev->lock); in at803x_suspend()
176 static int at803x_resume(struct phy_device *phydev) in at803x_resume() argument
180 mutex_lock(&phydev->lock); in at803x_resume()
182 value = phy_read(phydev, MII_BMCR); in at803x_resume()
184 phy_write(phydev, MII_BMCR, value); in at803x_resume()
186 mutex_unlock(&phydev->lock); in at803x_resume()
191 static int at803x_probe(struct phy_device *phydev) in at803x_probe() argument
193 struct device *dev = &phydev->dev; in at803x_probe()
207 phydev->priv = priv; in at803x_probe()
212 static int at803x_config_init(struct phy_device *phydev) in at803x_config_init() argument
216 ret = genphy_config_init(phydev); in at803x_config_init()
220 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { in at803x_config_init()
221 ret = phy_write(phydev, AT803X_DEBUG_ADDR, in at803x_config_init()
225 ret = phy_write(phydev, AT803X_DEBUG_DATA, in at803x_config_init()
234 static int at803x_ack_interrupt(struct phy_device *phydev) in at803x_ack_interrupt() argument
238 err = phy_read(phydev, AT803X_INSR); in at803x_ack_interrupt()
243 static int at803x_config_intr(struct phy_device *phydev) in at803x_config_intr() argument
248 value = phy_read(phydev, AT803X_INER); in at803x_config_intr()
250 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in at803x_config_intr()
251 err = phy_write(phydev, AT803X_INER, in at803x_config_intr()
254 err = phy_write(phydev, AT803X_INER, 0); in at803x_config_intr()
259 static void at803x_link_change_notify(struct phy_device *phydev) in at803x_link_change_notify() argument
261 struct at803x_priv *priv = phydev->priv; in at803x_link_change_notify()
270 if (phydev->drv->phy_id == ATH8030_PHY_ID) { in at803x_link_change_notify()
271 if (phydev->state == PHY_NOLINK) { in at803x_link_change_notify()
275 at803x_context_save(phydev, &context); in at803x_link_change_notify()
282 at803x_context_restore(phydev, &context); in at803x_link_change_notify()
284 dev_dbg(&phydev->dev, "%s(): phy was reset\n", in at803x_link_change_notify()