Lines Matching refs:rc

111 	int rc = 0;  in lan937x_dsp_workaround()  local
116 rc = phy_read(phydev, LAN87XX_EXT_REG_CTL); in lan937x_dsp_workaround()
117 if (rc < 0) in lan937x_dsp_workaround()
121 prev_bank = FIELD_GET(LAN87XX_REG_BANK_SEL_MASK, rc); in lan937x_dsp_workaround()
130 rc = phy_write(phydev, LAN87XX_EXT_REG_CTL, val); in lan937x_dsp_workaround()
136 return rc; in lan937x_dsp_workaround()
143 int rc = 0; in access_ereg() local
150 rc = phy_write(phydev, offset, val); in access_ereg()
152 rc = phy_read(phydev, offset); in access_ereg()
153 return rc; in access_ereg()
158 rc = phy_write(phydev, LAN87XX_EXT_REG_WR_DATA, val); in access_ereg()
159 if (rc < 0) in access_ereg()
160 return rc; in access_ereg()
169 rc = lan937x_dsp_workaround(phydev, ereg, bank); in access_ereg()
170 if (rc < 0) in access_ereg()
171 return rc; in access_ereg()
174 rc = phy_write(phydev, LAN87XX_EXT_REG_CTL, ereg); in access_ereg()
175 if (rc < 0) in access_ereg()
176 return rc; in access_ereg()
179 rc = phy_read(phydev, LAN87XX_EXT_REG_RD_DATA); in access_ereg()
181 return rc; in access_ereg()
187 int new = 0, rc = 0; in access_ereg_modify_changed() local
192 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, bank, offset, val); in access_ereg_modify_changed()
193 if (rc < 0) in access_ereg_modify_changed()
194 return rc; in access_ereg_modify_changed()
196 new = val | (rc & (mask ^ 0xFFFF)); in access_ereg_modify_changed()
197 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, bank, offset, new); in access_ereg_modify_changed()
199 return rc; in access_ereg_modify_changed()
213 int rc; in lan87xx_config_rgmii_delay() local
218 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_config_rgmii_delay()
220 if (rc < 0) in lan87xx_config_rgmii_delay()
221 return rc; in lan87xx_config_rgmii_delay()
225 rc &= ~LAN87XX_MASK_RGMII_TXC_DLY_EN; in lan87xx_config_rgmii_delay()
226 rc &= ~LAN87XX_MASK_RGMII_RXC_DLY_EN; in lan87xx_config_rgmii_delay()
229 rc |= LAN87XX_MASK_RGMII_TXC_DLY_EN; in lan87xx_config_rgmii_delay()
230 rc |= LAN87XX_MASK_RGMII_RXC_DLY_EN; in lan87xx_config_rgmii_delay()
233 rc &= ~LAN87XX_MASK_RGMII_TXC_DLY_EN; in lan87xx_config_rgmii_delay()
234 rc |= LAN87XX_MASK_RGMII_RXC_DLY_EN; in lan87xx_config_rgmii_delay()
237 rc |= LAN87XX_MASK_RGMII_TXC_DLY_EN; in lan87xx_config_rgmii_delay()
238 rc &= ~LAN87XX_MASK_RGMII_RXC_DLY_EN; in lan87xx_config_rgmii_delay()
245 PHYACC_ATTR_BANK_MISC, LAN87XX_CTRL_1, rc); in lan87xx_config_rgmii_delay()
430 int rc; in lan87xx_phy_init() local
433 rc = genphy_soft_reset(phydev); in lan87xx_phy_init()
434 if (rc < 0) in lan87xx_phy_init()
435 return rc; in lan87xx_phy_init()
438 rc = lan87xx_phy_init_cmd(phydev, hw_init, ARRAY_SIZE(hw_init)); in lan87xx_phy_init()
439 if (rc < 0) in lan87xx_phy_init()
440 return rc; in lan87xx_phy_init()
442 rc = genphy_read_master_slave(phydev); in lan87xx_phy_init()
443 if (rc) in lan87xx_phy_init()
444 return rc; in lan87xx_phy_init()
450 rc = lan87xx_phy_init_cmd(phydev, slave_init, in lan87xx_phy_init()
452 if (rc < 0) in lan87xx_phy_init()
453 return rc; in lan87xx_phy_init()
456 rc = lan87xx_phy_init_cmd(phydev, phy_init, ARRAY_SIZE(phy_init)); in lan87xx_phy_init()
457 if (rc < 0) in lan87xx_phy_init()
458 return rc; in lan87xx_phy_init()
465 int rc, val = 0; in lan87xx_phy_config_intr() local
469 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
470 if (rc < 0) in lan87xx_phy_config_intr()
471 return rc; in lan87xx_phy_config_intr()
473 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); in lan87xx_phy_config_intr()
474 if (rc < 0) in lan87xx_phy_config_intr()
475 return rc; in lan87xx_phy_config_intr()
477 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
480 if (rc < 0) in lan87xx_phy_config_intr()
481 return rc; in lan87xx_phy_config_intr()
483 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_phy_config_intr()
486 if (rc < 0) in lan87xx_phy_config_intr()
487 return rc; in lan87xx_phy_config_intr()
491 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
492 if (rc < 0) in lan87xx_phy_config_intr()
493 return rc; in lan87xx_phy_config_intr()
496 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
500 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); in lan87xx_phy_config_intr()
501 if (rc < 0) in lan87xx_phy_config_intr()
502 return rc; in lan87xx_phy_config_intr()
504 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); in lan87xx_phy_config_intr()
505 if (rc < 0) in lan87xx_phy_config_intr()
506 return rc; in lan87xx_phy_config_intr()
508 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_phy_config_intr()
511 if (rc < 0) in lan87xx_phy_config_intr()
512 return rc; in lan87xx_phy_config_intr()
514 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_phy_config_intr()
519 return rc < 0 ? rc : 0; in lan87xx_phy_config_intr()
550 int rc = lan87xx_phy_init(phydev); in lan87xx_config_init() local
552 return rc < 0 ? rc : 0; in lan87xx_config_init()
615 int rc, i; in lan87xx_cable_test_start() local
617 rc = microchip_cable_test_start_common(phydev); in lan87xx_cable_test_start()
618 if (rc < 0) in lan87xx_cable_test_start()
619 return rc; in lan87xx_cable_test_start()
623 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
625 if (rc < 0) in lan87xx_cable_test_start()
626 return rc; in lan87xx_cable_test_start()
629 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
631 if (rc < 0) in lan87xx_cable_test_start()
632 return rc; in lan87xx_cable_test_start()
634 if ((rc & 0x4000) != 0x4000) { in lan87xx_cable_test_start()
636 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_AFE, in lan87xx_cable_test_start()
638 if (rc < 0) in lan87xx_cable_test_start()
639 return rc; in lan87xx_cable_test_start()
640 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
642 if (rc < 0) in lan87xx_cable_test_start()
643 return rc; in lan87xx_cable_test_start()
646 rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, in lan87xx_cable_test_start()
648 if (rc < 0) in lan87xx_cable_test_start()
649 return rc; in lan87xx_cable_test_start()
654 rc = access_ereg_modify_changed(phydev, in lan87xx_cable_test_start()
662 rc = access_ereg(phydev, cable_test[i].mode, in lan87xx_cable_test_start()
667 if (rc < 0) in lan87xx_cable_test_start()
668 return rc; in lan87xx_cable_test_start()
757 int rc = 0; in lan87xx_cable_test_get_status() local
762 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_DSP, in lan87xx_cable_test_get_status()
764 if (rc < 0) in lan87xx_cable_test_get_status()
765 return rc; in lan87xx_cable_test_get_status()
767 if ((rc & 2) == 2) { in lan87xx_cable_test_get_status()
769 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_cable_test_get_status()
772 if (rc < 0) in lan87xx_cable_test_get_status()
773 return rc; in lan87xx_cable_test_get_status()
785 int rc = 0; in lan87xx_read_status() local
787 rc = phy_read(phydev, T1_MODE_STAT_REG); in lan87xx_read_status()
788 if (rc < 0) in lan87xx_read_status()
789 return rc; in lan87xx_read_status()
791 if (rc & T1_LINK_UP_MSK) in lan87xx_read_status()
801 rc = genphy_read_master_slave(phydev); in lan87xx_read_status()
802 if (rc < 0) in lan87xx_read_status()
803 return rc; in lan87xx_read_status()
805 rc = genphy_read_status_fixed(phydev); in lan87xx_read_status()
806 if (rc < 0) in lan87xx_read_status()
807 return rc; in lan87xx_read_status()
809 return rc; in lan87xx_read_status()
841 int rc; in lan87xx_get_sqi() local
843 rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, in lan87xx_get_sqi()
845 if (rc < 0) in lan87xx_get_sqi()
846 return rc; in lan87xx_get_sqi()
848 rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, in lan87xx_get_sqi()
850 if (rc < 0) in lan87xx_get_sqi()
851 return rc; in lan87xx_get_sqi()
853 sqi_value = FIELD_GET(T1_DCQ_SQI_MSK, rc); in lan87xx_get_sqi()