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
602602 __set_bit(compat->interface, interfaces);
603603 }
604604
605+static 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+
605621 static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
606622 {
607623 struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
608624 const struct dw_xpcs_compat *compat;
609625 int ret;
610626
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+
611632 if (!xpcs->need_reset)
612633 return;
613634
@@ -799,10 +820,6 @@ static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, · 185 unmodified lines
799820 return -ENODEV;
800821
801822 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−
806823 /* Wangxun devices need backplane CL37 AN enabled for
807824 * SGMII and 1000base-X
808825 */

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