Lines Matching refs:ret
186 int ret; in xpcs_poll_reset() local
190 ret = xpcs_read(xpcs, dev, MDIO_CTRL1); in xpcs_poll_reset()
191 if (ret < 0) in xpcs_poll_reset()
192 return ret; in xpcs_poll_reset()
193 } while (ret & MDIO_CTRL1_RESET && --retries); in xpcs_poll_reset()
195 return (ret & MDIO_CTRL1_RESET) ? -ETIMEDOUT : 0; in xpcs_poll_reset()
200 int ret; in xpcs_soft_reset() local
202 ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET); in xpcs_soft_reset()
203 if (ret < 0) in xpcs_soft_reset()
204 return ret; in xpcs_soft_reset()
218 int ret; in xpcs_read_fault() local
220 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT1); in xpcs_read_fault()
221 if (ret < 0) in xpcs_read_fault()
222 return ret; in xpcs_read_fault()
224 if (ret & MDIO_STAT1_FAULT) { in xpcs_read_fault()
229 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT2); in xpcs_read_fault()
230 if (ret < 0) in xpcs_read_fault()
231 return ret; in xpcs_read_fault()
233 if (ret & MDIO_STAT2_RXFAULT) in xpcs_read_fault()
235 if (ret & MDIO_STAT2_TXFAULT) in xpcs_read_fault()
238 ret = xpcs_read_vendor(xpcs, MDIO_MMD_PCS, DW_VR_XS_PCS_DIG_STS); in xpcs_read_fault()
239 if (ret < 0) in xpcs_read_fault()
240 return ret; in xpcs_read_fault()
242 if (ret & DW_RXFIFO_ERR) { in xpcs_read_fault()
247 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_PCS_10GBRT_STAT1); in xpcs_read_fault()
248 if (ret < 0) in xpcs_read_fault()
249 return ret; in xpcs_read_fault()
251 if (!(ret & MDIO_PCS_10GBRT_STAT1_BLKLK)) in xpcs_read_fault()
254 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_PCS_10GBRT_STAT2); in xpcs_read_fault()
255 if (ret < 0) in xpcs_read_fault()
256 return ret; in xpcs_read_fault()
258 if (ret & MDIO_PCS_10GBRT_STAT2_ERR) { in xpcs_read_fault()
269 int ret; in xpcs_read_link() local
271 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MDIO_STAT1); in xpcs_read_link()
272 if (ret < 0) in xpcs_read_link()
273 return ret; in xpcs_read_link()
275 if (!(ret & MDIO_STAT1_LSTATUS)) in xpcs_read_link()
279 ret = xpcs_read(xpcs, MDIO_MMD_AN, MDIO_STAT1); in xpcs_read_link()
280 if (ret < 0) in xpcs_read_link()
281 return ret; in xpcs_read_link()
283 if (!(ret & MDIO_STAT1_LSTATUS)) in xpcs_read_link()
308 int ret, speed_sel; in xpcs_config_usxgmii() local
334 ret = xpcs_read_vpcs(xpcs, MDIO_CTRL1); in xpcs_config_usxgmii()
335 if (ret < 0) in xpcs_config_usxgmii()
336 return ret; in xpcs_config_usxgmii()
338 ret = xpcs_write_vpcs(xpcs, MDIO_CTRL1, ret | DW_USXGMII_EN); in xpcs_config_usxgmii()
339 if (ret < 0) in xpcs_config_usxgmii()
340 return ret; in xpcs_config_usxgmii()
342 ret = xpcs_read(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1); in xpcs_config_usxgmii()
343 if (ret < 0) in xpcs_config_usxgmii()
344 return ret; in xpcs_config_usxgmii()
346 ret &= ~DW_USXGMII_SS_MASK; in xpcs_config_usxgmii()
347 ret |= speed_sel | DW_USXGMII_FULL; in xpcs_config_usxgmii()
349 ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, ret); in xpcs_config_usxgmii()
350 if (ret < 0) in xpcs_config_usxgmii()
351 return ret; in xpcs_config_usxgmii()
353 ret = xpcs_read_vpcs(xpcs, MDIO_CTRL1); in xpcs_config_usxgmii()
354 if (ret < 0) in xpcs_config_usxgmii()
355 return ret; in xpcs_config_usxgmii()
357 return xpcs_write_vpcs(xpcs, MDIO_CTRL1, ret | DW_USXGMII_RST); in xpcs_config_usxgmii()
362 int ret, adv; in xpcs_config_aneg_c73() local
377 ret = xpcs_write(xpcs, MDIO_MMD_AN, DW_SR_AN_ADV3, adv); in xpcs_config_aneg_c73()
378 if (ret < 0) in xpcs_config_aneg_c73()
379 return ret; in xpcs_config_aneg_c73()
390 ret = xpcs_write(xpcs, MDIO_MMD_AN, DW_SR_AN_ADV2, adv); in xpcs_config_aneg_c73()
391 if (ret < 0) in xpcs_config_aneg_c73()
392 return ret; in xpcs_config_aneg_c73()
406 int ret; in xpcs_config_aneg() local
408 ret = xpcs_config_aneg_c73(xpcs); in xpcs_config_aneg()
409 if (ret < 0) in xpcs_config_aneg()
410 return ret; in xpcs_config_aneg()
412 ret = xpcs_read(xpcs, MDIO_MMD_AN, MDIO_CTRL1); in xpcs_config_aneg()
413 if (ret < 0) in xpcs_config_aneg()
414 return ret; in xpcs_config_aneg()
416 ret |= MDIO_AN_CTRL1_ENABLE | MDIO_AN_CTRL1_RESTART; in xpcs_config_aneg()
418 return xpcs_write(xpcs, MDIO_MMD_AN, MDIO_CTRL1, ret); in xpcs_config_aneg()
424 int ret; in xpcs_aneg_done() local
426 ret = xpcs_read(xpcs, MDIO_MMD_AN, MDIO_STAT1); in xpcs_aneg_done()
427 if (ret < 0) in xpcs_aneg_done()
428 return ret; in xpcs_aneg_done()
430 if (ret & MDIO_AN_STAT1_COMPLETE) { in xpcs_aneg_done()
431 ret = xpcs_read(xpcs, MDIO_MMD_AN, DW_SR_AN_LP_ABL1); in xpcs_aneg_done()
432 if (ret < 0) in xpcs_aneg_done()
433 return ret; in xpcs_aneg_done()
436 if (!(ret & DW_C73_AN_ADV_SF)) { in xpcs_aneg_done()
450 int ret; in xpcs_read_lpa() local
452 ret = xpcs_read(xpcs, MDIO_MMD_AN, MDIO_STAT1); in xpcs_read_lpa()
453 if (ret < 0) in xpcs_read_lpa()
454 return ret; in xpcs_read_lpa()
456 if (!(ret & MDIO_AN_STAT1_LPABLE)) { in xpcs_read_lpa()
464 ret = xpcs_read(xpcs, MDIO_MMD_AN, DW_SR_AN_LP_ABL3); in xpcs_read_lpa()
465 if (ret < 0) in xpcs_read_lpa()
466 return ret; in xpcs_read_lpa()
468 if (ret & DW_C73_2500KX) in xpcs_read_lpa()
471 ret = xpcs_read(xpcs, MDIO_MMD_AN, DW_SR_AN_LP_ABL2); in xpcs_read_lpa()
472 if (ret < 0) in xpcs_read_lpa()
473 return ret; in xpcs_read_lpa()
475 if (ret & DW_C73_1000KX) in xpcs_read_lpa()
477 if (ret & DW_C73_10000KX4) in xpcs_read_lpa()
479 if (ret & DW_C73_10000KR) in xpcs_read_lpa()
482 ret = xpcs_read(xpcs, MDIO_MMD_AN, DW_SR_AN_LP_ABL1); in xpcs_read_lpa()
483 if (ret < 0) in xpcs_read_lpa()
484 return ret; in xpcs_read_lpa()
486 if (ret & DW_C73_PAUSE) in xpcs_read_lpa()
488 if (ret & DW_C73_ASYM_PAUSE) in xpcs_read_lpa()
591 int ret; in xpcs_config() local
594 ret = xpcs_config_aneg(xpcs); in xpcs_config()
595 if (ret) in xpcs_config()
596 return ret; in xpcs_config()
605 int ret; in xpcs_get_state() local
611 ret = xpcs_read_fault(xpcs, state); in xpcs_get_state()
612 if (ret) { in xpcs_get_state()
613 ret = xpcs_soft_reset(xpcs, MDIO_MMD_PCS); in xpcs_get_state()
614 if (ret) in xpcs_get_state()
615 return ret; in xpcs_get_state()
646 int ret; in xpcs_get_id() local
649 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MII_PHYSID1); in xpcs_get_id()
650 if (ret < 0) in xpcs_get_id()
653 id = ret << 16; in xpcs_get_id()
655 ret = xpcs_read(xpcs, MDIO_MMD_PCS, MII_PHYSID2); in xpcs_get_id()
656 if (ret < 0) in xpcs_get_id()
659 return id | ret; in xpcs_get_id()