History

net: pcs: xpcs: re-initiate clause 37 Auto-negotiation

The xpcs_switch_interface_mode function was introduced to handle interface switching. According to the XPCS datasheet, a soft reset is required to initiate Clause 37 auto-negotiation when the XPCS switches interface modes. When the interface mode switches from 2500BASE-X to SGMII, re-initiating Clause 37 auto-negotiation is required for the SGMII interface mode to function properly.

Choong Yong Liang committed 1 year ago

Commit 065d3ce1 parent b6326351 file · +21 −4Browse files

Unified · Split

drivers/net/pcs/pcs-xpcs.c+21−4
@@ -602,12 +602,33 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) · 601 unmodified lines
602 __set_bit(compat->interface, interfaces);602 __set_bit(compat->interface, interfaces);
603}603}
604 604
605static int xpcs_switch_interface_mode(struct dw_xpcs *xpcs,
606 phy_interface_t interface)
607{
608 int ret = 0;
609
610 if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
611 ret = txgbe_xpcs_switch_mode(xpcs, interface);
612 } else if (xpcs->interface != interface) {
613 if (interface == PHY_INTERFACE_MODE_SGMII)
614 xpcs->need_reset = true;
615 xpcs->interface = interface;
616 }
617
618 return ret;
619}
620
605static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)621static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
606{622{
607 struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);623 struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
608 const struct dw_xpcs_compat *compat;624 const struct dw_xpcs_compat *compat;
609 int ret;625 int ret;
610 626
627 ret = xpcs_switch_interface_mode(xpcs, interface);
628 if (ret)
629 dev_err(&xpcs->mdiodev->dev, "switch interface failed: %pe\n",
630 ERR_PTR(ret));
631
611 if (!xpcs->need_reset)632 if (!xpcs->need_reset)
612 return;633 return;
613 634
@@ -799,10 +820,6 @@ static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, · 185 unmodified lines
799 return -ENODEV;820 return -ENODEV;
800 821
801 if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {822 if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
802 ret = txgbe_xpcs_switch_mode(xpcs, interface);
803 if (ret)
804 return ret;
805
806 /* Wangxun devices need backplane CL37 AN enabled for823 /* Wangxun devices need backplane CL37 AN enabled for
807 * SGMII and 1000base-X824 * SGMII and 1000base-X
808 */825 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t