Lines Matching refs:phydev

19 int __bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val)  in __bcm_phy_write_exp()  argument
23 rc = __phy_write(phydev, MII_BCM54XX_EXP_SEL, reg); in __bcm_phy_write_exp()
27 return __phy_write(phydev, MII_BCM54XX_EXP_DATA, val); in __bcm_phy_write_exp()
31 int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val) in bcm_phy_write_exp() argument
35 phy_lock_mdio_bus(phydev); in bcm_phy_write_exp()
36 rc = __bcm_phy_write_exp(phydev, reg, val); in bcm_phy_write_exp()
37 phy_unlock_mdio_bus(phydev); in bcm_phy_write_exp()
43 int __bcm_phy_read_exp(struct phy_device *phydev, u16 reg) in __bcm_phy_read_exp() argument
47 val = __phy_write(phydev, MII_BCM54XX_EXP_SEL, reg); in __bcm_phy_read_exp()
51 val = __phy_read(phydev, MII_BCM54XX_EXP_DATA); in __bcm_phy_read_exp()
54 __phy_write(phydev, MII_BCM54XX_EXP_SEL, 0); in __bcm_phy_read_exp()
60 int bcm_phy_read_exp(struct phy_device *phydev, u16 reg) in bcm_phy_read_exp() argument
64 phy_lock_mdio_bus(phydev); in bcm_phy_read_exp()
65 rc = __bcm_phy_read_exp(phydev, reg); in bcm_phy_read_exp()
66 phy_unlock_mdio_bus(phydev); in bcm_phy_read_exp()
72 int __bcm_phy_modify_exp(struct phy_device *phydev, u16 reg, u16 mask, u16 set) in __bcm_phy_modify_exp() argument
76 ret = __phy_write(phydev, MII_BCM54XX_EXP_SEL, reg); in __bcm_phy_modify_exp()
80 ret = __phy_read(phydev, MII_BCM54XX_EXP_DATA); in __bcm_phy_modify_exp()
88 return __phy_write(phydev, MII_BCM54XX_EXP_DATA, new); in __bcm_phy_modify_exp()
92 int bcm_phy_modify_exp(struct phy_device *phydev, u16 reg, u16 mask, u16 set) in bcm_phy_modify_exp() argument
96 phy_lock_mdio_bus(phydev); in bcm_phy_modify_exp()
97 ret = __bcm_phy_modify_exp(phydev, reg, mask, set); in bcm_phy_modify_exp()
98 phy_unlock_mdio_bus(phydev); in bcm_phy_modify_exp()
104 int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) in bcm54xx_auxctl_read() argument
109 phy_write(phydev, MII_BCM54XX_AUX_CTL, MII_BCM54XX_AUXCTL_SHDWSEL_MASK | in bcm54xx_auxctl_read()
111 return phy_read(phydev, MII_BCM54XX_AUX_CTL); in bcm54xx_auxctl_read()
115 int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) in bcm54xx_auxctl_write() argument
117 return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); in bcm54xx_auxctl_write()
121 int bcm_phy_write_misc(struct phy_device *phydev, in bcm_phy_write_misc() argument
127 rc = phy_write(phydev, MII_BCM54XX_AUX_CTL, in bcm_phy_write_misc()
132 tmp = phy_read(phydev, MII_BCM54XX_AUX_CTL); in bcm_phy_write_misc()
134 rc = phy_write(phydev, MII_BCM54XX_AUX_CTL, tmp); in bcm_phy_write_misc()
139 rc = bcm_phy_write_exp(phydev, tmp, val); in bcm_phy_write_misc()
145 int bcm_phy_read_misc(struct phy_device *phydev, in bcm_phy_read_misc() argument
151 rc = phy_write(phydev, MII_BCM54XX_AUX_CTL, in bcm_phy_read_misc()
156 tmp = phy_read(phydev, MII_BCM54XX_AUX_CTL); in bcm_phy_read_misc()
158 rc = phy_write(phydev, MII_BCM54XX_AUX_CTL, tmp); in bcm_phy_read_misc()
163 rc = bcm_phy_read_exp(phydev, tmp); in bcm_phy_read_misc()
169 int bcm_phy_ack_intr(struct phy_device *phydev) in bcm_phy_ack_intr() argument
174 reg = phy_read(phydev, MII_BCM54XX_ISR); in bcm_phy_ack_intr()
182 int bcm_phy_config_intr(struct phy_device *phydev) in bcm_phy_config_intr() argument
186 reg = phy_read(phydev, MII_BCM54XX_ECR); in bcm_phy_config_intr()
190 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in bcm_phy_config_intr()
191 err = bcm_phy_ack_intr(phydev); in bcm_phy_config_intr()
196 err = phy_write(phydev, MII_BCM54XX_ECR, reg); in bcm_phy_config_intr()
199 err = phy_write(phydev, MII_BCM54XX_ECR, reg); in bcm_phy_config_intr()
203 err = bcm_phy_ack_intr(phydev); in bcm_phy_config_intr()
209 irqreturn_t bcm_phy_handle_interrupt(struct phy_device *phydev) in bcm_phy_handle_interrupt() argument
213 irq_status = phy_read(phydev, MII_BCM54XX_ISR); in bcm_phy_handle_interrupt()
215 phy_error(phydev); in bcm_phy_handle_interrupt()
224 irq_mask = phy_read(phydev, MII_BCM54XX_IMR); in bcm_phy_handle_interrupt()
226 phy_error(phydev); in bcm_phy_handle_interrupt()
234 phy_trigger_machine(phydev); in bcm_phy_handle_interrupt()
240 int bcm_phy_read_shadow(struct phy_device *phydev, u16 shadow) in bcm_phy_read_shadow() argument
242 phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow)); in bcm_phy_read_shadow()
243 return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD)); in bcm_phy_read_shadow()
247 int bcm_phy_write_shadow(struct phy_device *phydev, u16 shadow, in bcm_phy_write_shadow() argument
250 return phy_write(phydev, MII_BCM54XX_SHD, in bcm_phy_write_shadow()
257 int __bcm_phy_read_rdb(struct phy_device *phydev, u16 rdb) in __bcm_phy_read_rdb() argument
261 val = __phy_write(phydev, MII_BCM54XX_RDB_ADDR, rdb); in __bcm_phy_read_rdb()
265 return __phy_read(phydev, MII_BCM54XX_RDB_DATA); in __bcm_phy_read_rdb()
269 int bcm_phy_read_rdb(struct phy_device *phydev, u16 rdb) in bcm_phy_read_rdb() argument
273 phy_lock_mdio_bus(phydev); in bcm_phy_read_rdb()
274 ret = __bcm_phy_read_rdb(phydev, rdb); in bcm_phy_read_rdb()
275 phy_unlock_mdio_bus(phydev); in bcm_phy_read_rdb()
281 int __bcm_phy_write_rdb(struct phy_device *phydev, u16 rdb, u16 val) in __bcm_phy_write_rdb() argument
285 ret = __phy_write(phydev, MII_BCM54XX_RDB_ADDR, rdb); in __bcm_phy_write_rdb()
289 return __phy_write(phydev, MII_BCM54XX_RDB_DATA, val); in __bcm_phy_write_rdb()
293 int bcm_phy_write_rdb(struct phy_device *phydev, u16 rdb, u16 val) in bcm_phy_write_rdb() argument
297 phy_lock_mdio_bus(phydev); in bcm_phy_write_rdb()
298 ret = __bcm_phy_write_rdb(phydev, rdb, val); in bcm_phy_write_rdb()
299 phy_unlock_mdio_bus(phydev); in bcm_phy_write_rdb()
305 int __bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask, u16 set) in __bcm_phy_modify_rdb() argument
309 ret = __phy_write(phydev, MII_BCM54XX_RDB_ADDR, rdb); in __bcm_phy_modify_rdb()
313 ret = __phy_read(phydev, MII_BCM54XX_RDB_DATA); in __bcm_phy_modify_rdb()
321 return __phy_write(phydev, MII_BCM54XX_RDB_DATA, new); in __bcm_phy_modify_rdb()
325 int bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask, u16 set) in bcm_phy_modify_rdb() argument
329 phy_lock_mdio_bus(phydev); in bcm_phy_modify_rdb()
330 ret = __bcm_phy_modify_rdb(phydev, rdb, mask, set); in bcm_phy_modify_rdb()
331 phy_unlock_mdio_bus(phydev); in bcm_phy_modify_rdb()
337 int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down) in bcm_phy_enable_apd() argument
342 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); in bcm_phy_enable_apd()
347 bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val); in bcm_phy_enable_apd()
350 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD); in bcm_phy_enable_apd()
357 if (phydev->autoneg == AUTONEG_ENABLE) in bcm_phy_enable_apd()
366 return bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val); in bcm_phy_enable_apd()
370 int bcm_phy_set_eee(struct phy_device *phydev, bool enable) in bcm_phy_set_eee() argument
375 val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); in bcm_phy_set_eee()
384 phy_write_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL, (u32)val); in bcm_phy_set_eee()
387 val = phy_read_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV); in bcm_phy_set_eee()
392 phydev->supported)) in bcm_phy_set_eee()
395 phydev->supported)) in bcm_phy_set_eee()
403 phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); in bcm_phy_set_eee()
409 int bcm_phy_downshift_get(struct phy_device *phydev, u8 *count) in bcm_phy_downshift_get() argument
413 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); in bcm_phy_downshift_get()
423 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR2); in bcm_phy_downshift_get()
441 int bcm_phy_downshift_set(struct phy_device *phydev, u8 count) in bcm_phy_downshift_set() argument
452 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); in bcm_phy_downshift_set()
461 return bcm54xx_auxctl_write(phydev, in bcm_phy_downshift_set()
466 ret = bcm54xx_auxctl_write(phydev, in bcm_phy_downshift_set()
473 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR2); in bcm_phy_downshift_set()
491 return bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR2, val); in bcm_phy_downshift_set()
511 int bcm_phy_get_sset_count(struct phy_device *phydev) in bcm_phy_get_sset_count() argument
517 void bcm_phy_get_strings(struct phy_device *phydev, u8 *data) in bcm_phy_get_strings() argument
530 static u64 bcm_phy_get_stat(struct phy_device *phydev, u64 *shadow, in bcm_phy_get_stat() argument
537 val = phy_read(phydev, stat.reg); in bcm_phy_get_stat()
550 void bcm_phy_get_stats(struct phy_device *phydev, u64 *shadow, in bcm_phy_get_stats() argument
556 data[i] = bcm_phy_get_stat(phydev, shadow, i); in bcm_phy_get_stats()
560 void bcm_phy_r_rc_cal_reset(struct phy_device *phydev) in bcm_phy_r_rc_cal_reset() argument
563 bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0010); in bcm_phy_r_rc_cal_reset()
566 bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0000); in bcm_phy_r_rc_cal_reset()
570 int bcm_phy_28nm_a0b0_afe_config_init(struct phy_device *phydev) in bcm_phy_28nm_a0b0_afe_config_init() argument
575 bcm_phy_write_misc(phydev, PLL_PLLCTRL_1, 0x0048); in bcm_phy_28nm_a0b0_afe_config_init()
578 bcm_phy_write_misc(phydev, PLL_PLLCTRL_2, 0x021b); in bcm_phy_28nm_a0b0_afe_config_init()
583 bcm_phy_write_misc(phydev, PLL_PLLCTRL_4, 0x0e20); in bcm_phy_28nm_a0b0_afe_config_init()
586 bcm_phy_write_misc(phydev, DSP_TAP10, 0x690b); in bcm_phy_28nm_a0b0_afe_config_init()
589 phy_write(phydev, MII_BRCM_CORE_BASE1E, 0xd); in bcm_phy_28nm_a0b0_afe_config_init()
591 bcm_phy_r_rc_cal_reset(phydev); in bcm_phy_28nm_a0b0_afe_config_init()
594 bcm_phy_write_misc(phydev, AFE_RXCONFIG_0, 0xeb19); in bcm_phy_28nm_a0b0_afe_config_init()
597 bcm_phy_write_misc(phydev, AFE_RXCONFIG_1, 0x9a3f); in bcm_phy_28nm_a0b0_afe_config_init()
600 bcm_phy_write_misc(phydev, AFE_RX_LP_COUNTER, 0x7fc0); in bcm_phy_28nm_a0b0_afe_config_init()
603 bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x000b); in bcm_phy_28nm_a0b0_afe_config_init()
606 bcm_phy_write_misc(phydev, AFE_TX_CONFIG, 0x0800); in bcm_phy_28nm_a0b0_afe_config_init()
612 int bcm_phy_enable_jumbo(struct phy_device *phydev) in bcm_phy_enable_jumbo() argument
616 ret = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL); in bcm_phy_enable_jumbo()
621 ret = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL, in bcm_phy_enable_jumbo()
630 return phy_set_bits(phydev, MII_BCM54XX_ECR, MII_BCM54XX_ECR_FIFOE); in bcm_phy_enable_jumbo()
634 static int __bcm_phy_enable_rdb_access(struct phy_device *phydev) in __bcm_phy_enable_rdb_access() argument
636 return __bcm_phy_write_exp(phydev, BCM54XX_EXP_REG7E, 0); in __bcm_phy_enable_rdb_access()
639 static int __bcm_phy_enable_legacy_access(struct phy_device *phydev) in __bcm_phy_enable_legacy_access() argument
641 return __bcm_phy_write_rdb(phydev, BCM54XX_RDB_REG0087, in __bcm_phy_enable_legacy_access()
645 static int _bcm_phy_cable_test_start(struct phy_device *phydev, bool is_rdb) in _bcm_phy_cable_test_start() argument
653 phy_write(phydev, MII_BMCR, BMCR_ANENABLE); in _bcm_phy_cable_test_start()
654 phy_write(phydev, MII_ADVERTISE, ADVERTISE_CSMA); in _bcm_phy_cable_test_start()
655 phy_write(phydev, MII_CTRL1000, 0); in _bcm_phy_cable_test_start()
657 phy_lock_mdio_bus(phydev); in _bcm_phy_cable_test_start()
659 ret = __bcm_phy_enable_legacy_access(phydev); in _bcm_phy_cable_test_start()
669 ret = __bcm_phy_modify_exp(phydev, BCM54XX_EXP_ECD_CTRL, mask, set); in _bcm_phy_cable_test_start()
674 ret = __bcm_phy_enable_rdb_access(phydev) ? : ret; in _bcm_phy_cable_test_start()
676 phy_unlock_mdio_bus(phydev); in _bcm_phy_cable_test_start()
710 static int bcm_phy_report_length(struct phy_device *phydev, int pair) in bcm_phy_report_length() argument
714 val = __bcm_phy_read_exp(phydev, in bcm_phy_report_length()
722 ethnl_cable_test_fault_length(phydev, pair, val); in bcm_phy_report_length()
727 static int _bcm_phy_cable_test_get_status(struct phy_device *phydev, in _bcm_phy_cable_test_get_status() argument
734 phy_lock_mdio_bus(phydev); in _bcm_phy_cable_test_get_status()
737 ret = __bcm_phy_enable_legacy_access(phydev); in _bcm_phy_cable_test_get_status()
742 ret = __bcm_phy_read_exp(phydev, BCM54XX_EXP_ECD_CTRL); in _bcm_phy_cable_test_get_status()
751 ret = __bcm_phy_read_exp(phydev, BCM54XX_EXP_ECD_FAULT_TYPE); in _bcm_phy_cable_test_get_status()
760 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_A, in _bcm_phy_cable_test_get_status()
762 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_B, in _bcm_phy_cable_test_get_status()
764 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_C, in _bcm_phy_cable_test_get_status()
766 ethnl_cable_test_result(phydev, ETHTOOL_A_CABLE_PAIR_D, in _bcm_phy_cable_test_get_status()
770 bcm_phy_report_length(phydev, 0); in _bcm_phy_cable_test_get_status()
772 bcm_phy_report_length(phydev, 1); in _bcm_phy_cable_test_get_status()
774 bcm_phy_report_length(phydev, 2); in _bcm_phy_cable_test_get_status()
776 bcm_phy_report_length(phydev, 3); in _bcm_phy_cable_test_get_status()
783 ret = __bcm_phy_enable_rdb_access(phydev) ? : ret; in _bcm_phy_cable_test_get_status()
785 phy_unlock_mdio_bus(phydev); in _bcm_phy_cable_test_get_status()
790 int bcm_phy_cable_test_start(struct phy_device *phydev) in bcm_phy_cable_test_start() argument
792 return _bcm_phy_cable_test_start(phydev, false); in bcm_phy_cable_test_start()
796 int bcm_phy_cable_test_get_status(struct phy_device *phydev, bool *finished) in bcm_phy_cable_test_get_status() argument
798 return _bcm_phy_cable_test_get_status(phydev, finished, false); in bcm_phy_cable_test_get_status()
806 int bcm_phy_cable_test_start_rdb(struct phy_device *phydev) in bcm_phy_cable_test_start_rdb() argument
808 return _bcm_phy_cable_test_start(phydev, true); in bcm_phy_cable_test_start_rdb()
812 int bcm_phy_cable_test_get_status_rdb(struct phy_device *phydev, in bcm_phy_cable_test_get_status_rdb() argument
815 return _bcm_phy_cable_test_get_status(phydev, finished, true); in bcm_phy_cable_test_get_status_rdb()