Lines Matching full:phydev
17 int at803x_debug_reg_read(struct phy_device *phydev, u16 reg) in at803x_debug_reg_read() argument
21 ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg); in at803x_debug_reg_read()
25 return phy_read(phydev, AT803X_DEBUG_DATA); in at803x_debug_reg_read()
29 int at803x_debug_reg_mask(struct phy_device *phydev, u16 reg, in at803x_debug_reg_mask() argument
35 ret = at803x_debug_reg_read(phydev, reg); in at803x_debug_reg_mask()
43 return phy_write(phydev, AT803X_DEBUG_DATA, val); in at803x_debug_reg_mask()
47 int at803x_debug_reg_write(struct phy_device *phydev, u16 reg, u16 data) in at803x_debug_reg_write() argument
51 ret = phy_write(phydev, AT803X_DEBUG_ADDR, reg); in at803x_debug_reg_write()
55 return phy_write(phydev, AT803X_DEBUG_DATA, data); in at803x_debug_reg_write()
59 int at803x_set_wol(struct phy_device *phydev, in at803x_set_wol() argument
65 struct net_device *ndev = phydev->attached_dev; in at803x_set_wol()
83 phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i], in at803x_set_wol()
87 ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL); in at803x_set_wol()
92 ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0); in at803x_set_wol()
98 ret = phy_read(phydev, AT803X_INTR_STATUS); in at803x_set_wol()
106 irq_enabled = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_set_wol()
111 if (ret & irq_enabled && !phy_polling_mode(phydev)) in at803x_set_wol()
112 phy_trigger_machine(phydev); in at803x_set_wol()
118 void at803x_get_wol(struct phy_device *phydev, in at803x_get_wol() argument
126 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_get_wol()
135 int at803x_ack_interrupt(struct phy_device *phydev) in at803x_ack_interrupt() argument
139 err = phy_read(phydev, AT803X_INTR_STATUS); in at803x_ack_interrupt()
145 int at803x_config_intr(struct phy_device *phydev) in at803x_config_intr() argument
150 value = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_config_intr()
152 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in at803x_config_intr()
154 err = at803x_ack_interrupt(phydev); in at803x_config_intr()
164 err = phy_write(phydev, AT803X_INTR_ENABLE, value); in at803x_config_intr()
166 err = phy_write(phydev, AT803X_INTR_ENABLE, 0); in at803x_config_intr()
171 err = at803x_ack_interrupt(phydev); in at803x_config_intr()
178 irqreturn_t at803x_handle_interrupt(struct phy_device *phydev) in at803x_handle_interrupt() argument
182 irq_status = phy_read(phydev, AT803X_INTR_STATUS); in at803x_handle_interrupt()
184 phy_error(phydev); in at803x_handle_interrupt()
189 int_enabled = phy_read(phydev, AT803X_INTR_ENABLE); in at803x_handle_interrupt()
191 phy_error(phydev); in at803x_handle_interrupt()
199 phy_trigger_machine(phydev); in at803x_handle_interrupt()
205 int at803x_read_specific_status(struct phy_device *phydev, in at803x_read_specific_status() argument
214 ss = phy_read(phydev, AT803X_SPECIFIC_STATUS); in at803x_read_specific_status()
221 sfc = phy_read(phydev, AT803X_SPECIFIC_FUNCTION_CONTROL); in at803x_read_specific_status()
230 phydev->speed = SPEED_10; in at803x_read_specific_status()
233 phydev->speed = SPEED_100; in at803x_read_specific_status()
236 phydev->speed = SPEED_1000; in at803x_read_specific_status()
239 phydev->speed = SPEED_2500; in at803x_read_specific_status()
243 phydev->duplex = DUPLEX_FULL; in at803x_read_specific_status()
245 phydev->duplex = DUPLEX_HALF; in at803x_read_specific_status()
248 phydev->mdix = ETH_TP_MDI_X; in at803x_read_specific_status()
250 phydev->mdix = ETH_TP_MDI; in at803x_read_specific_status()
254 phydev->mdix_ctrl = ETH_TP_MDI; in at803x_read_specific_status()
257 phydev->mdix_ctrl = ETH_TP_MDI_X; in at803x_read_specific_status()
260 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in at803x_read_specific_status()
269 int at803x_config_mdix(struct phy_device *phydev, u8 ctrl) in at803x_config_mdix() argument
287 return phy_modify_changed(phydev, AT803X_SPECIFIC_FUNCTION_CONTROL, in at803x_config_mdix()
293 int at803x_prepare_config_aneg(struct phy_device *phydev) in at803x_prepare_config_aneg() argument
297 ret = at803x_config_mdix(phydev, phydev->mdix_ctrl); in at803x_prepare_config_aneg()
306 ret = genphy_soft_reset(phydev); in at803x_prepare_config_aneg()
315 int at803x_read_status(struct phy_device *phydev) in at803x_read_status() argument
318 int err, old_link = phydev->link; in at803x_read_status()
321 err = genphy_update_link(phydev); in at803x_read_status()
326 if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) in at803x_read_status()
329 phydev->speed = SPEED_UNKNOWN; in at803x_read_status()
330 phydev->duplex = DUPLEX_UNKNOWN; in at803x_read_status()
331 phydev->pause = 0; in at803x_read_status()
332 phydev->asym_pause = 0; in at803x_read_status()
334 err = genphy_read_lpa(phydev); in at803x_read_status()
340 err = at803x_read_specific_status(phydev, ss_mask); in at803x_read_status()
344 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) in at803x_read_status()
345 phy_resolve_aneg_pause(phydev); in at803x_read_status()
351 static int at803x_get_downshift(struct phy_device *phydev, u8 *d) in at803x_get_downshift() argument
355 val = phy_read(phydev, AT803X_SMART_SPEED); in at803x_get_downshift()
367 static int at803x_set_downshift(struct phy_device *phydev, u8 cnt) in at803x_set_downshift() argument
391 ret = phy_modify_changed(phydev, AT803X_SMART_SPEED, mask, set); in at803x_set_downshift()
398 ret = phy_init_hw(phydev); in at803x_set_downshift()
403 int at803x_get_tunable(struct phy_device *phydev, in at803x_get_tunable() argument
408 return at803x_get_downshift(phydev, data); in at803x_get_tunable()
415 int at803x_set_tunable(struct phy_device *phydev, in at803x_set_tunable() argument
420 return at803x_set_downshift(phydev, *(const u8 *)data); in at803x_set_tunable()
448 int at803x_cdt_start(struct phy_device *phydev, u32 cdt_start) in at803x_cdt_start() argument
450 return phy_write(phydev, AT803X_CDT, cdt_start); in at803x_cdt_start()
454 int at803x_cdt_wait_for_completion(struct phy_device *phydev, in at803x_cdt_wait_for_completion() argument
460 ret = phy_read_poll_timeout(phydev, AT803X_CDT, val, in at803x_cdt_wait_for_completion()
513 static int qca808x_cdt_fault_length(struct phy_device *phydev, int pair, in qca808x_cdt_fault_length() argument
536 val = phy_read_mmd(phydev, MDIO_MMD_PCS, cdt_length_reg); in qca808x_cdt_fault_length()
548 static int qca808x_cable_test_get_pair_status(struct phy_device *phydev, u8 pair, in qca808x_cable_test_get_pair_status() argument
572 ethnl_cable_test_result(phydev, pair, result); in qca808x_cable_test_get_pair_status()
575 length = qca808x_cdt_fault_length(phydev, pair, result); in qca808x_cable_test_get_pair_status()
576 ethnl_cable_test_fault_length(phydev, pair, length); in qca808x_cable_test_get_pair_status()
582 int qca808x_cable_test_get_status(struct phy_device *phydev, bool *finished) in qca808x_cable_test_get_status() argument
590 ret = at803x_cdt_start(phydev, val); in qca808x_cable_test_get_status()
594 ret = at803x_cdt_wait_for_completion(phydev, QCA808X_CDT_ENABLE_TEST); in qca808x_cable_test_get_status()
598 val = phy_read_mmd(phydev, MDIO_MMD_PCS, QCA808X_MMD3_CDT_STATUS); in qca808x_cable_test_get_status()
602 ret = qca808x_cable_test_get_pair_status(phydev, ETHTOOL_A_CABLE_PAIR_A, val); in qca808x_cable_test_get_status()
606 ret = qca808x_cable_test_get_pair_status(phydev, ETHTOOL_A_CABLE_PAIR_B, val); in qca808x_cable_test_get_status()
610 ret = qca808x_cable_test_get_pair_status(phydev, ETHTOOL_A_CABLE_PAIR_C, val); in qca808x_cable_test_get_status()
614 ret = qca808x_cable_test_get_pair_status(phydev, ETHTOOL_A_CABLE_PAIR_D, val); in qca808x_cable_test_get_status()
624 int qca808x_led_reg_hw_control_enable(struct phy_device *phydev, u16 reg) in qca808x_led_reg_hw_control_enable() argument
626 return phy_clear_bits_mmd(phydev, MDIO_MMD_AN, reg, in qca808x_led_reg_hw_control_enable()
631 bool qca808x_led_reg_hw_control_status(struct phy_device *phydev, u16 reg) in qca808x_led_reg_hw_control_status() argument
635 val = phy_read_mmd(phydev, MDIO_MMD_AN, reg); in qca808x_led_reg_hw_control_status()
640 int qca808x_led_reg_brightness_set(struct phy_device *phydev, in qca808x_led_reg_brightness_set() argument
643 return phy_modify_mmd(phydev, MDIO_MMD_AN, reg, in qca808x_led_reg_brightness_set()
650 int qca808x_led_reg_blink_set(struct phy_device *phydev, u16 reg, in qca808x_led_reg_blink_set() argument
657 ret = phy_modify_mmd(phydev, MDIO_MMD_AN, QCA808X_MMD7_LED_GLOBAL, in qca808x_led_reg_blink_set()
664 ret = phy_modify_mmd(phydev, MDIO_MMD_AN, reg, in qca808x_led_reg_blink_set()