Lines Matching full:phydev

107 static int vsc824x_add_skew(struct phy_device *phydev)  in vsc824x_add_skew()  argument
112 extcon = phy_read(phydev, MII_VSC8244_EXT_CON1); in vsc824x_add_skew()
123 err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon); in vsc824x_add_skew()
128 static int vsc824x_config_init(struct phy_device *phydev) in vsc824x_config_init() argument
132 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, in vsc824x_config_init()
137 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc824x_config_init()
138 err = vsc824x_add_skew(phydev); in vsc824x_config_init()
145 static int vsc73xx_read_page(struct phy_device *phydev) in vsc73xx_read_page() argument
147 return __phy_read(phydev, VSC73XX_EXT_PAGE_ACCESS); in vsc73xx_read_page()
150 static int vsc73xx_write_page(struct phy_device *phydev, int page) in vsc73xx_write_page() argument
152 return __phy_write(phydev, VSC73XX_EXT_PAGE_ACCESS, page); in vsc73xx_write_page()
155 static int vsc73xx_get_downshift(struct phy_device *phydev, u8 *data) in vsc73xx_get_downshift() argument
159 val = phy_read_paged(phydev, MII_VSC73XX_EXT_PAGE_1E, in vsc73xx_get_downshift()
172 static int vsc73xx_set_downshift(struct phy_device *phydev, u8 cnt) in vsc73xx_set_downshift() argument
193 ret = phy_modify_paged(phydev, MII_VSC73XX_EXT_PAGE_1E, in vsc73xx_set_downshift()
198 return genphy_soft_reset(phydev); in vsc73xx_set_downshift()
201 static int vsc73xx_get_tunable(struct phy_device *phydev, in vsc73xx_get_tunable() argument
206 return vsc73xx_get_downshift(phydev, data); in vsc73xx_get_tunable()
212 static int vsc73xx_set_tunable(struct phy_device *phydev, in vsc73xx_set_tunable() argument
217 return vsc73xx_set_downshift(phydev, *(const u8 *)data); in vsc73xx_set_tunable()
223 static void vsc73xx_config_init(struct phy_device *phydev) in vsc73xx_config_init() argument
226 phy_write(phydev, 0x1f, 0x2a30); in vsc73xx_config_init()
227 phy_modify(phydev, 0x0c, 0x0300, 0x0200); in vsc73xx_config_init()
228 phy_write(phydev, 0x1f, 0x0000); in vsc73xx_config_init()
231 phy_modify(phydev, MII_TPISTATUS, 0xff00, 0x0061); in vsc73xx_config_init()
234 vsc73xx_set_downshift(phydev, MII_VSC73XX_DOWNSHIFT_MAX); in vsc73xx_config_init()
237 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in vsc73xx_config_init()
240 static int vsc738x_config_init(struct phy_device *phydev) in vsc738x_config_init() argument
248 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
249 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc738x_config_init()
250 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
251 phy_write(phydev, 0x10, 0xb68a); in vsc738x_config_init()
252 phy_modify(phydev, 0x12, 0xff07, 0x0003); in vsc738x_config_init()
253 phy_modify(phydev, 0x11, 0x00ff, 0x00a2); in vsc738x_config_init()
254 phy_write(phydev, 0x10, 0x968a); in vsc738x_config_init()
255 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
256 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc738x_config_init()
257 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
260 rev = phy_read(phydev, MII_PHYSID2); in vsc738x_config_init()
265 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
266 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc738x_config_init()
267 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
268 phy_write(phydev, 0x12, 0x0000); in vsc738x_config_init()
269 phy_write(phydev, 0x11, 0x0689); in vsc738x_config_init()
270 phy_write(phydev, 0x10, 0x8f92); in vsc738x_config_init()
271 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
272 phy_write(phydev, 0x12, 0x0000); in vsc738x_config_init()
273 phy_write(phydev, 0x11, 0x0e35); in vsc738x_config_init()
274 phy_write(phydev, 0x10, 0x9786); in vsc738x_config_init()
275 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
276 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc738x_config_init()
277 phy_write(phydev, 0x17, 0xff80); in vsc738x_config_init()
278 phy_write(phydev, 0x17, 0x0000); in vsc738x_config_init()
281 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
282 phy_write(phydev, 0x12, 0x0048); in vsc738x_config_init()
285 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
286 phy_write(phydev, 0x14, 0x6600); in vsc738x_config_init()
287 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
288 phy_write(phydev, 0x18, 0xa24e); in vsc738x_config_init()
290 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
291 phy_modify(phydev, 0x16, 0x0fc0, 0x0240); in vsc738x_config_init()
292 phy_modify(phydev, 0x14, 0x6000, 0x4000); in vsc738x_config_init()
296 phy_write(phydev, 0x1f, 0x0001); in vsc738x_config_init()
297 phy_modify(phydev, 0x14, 0xe000, 0x6000); in vsc738x_config_init()
298 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
301 vsc73xx_config_init(phydev); in vsc738x_config_init()
306 static int vsc739x_config_init(struct phy_device *phydev) in vsc739x_config_init() argument
313 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
314 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc739x_config_init()
315 phy_write(phydev, 0x1f, 0x52b5); in vsc739x_config_init()
316 phy_write(phydev, 0x10, 0xb68a); in vsc739x_config_init()
317 phy_modify(phydev, 0x12, 0xff07, 0x0003); in vsc739x_config_init()
318 phy_modify(phydev, 0x11, 0x00ff, 0x00a2); in vsc739x_config_init()
319 phy_write(phydev, 0x10, 0x968a); in vsc739x_config_init()
320 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
321 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc739x_config_init()
322 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
324 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
325 phy_write(phydev, 0x12, 0x0048); in vsc739x_config_init()
326 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
327 phy_modify(phydev, 0x16, 0x0fc0, 0x0240); in vsc739x_config_init()
328 phy_modify(phydev, 0x14, 0x6000, 0x4000); in vsc739x_config_init()
329 phy_write(phydev, 0x1f, 0x0001); in vsc739x_config_init()
330 phy_modify(phydev, 0x14, 0xe000, 0x6000); in vsc739x_config_init()
331 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
333 vsc73xx_config_init(phydev); in vsc739x_config_init()
338 static int vsc73xx_mdix_set(struct phy_device *phydev, u8 mdix) in vsc73xx_mdix_set() argument
343 val = phy_read(phydev, MII_VSC73XX_PHY_BYPASS_CTRL); in vsc73xx_mdix_set()
365 ret = phy_write(phydev, MII_VSC73XX_PHY_BYPASS_CTRL, val); in vsc73xx_mdix_set()
369 return genphy_restart_aneg(phydev); in vsc73xx_mdix_set()
372 static int vsc73xx_config_aneg(struct phy_device *phydev) in vsc73xx_config_aneg() argument
376 ret = vsc73xx_mdix_set(phydev, phydev->mdix_ctrl); in vsc73xx_config_aneg()
380 return genphy_config_aneg(phydev); in vsc73xx_config_aneg()
383 static int vsc73xx_mdix_get(struct phy_device *phydev, u8 *mdix) in vsc73xx_mdix_get() argument
387 reg_val = phy_read(phydev, MII_VSC73XX_PHY_AUX_CTRL_STAT); in vsc73xx_mdix_get()
396 static int vsc73xx_read_status(struct phy_device *phydev) in vsc73xx_read_status() argument
400 ret = vsc73xx_mdix_get(phydev, &phydev->mdix); in vsc73xx_read_status()
404 return genphy_read_status(phydev); in vsc73xx_read_status()
411 static int vsc8601_add_skew(struct phy_device *phydev) in vsc8601_add_skew() argument
415 ret = phy_read(phydev, MII_VSC8601_EPHY_CTL); in vsc8601_add_skew()
420 return phy_write(phydev, MII_VSC8601_EPHY_CTL, ret); in vsc8601_add_skew()
423 static int vsc8601_config_init(struct phy_device *phydev) in vsc8601_config_init() argument
427 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc8601_config_init()
428 ret = vsc8601_add_skew(phydev); in vsc8601_config_init()
436 static int vsc82xx_config_intr(struct phy_device *phydev) in vsc82xx_config_intr() argument
440 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in vsc82xx_config_intr()
444 err = phy_write(phydev, MII_VSC8244_IMASK, in vsc82xx_config_intr()
445 (phydev->drv->phy_id == PHY_ID_VSC8234 || in vsc82xx_config_intr()
446 phydev->drv->phy_id == PHY_ID_VSC8244 || in vsc82xx_config_intr()
447 phydev->drv->phy_id == PHY_ID_VSC8572 || in vsc82xx_config_intr()
448 phydev->drv->phy_id == PHY_ID_VSC8601) ? in vsc82xx_config_intr()
455 err = phy_read(phydev, MII_VSC8244_ISTAT); in vsc82xx_config_intr()
460 err = phy_write(phydev, MII_VSC8244_IMASK, 0); in vsc82xx_config_intr()
466 static irqreturn_t vsc82xx_handle_interrupt(struct phy_device *phydev) in vsc82xx_handle_interrupt() argument
470 if (phydev->drv->phy_id == PHY_ID_VSC8244 || in vsc82xx_handle_interrupt()
471 phydev->drv->phy_id == PHY_ID_VSC8572 || in vsc82xx_handle_interrupt()
472 phydev->drv->phy_id == PHY_ID_VSC8601) in vsc82xx_handle_interrupt()
477 irq_status = phy_read(phydev, MII_VSC8244_ISTAT); in vsc82xx_handle_interrupt()
479 phy_error(phydev); in vsc82xx_handle_interrupt()
486 phy_trigger_machine(phydev); in vsc82xx_handle_interrupt()
491 static int vsc8221_config_init(struct phy_device *phydev) in vsc8221_config_init() argument
495 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, in vsc8221_config_init()
505 * @phydev: target phy_device struct
510 static int vsc82x4_config_autocross_enable(struct phy_device *phydev) in vsc82x4_config_autocross_enable() argument
514 if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed > SPEED_100) in vsc82x4_config_autocross_enable()
518 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x52b5); in vsc82x4_config_autocross_enable()
520 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_18E, 0x0012); in vsc82x4_config_autocross_enable()
522 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_17E, 0x2803); in vsc82x4_config_autocross_enable()
524 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_16E, 0x87fa); in vsc82x4_config_autocross_enable()
527 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000); in vsc82x4_config_autocross_enable()
529 phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000); in vsc82x4_config_autocross_enable()
535 * @phydev: target phy_device struct
542 static int vsc82x4_config_aneg(struct phy_device *phydev) in vsc82x4_config_aneg() argument
549 if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) { in vsc82x4_config_aneg()
550 ret = genphy_setup_forced(phydev); in vsc82x4_config_aneg()
555 return vsc82x4_config_autocross_enable(phydev); in vsc82x4_config_aneg()
558 return genphy_config_aneg(phydev); in vsc82x4_config_aneg()