Skip to contentSkip to conversation

Enable SGMII and 2500BASEX interface mode switching for Intel platforms

PATCH Superseded Choong Yong Liang 3 participants 14 messages Feb 15, 2024 – Mar 5, 2024

Subsystems (12)
Networking Network drivers x86 BPF +8 more subsystems

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v5 cover Enable SGMII and 2500BASEX interface mode switching for Intel platforms

From: root <[email protected]>

During the interface mode change, the 'phylink_major_config' function will be triggered in phylink. The modification of the following functions will be triggered to support the switching between SGMII and 2500BASEX interfaces mode for the Intel platform.

- mac_get_pcs_neg_mode: A new function that selects the PCS negotiation mode according to the interface mode.
- xpcs_do_config: Re-initiate clause 37 auto-negotiation for SGMII interface mode to perform auto-negotiation.
- mac_finish: Configures the SerDes according to the interface mode.

With the above changes, the code will work as follows during the interface mode change. The PCS and PCS negotiation mode will be selected for PCS configuration according to the interface mode. Then, the MAC driver will perform SerDes configuration on the 'mac_finish' based on the interface mode. During the SerDes configuration, the selected interface mode will identify TSN lane registers from FIA and then send IPC commands to the Power Management Controller (PMC) through the PMC driver/API. PMC will act as a proxy to program the PLL registers.

Change log:
v1 -> v2:
- Add static to pmc_lpm_modes declaration
- Add cur_link_an_mode to the kernel doc
- Combine 2 commits i.e. "stmmac: intel: Separate driver_data of ADL-N from TGL" and "net: stmmac: Add 1G/2.5G auto-negotiation support for ADL-N" into 1 commit.

v2 -> v3:
- Create pmc_ipc.c file for intel_pmc_ipc() function and allocate the file in arch/x86/platform/intel/ directory.
- Update phylink's AN mode during phy interface change and not exposing phylink's AN mode into phylib.

v3 -> v4:
- Introduce allow_switch_interface flag to have all ethtool link modes that are supported and advertised will be published.
- Introduce mac_get_pcs_neg_mode function that selects the PCS negotiation mode according to the interface mode.
- Remove pcs-xpcs.c changes and handle pcs during mac_select_pcs function
- Configure SerDes base on the interface on mac_finish function.

v4 -> v5:
- remove 'allow_switch_interface' related patches.
- remove 'mac_select_pcs' related patches.
- add a soft reset according to XPCS datasheet for re-initiate Clause 37 auto-negotiation when switching to SGMII interface mode.

Choong Yong Liang (7):
net: phylink: provide mac_get_pcs_neg_mode() function
net: phylink: add phylink_pcs_neg_mode() declaration into phylink.h
net: stmmac: select PCS negotiation mode according to the interface
mode
net: pcs: xpcs: re-initiate clause 37 Auto-negotiation
net: stmmac: configure SerDes on mac_finish
stmmac: intel: interface switching support for EHL platform
stmmac: intel: interface switching support for ADL-N platform

David E. Box (1):
arch: x86: Add IPC mailbox accessor function and add SoC register
access

Tan, Tee Min (1):
stmmac: intel: configure SerDes according to the interface mode

 MAINTAINERS                                   |   2 +
 arch/x86/Kconfig                              |   9 +
 arch/x86/platform/intel/Makefile              |   1 +
 arch/x86/platform/intel/pmc_ipc.c             |  75 ++++++
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |   2 +
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 233 ++++++++++++++++--
 .../net/ethernet/stmicro/stmmac/dwmac-intel.h |  81 ++++++
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  30 +++
 drivers/net/pcs/pcs-xpcs.c                    |  62 ++++-
 drivers/net/phy/phylink.c                     |  21 +-
 include/linux/phylink.h                       |   8 +
 .../linux/platform_data/x86/intel_pmc_ipc.h   |  34 +++
 include/linux/stmmac.h                        |   5 +
 13 files changed, 538 insertions(+), 25 deletions(-)
 create mode 100644 arch/x86/platform/intel/pmc_ipc.c
 create mode 100644 include/linux/platform_data/x86/intel_pmc_ipc.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/9 net: phylink: provide mac_get_pcs_neg_mode() function

Phylink invokes the 'mac_get_pcs_neg_mode' function during interface mode switching and initial startup.

This function is optional; if 'phylink_pcs_neg_mode' fails to accurately reflect the current PCS negotiation mode, the MAC driver can determine the mode based on the interface mode, current link negotiation mode, and advertising link mode.

For instance, if the interface switches from 2500baseX to SGMII mode, and the current link mode is MLO_AN_PHY, calling 'phylink_pcs_neg_mode' would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require PHYLINK_PCS_NEG_INBAND_ENABLED, the 'mac_get_pcs_neg_mode' function will calculate the mode based on the interface, current link negotiation mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct settings.

---
 drivers/net/phy/phylink.c | 14 +++++++++++---
 include/linux/phylink.h   |  5 +++++
 2 files changed, 16 insertions(+), 3 deletions(-)
drivers/net/phy/phylink.c +11 -3
index 503fd7c40523..b38b39a6d1f0 100644
@@ -1151,9 +1151,17 @@ static void phylink_major_config(struct phylink *pl, bool restart,
 
 	phylink_dbg(pl, "major config %s\n", phy_modes(state->interface));
 
-	pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode,
-						state->interface,
-						state->advertising);
+	if (pl->mac_ops->mac_get_pcs_neg_mode) {
+		pl->pcs_neg_mode = pl->mac_ops->mac_get_pcs_neg_mode
+						(pl->config,
+						 pl->cur_link_an_mode,
+						 state->interface,
+						 state->advertising);
+	} else {
+		pl->pcs_neg_mode = phylink_pcs_neg_mode(pl->cur_link_an_mode,
+							state->interface,
+							state->advertising);
+	}
 
 	if (pl->using_mac_select_pcs) {
 		pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
include/linux/phylink.h +5 -0
index 6ba411732a0d..f0a6c00e8dab 100644
@@ -168,6 +168,7 @@ void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);
  * @mac_finish: finish a major reconfiguration of the interface.
  * @mac_link_down: take the link down.
  * @mac_link_up: allow the link to come up.
+ * @mac_get_pcs_neg_mode: Get PCS negotiation mode for interface mode.
  *
  * The individual methods are described more fully below.
  */
@@ -188,6 +189,10 @@ struct phylink_mac_ops {
 			    struct phy_device *phy, unsigned int mode,
 			    phy_interface_t interface, int speed, int duplex,
 			    bool tx_pause, bool rx_pause);
+	unsigned int (*mac_get_pcs_neg_mode)(struct phylink_config *config,
+					     unsigned int mode,
+					     phy_interface_t interface,
+					     const unsigned long *advertising);
 };
 
 #if 0 /* For kernel-doc purposes only. */
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH net-next v5 1/9] net: phylink: provide mac_get_pcs_neg_mode() function

Quoted 8 lines · Choong Yong Liang

Phylink invokes the 'mac_get_pcs_neg_mode' function during interface mode switching and initial startup.

This function is optional; if 'phylink_pcs_neg_mode' fails to accurately reflect the current PCS negotiation mode, the MAC driver can determine the mode based on the interface mode, current link negotiation mode, and advertising link mode.

Quoted 7 lines

For instance, if the interface switches from 2500baseX to SGMII mode, and the current link mode is MLO_AN_PHY, calling 'phylink_pcs_neg_mode' would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require PHYLINK_PCS_NEG_INBAND_ENABLED, the 'mac_get_pcs_neg_mode' function will calculate the mode based on the interface, current link negotiation mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct settings.

This paragraph doesn't make sense - at least to me. It first talks about requiring PHYLINK_PCS_NEG_INBAND_ENABLED when in SGMII mode. On this:

1) are you sure that the hardware can't be programmed for the SGMII symbol repititions?

2) what happens if you're paired with a PHY (e.g. on a SFP module) which uses SGMII but has no capability of providing the inband data? (They do exist.) If your hardware truly does require inband data, it is going to be fundamentally inoperative with these modules.

Next, you then talk about returning PHYLINK_PCS_NEG_OUTBAND for the "correct settings". How does this relate to the first part where you basically describe the problem as SGMII requring inband? Basically the two don't follow.

How, from a design point of view, because this fundamentally allows drivers to change how the system behaves, it will allow radically different behaviours for the same parameters between different drivers. I am opposed to that - I want to see a situation where we have uniform behaviour for the same configuration, and where hardware doesn't support something, we have some way to indicate that via some form of capabilities.

The issue of whether 2500base-X has inband or not is a long standing issue, and there are arguments (and hardware) that take totally opposing views on this. There is hardware where 2500base-X inband _must_ be used or the link doesn't come up. There is also hardware where 2500base-X inband is not "supported" in documentation but works in practice. There is also hardware where 2500base-X inband doesn't work. The whole thing is a total mess (thanks IEEE 802.3 for not getting on top of this early enough... and what's now stated in 802.3 for 2500base-X is now irrelevant because they were too late to the party.)

I haven't been able to look at this issue over the last few weeks because of being at a summit, and then suffering with flu and its recovery. However, I have been working on how we can identify the capabilities of the PCS and PHY w.r.t. inband support in various interface modes, and how we can handle the result. That work is ongoing (as and when I have a clear head from after-flu effects.)

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw

RE: [PATCH net-next v5 1/9] net: phylink: provide mac_get_pcs_neg_mode() function

Quoted 6 lines
Quoted 2 lines

For instance, if the interface switches from 2500baseX to SGMII mode, and the current link mode is MLO_AN_PHY, calling

'phylink_pcs_neg_mode'

Quoted 2 lines

would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require PHYLINK_PCS_NEG_INBAND_ENABLED, the

'mac_get_pcs_neg_mode'

Quoted 8 lines
Quoted 3 lines

function will calculate the mode based on the interface, current link negotiation mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct

settings.

This paragraph doesn't make sense - at least to me. It first talks about requiring PHYLINK_PCS_NEG_INBAND_ENABLED when in SGMII mode. On this:

The example given here is a very specific condition and that probably why there are some confusions here. Basically, this patch provides an optional function for MAC driver to change the phy interface on-the-fly without the need of reinitialize the Ethernet driver. As we know that the 2500base-x is messy, in our case the 2500base-x does not support inband. To complete the picture, we are using SGMII c37 to handle speed 10/100/1000. Hence, to enable user to switch link speed from 2500 to 1000/100/10 and vice versa on-the-fly, the phy interface need to be configured to inband SGMII for speed 10/100/1000, and outband 2500base-x for speed 2500. Lastly, the newly introduced "mac_get_pcs_neg_mode"callback function enables MAC driver to reconfigure pcs negotiation mode to inband or outband based on the interface mode, current link negotiation mode, and advertising link mode.

Quoted 4 lines

1) are you sure that the hardware can't be programmed for the SGMII symbol repititions?

No, the HW can be program for SGMII symbol repetitions.

Quoted 5 lines

2) what happens if you're paired with a PHY (e.g. on a SFP module) which uses SGMII but has no capability of providing the inband data? (They do exist.) If your hardware truly does require inband data, it is going to be fundamentally inoperative with these modules.

Above explanation should have already cleared your doubts. Inband or outband capability is configured based on the phy interface.

Quoted 4 lines

Next, you then talk about returning PHYLINK_PCS_NEG_OUTBAND for the "correct settings". How does this relate to the first part where you basically describe the problem as SGMII requring inband? Basically the two don't follow.

It should be a typo mistake. SGMII should return PHYLINK_PCS_NEG_INBAND_ENABLED.

Quoted 8 lines

How, from a design point of view, because this fundamentally allows drivers to change how the system behaves, it will allow radically different behaviours for the same parameters between different drivers.
I am opposed to that - I want to see a situation where we have uniform behaviour for the same configuration, and where hardware doesn't support something, we have some way to indicate that via some form of capabilities.

Hi Russell,
If I understand you correctly, MAC driver should not interfere with pcs negotiation mode and it should be standardized in the generic function, e.g., phylink_pcs_neg_mode()?

Quoted 11 lines

The issue of whether 2500base-X has inband or not is a long standing issue, and there are arguments (and hardware) that take totally opposing views on this. There is hardware where 2500base-X inband _must_ be used or the link doesn't come up. There is also hardware where 2500base-X inband is not "supported" in documentation but works in practice. There is also hardware where 2500base-X inband doesn't work. The whole thing is a total mess (thanks IEEE 802.3 for not getting on top of this early enough... and what's now stated in 802.3 for 2500base-X is now irrelevant because they were too late to the
party.)

Agreed. And I have also seen some of your comments regarding the 2500SGMII and 2500BASEX.

#4 lore raw

Re: [PATCH net-next v5 1/9] net: phylink: provide mac_get_pcs_neg_mode() function

Quoted 63 lines · Weifeng
Quoted 6 lines
Quoted 2 lines

For instance, if the interface switches from 2500baseX to SGMII mode, and the current link mode is MLO_AN_PHY, calling

'phylink_pcs_neg_mode'

Quoted 2 lines

would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require PHYLINK_PCS_NEG_INBAND_ENABLED, the

'mac_get_pcs_neg_mode'

Quoted 8 lines
Quoted 3 lines

function will calculate the mode based on the interface, current link negotiation mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct

settings.

This paragraph doesn't make sense - at least to me. It first talks about requiring PHYLINK_PCS_NEG_INBAND_ENABLED when in SGMII mode. On this:

The example given here is a very specific condition and that probably why there are some confusions here. Basically, this patch provides an optional function for MAC driver to change the phy interface on-the-fly without the need of reinitialize the Ethernet driver. As we know that the 2500base-x is messy, in our case the 2500base-x does not support inband. To complete the picture, we are using SGMII c37 to handle speed 10/100/1000. Hence, to enable user to switch link speed from 2500 to 1000/100/10 and vice versa on-the-fly, the phy interface need to be configured to inband SGMII for speed 10/100/1000, and outband 2500base-x for speed 2500. Lastly, the newly introduced "mac_get_pcs_neg_mode"callback function enables MAC driver to reconfigure pcs negotiation mode to inband or outband based on the interface mode, current link negotiation mode, and advertising link mode.

Quoted 4 lines

1) are you sure that the hardware can't be programmed for the SGMII symbol repititions?

No, the HW can be program for SGMII symbol repetitions.

Quoted 5 lines

2) what happens if you're paired with a PHY (e.g. on a SFP module) which uses SGMII but has no capability of providing the inband data? (They do exist.) If your hardware truly does require inband data, it is going to be fundamentally inoperative with these modules.

Above explanation should have already cleared your doubts. Inband or outband capability is configured based on the phy interface.

Quoted 4 lines

Next, you then talk about returning PHYLINK_PCS_NEG_OUTBAND for the "correct settings". How does this relate to the first part where you basically describe the problem as SGMII requring inband? Basically the two don't follow.

It should be a typo mistake. SGMII should return PHYLINK_PCS_NEG_INBAND_ENABLED.

Quoted 8 lines

How, from a design point of view, because this fundamentally allows drivers to change how the system behaves, it will allow radically different behaviours for the same parameters between different drivers.
I am opposed to that - I want to see a situation where we have uniform behaviour for the same configuration, and where hardware doesn't support something, we have some way to indicate that via some form of capabilities.

Hi Russell,
If I understand you correctly, MAC driver should not interfere with pcs negotiation mode and it should be standardized in the generic function, e.g., phylink_pcs_neg_mode()?

Quoted 11 lines

The issue of whether 2500base-X has inband or not is a long standing issue, and there are arguments (and hardware) that take totally opposing views on this. There is hardware where 2500base-X inband _must_ be used or the link doesn't come up. There is also hardware where 2500base-X inband is not "supported" in documentation but works in practice. There is also hardware where 2500base-X inband doesn't work. The whole thing is a total mess (thanks IEEE 802.3 for not getting on top of this early enough... and what's now stated in 802.3 for 2500base-X is now irrelevant because they were too late to the
party.)

Quoted 2 lines

Agreed. And I have also seen some of your comments regarding the 2500SGMII and 2500BASEX.

Hi Russell,

Did the previous reply clear your doubt?

If we understand you correctly that MAC driver should not interfere with pcs negotiation mode and it should be standardized in the generic function.
If implement what you suggested earlier that during interface mode change then update the cur_link_an_mode but not cfg_link_an_mode: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/?

Would that be a better solution?
So that 'phylink_pcs_neg_mode' function still can serve as the generic for all the drivers.

Do you have anything in mind that we can handle better for this patch series? or the solution can be aligned with what you are going to implement in the future?

#5 lore raw

Re: [PATCH net-next v5 1/9] net: phylink: provide mac_get_pcs_neg_mode() function

Quoted 66 lines · Choong Yong Liang
Quoted 63 lines · Weifeng
Quoted 6 lines
Quoted 2 lines

For instance, if the interface switches from 2500baseX to SGMII mode, and the current link mode is MLO_AN_PHY, calling

'phylink_pcs_neg_mode'

Quoted 2 lines

would yield PHYLINK_PCS_NEG_OUTBAND. Since the MAC and PCS driver require PHYLINK_PCS_NEG_INBAND_ENABLED, the

'mac_get_pcs_neg_mode'

Quoted 8 lines
Quoted 3 lines

function will calculate the mode based on the interface, current link negotiation mode, and advertising link mode, returning PHYLINK_PCS_NEG_OUTBAND to enable the PCS to configure the correct

settings.

This paragraph doesn't make sense - at least to me. It first talks about requiring PHYLINK_PCS_NEG_INBAND_ENABLED when in SGMII mode. On this:

The example given here is a very specific condition and that probably why there are some confusions here. Basically, this patch provides an optional function for MAC driver to change the phy interface on-the-fly without the need of reinitialize the Ethernet driver. As we know that the 2500base-x is messy, in our case the 2500base-x does not support inband. To complete the picture, we are using SGMII c37 to handle speed 10/100/1000. Hence, to enable user to switch link speed from 2500 to 1000/100/10 and vice versa on-the-fly, the phy interface need to be configured to inband SGMII for speed 10/100/1000, and outband 2500base-x for speed 2500. Lastly, the newly introduced "mac_get_pcs_neg_mode"callback function enables MAC driver to reconfigure pcs negotiation mode to inband or outband based on the interface mode, current link negotiation mode, and advertising link mode.

Quoted 4 lines

1) are you sure that the hardware can't be programmed for the SGMII symbol repititions?

No, the HW can be program for SGMII symbol repetitions.

Quoted 5 lines

2) what happens if you're paired with a PHY (e.g. on a SFP module) which uses SGMII but has no capability of providing the inband data? (They do exist.) If your hardware truly does require inband data, it is going to be fundamentally inoperative with these modules.

Above explanation should have already cleared your doubts. Inband or outband capability is configured based on the phy interface.

Quoted 4 lines

Next, you then talk about returning PHYLINK_PCS_NEG_OUTBAND for the "correct settings". How does this relate to the first part where you basically describe the problem as SGMII requring inband? Basically the two don't follow.

It should be a typo mistake. SGMII should return PHYLINK_PCS_NEG_INBAND_ENABLED.

Quoted 8 lines

How, from a design point of view, because this fundamentally allows drivers to change how the system behaves, it will allow radically different behaviours for the same parameters between different drivers.
I am opposed to that - I want to see a situation where we have uniform behaviour for the same configuration, and where hardware doesn't support something, we have some way to indicate that via some form of capabilities.

Hi Russell,
If I understand you correctly, MAC driver should not interfere with pcs negotiation mode and it should be standardized in the generic function, e.g., phylink_pcs_neg_mode()?

Quoted 11 lines

The issue of whether 2500base-X has inband or not is a long standing issue, and there are arguments (and hardware) that take totally opposing views on this. There is hardware where 2500base-X inband _must_ be used or the link doesn't come up. There is also hardware where 2500base-X inband is not "supported" in documentation but works in practice. There is also hardware where 2500base-X inband doesn't work. The whole thing is a total mess (thanks IEEE 802.3 for not getting on top of this early enough... and what's now stated in 802.3 for 2500base-X is now irrelevant because they were too late to the
party.)

Quoted 5 lines
Quoted 2 lines

Agreed. And I have also seen some of your comments regarding the 2500SGMII and 2500BASEX.

Hi Russell,

Did the previous reply clear your doubt?

I am working on the problem as and when I can find the time (which is not much spare time.) I have some prototype code at the moment.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#6 lore raw

PATCH v5 2/9 net: phylink: add phylink_pcs_neg_mode() declaration into phylink.h

In reply to Choong Yong Liang

Add phylink_pcs_neg_mode() declaration to the header file for other modules to call the function.

---
 drivers/net/phy/phylink.c | 7 ++++---
 include/linux/phylink.h   | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/phy/phylink.c +4 -3
index b38b39a6d1f0..b4345042d3fe 100644
@@ -1093,9 +1093,9 @@ static void phylink_pcs_an_restart(struct phylink *pl)
  * Note: this is for cases where the PCS itself is involved in negotiation
  * (e.g. Clause 37, SGMII and similar) not Clause 73.
  */
-static unsigned int phylink_pcs_neg_mode(unsigned int mode,
-					 phy_interface_t interface,
-					 const unsigned long *advertising)
+unsigned int phylink_pcs_neg_mode(unsigned int mode,
+				  phy_interface_t interface,
+				  const unsigned long *advertising)
 {
 	unsigned int neg_mode;
 
@@ -1139,6 +1139,7 @@ static unsigned int phylink_pcs_neg_mode(unsigned int mode,
 
 	return neg_mode;
 }
+EXPORT_SYMBOL_GPL(phylink_pcs_neg_mode);
 
 static void phylink_major_config(struct phylink *pl, bool restart,
 				  const struct phylink_link_state *state)
include/linux/phylink.h +3 -0
index f0a6c00e8dab..74af8cfbdd92 100644
@@ -594,6 +594,9 @@ int phylink_ethtool_set_eee(struct phylink *link, struct ethtool_keee *eee);
 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
 int phylink_speed_down(struct phylink *pl, bool sync);
 int phylink_speed_up(struct phylink *pl);
+unsigned int phylink_pcs_neg_mode(unsigned int mode,
+				  phy_interface_t interface,
+				  const unsigned long *advertising);
 
 #define phylink_zero(bm) \
 	bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS)
Signature · 1 line
2.34.1
#7 lore raw

PATCH v5 3/9 net: stmmac: select PCS negotiation mode according to the interface mode

In reply to Choong Yong Liang

The 'stmmac_get_pcs_neg_mode' is invoked during link initialization or interface mode changes.

In cases where 'priv->plat->get_pcs_neg_mode' is absent, the default 'phylink_pcs_neg_mode' function is utilized.

Additionally, the 'intel_get_pcs_neg_mode' function is available to determine the PCS negotiation mode based on the provided interface mode.

---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 48 +++++++++++++++----
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 +++++++
 include/linux/stmmac.h                        |  2 +
 3 files changed, 57 insertions(+), 10 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +38 -10
index 60283543ffc8..6f12e80b8a05 100644
@@ -414,6 +414,39 @@ static void intel_mgbe_pse_crossts_adj(struct intel_priv_data *intel_priv,
 	}
 }
 
+static bool is_fixed_link(struct pci_dev *pdev)
+{
+	struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
+	bool is_fixed_link = false;
+
+	if (fwnode) {
+		struct fwnode_handle *fixed_node;
+
+		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
+		if (fixed_node)
+			is_fixed_link = true;
+
+		fwnode_handle_put(fixed_node);
+	}
+
+	return is_fixed_link;
+}
+
+static unsigned int intel_get_pcs_neg_mode(phy_interface_t interface,
+					   struct pci_dev *pdev)
+{
+	unsigned int neg_mode;
+
+	if ((interface == PHY_INTERFACE_MODE_SGMII ||
+	     interface == PHY_INTERFACE_MODE_1000BASEX) &&
+	     !is_fixed_link(pdev))
+		neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
+	else
+		neg_mode = PHYLINK_PCS_NEG_OUTBAND;
+
+	return neg_mode;
+}
+
 static void common_default_data(struct plat_stmmacenet_data *plat)
 {
 	plat->clk_csr = 2;	/* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */
@@ -590,15 +623,8 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 	}
 
 	/* For fixed-link setup, we clear xpcs_an_inband */
-	if (fwnode) {
-		struct fwnode_handle *fixed_node;
-
-		fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
-		if (fixed_node)
-			plat->mdio_bus_data->xpcs_an_inband = false;
-
-		fwnode_handle_put(fixed_node);
-	}
+	if (is_fixed_link(pdev))
+		plat->mdio_bus_data->xpcs_an_inband = false;
 
 	/* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
 	plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR;
@@ -649,7 +675,7 @@ static int ehl_sgmii_data(struct pci_dev *pdev,
 	plat->speed_mode_2500 = intel_speed_mode_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
-
+	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	plat->clk_ptp_rate = 204800000;
 
 	return ehl_common_data(pdev, plat);
@@ -708,6 +734,7 @@ static int ehl_pse0_sgmii1g_data(struct pci_dev *pdev,
 	plat->speed_mode_2500 = intel_speed_mode_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
+	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	return ehl_pse0_common_data(pdev, plat);
 }
 
@@ -749,6 +776,7 @@ static int ehl_pse1_sgmii1g_data(struct pci_dev *pdev,
 	plat->speed_mode_2500 = intel_speed_mode_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
+	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	return ehl_pse1_common_data(pdev, plat);
 }
 
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +17 -0
index ae2ffa9595d6..dbd16fc38888 100644
@@ -1104,11 +1104,28 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 		stmmac_hwtstamp_correct_latency(priv, priv);
 }
 
+static unsigned int stmmac_get_pcs_neg_mode(struct phylink_config *config,
+					    unsigned int mode,
+					    phy_interface_t interface,
+					    const unsigned long *advertising)
+{
+	struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
+	unsigned int neg_mode;
+
+	if (priv->plat->get_pcs_neg_mode)
+		neg_mode = priv->plat->get_pcs_neg_mode(interface, priv->plat->pdev);
+	else
+		neg_mode = phylink_pcs_neg_mode(mode, interface, advertising);
+
+	return neg_mode;
+}
+
 static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
 	.mac_select_pcs = stmmac_mac_select_pcs,
 	.mac_config = stmmac_mac_config,
 	.mac_link_down = stmmac_mac_link_down,
 	.mac_link_up = stmmac_mac_link_up,
+	.mac_get_pcs_neg_mode = stmmac_get_pcs_neg_mode,
 };
 
 /**
include/linux/stmmac.h +2 -0
index dfa1828cd756..ffd66722eeda 100644
@@ -277,6 +277,8 @@ struct plat_stmmacenet_data {
 	int (*serdes_powerup)(struct net_device *ndev, void *priv);
 	void (*serdes_powerdown)(struct net_device *ndev, void *priv);
 	void (*speed_mode_2500)(struct net_device *ndev, void *priv);
+	unsigned int (*get_pcs_neg_mode)(phy_interface_t interface,
+					 struct pci_dev *pdev);
 	void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
 	int (*init)(struct platform_device *pdev, void *priv);
 	void (*exit)(struct platform_device *pdev, void *priv);
Signature · 1 line
2.34.1
#8 lore raw

PATCH v5 4/9 net: pcs: xpcs: re-initiate clause 37 Auto-negotiation

In reply to Choong Yong Liang

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 is set to 2500BASE-X, Clause 37 Auto-Negotiation is turned off.

Subsequently, 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.

---
 drivers/net/pcs/pcs-xpcs.c | 62 +++++++++++++++++++++++++++++++++++---
 1 file changed, 57 insertions(+), 5 deletions(-)
drivers/net/pcs/pcs-xpcs.c +57 -5
index 52a7757ee419..cf1ed89d6418 100644
@@ -848,6 +848,60 @@ static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
 	return xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL, ret);
 }
 
+static int xpcs_switch_to_aneg_c37_sgmii(const struct xpcs_compat *compat,
+					 struct dw_xpcs *xpcs,
+					 unsigned int neg_mode)
+{
+	bool an_c37_enabled;
+	int ret, mdio_ctrl;
+
+	if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
+		mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL);
+		if (mdio_ctrl < 0)
+			return mdio_ctrl;
+
+		an_c37_enabled = mdio_ctrl & AN_CL37_EN;
+		if (!an_c37_enabled) {
+			//Perform soft reset to initiate C37 auto-negotiation
+			ret = xpcs_soft_reset(xpcs, compat);
+			if (ret)
+				return ret;
+		}
+	}
+	return 0;
+}
+
+static int xpcs_switch_interface_mode(const struct xpcs_compat *compat,
+				      struct dw_xpcs *xpcs,
+				      phy_interface_t interface,
+				      unsigned int neg_mode)
+{
+	int ret;
+
+	if (xpcs->dev_flag == DW_DEV_TXGBE) {
+		ret = txgbe_xpcs_switch_mode(xpcs, interface);
+		if (ret)
+			return ret;
+	} else {
+		if (xpcs->interface != interface) {
+			xpcs->interface = interface;
+
+			switch (compat->an_mode) {
+			case DW_AN_C37_SGMII:
+				ret = xpcs_switch_to_aneg_c37_sgmii(compat,
+								    xpcs,
+								    neg_mode);
+				if (ret)
+					return ret;
+				break;
+			default:
+				return 0;
+			}
+		}
+	}
+	return 0;
+}
+
 int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
 		   const unsigned long *advertising, unsigned int neg_mode)
 {
@@ -858,11 +912,9 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
 	if (!compat)
 		return -ENODEV;
 
-	if (xpcs->dev_flag == DW_DEV_TXGBE) {
-		ret = txgbe_xpcs_switch_mode(xpcs, interface);
-		if (ret)
-			return ret;
-	}
+	ret = xpcs_switch_interface_mode(compat, xpcs, interface, neg_mode);
+	if (ret)
+		return ret;
 
 	switch (compat->an_mode) {
 	case DW_10GBASER:
Signature · 1 line
2.34.1
#9 lore raw

PATCH v5 5/9 arch: x86: Add IPC mailbox accessor function and add SoC register access

In reply to Choong Yong Liang

From: "David E. Box" <[email protected]>

- Exports intel_pmc_ipc() for host access to the PMC IPC mailbox
- Add support to use IPC command allows host to access SoC registers through PMC firmware that are otherwise inaccessible to the host due to security policies.

---
 MAINTAINERS                                   |  2 +
 arch/x86/Kconfig                              |  9 +++
 arch/x86/platform/intel/Makefile              |  1 +
 arch/x86/platform/intel/pmc_ipc.c             | 75 +++++++++++++++++++
 .../linux/platform_data/x86/intel_pmc_ipc.h   | 34 +++++++++
 5 files changed, 121 insertions(+)
 create mode 100644 arch/x86/platform/intel/pmc_ipc.c
 create mode 100644 include/linux/platform_data/x86/intel_pmc_ipc.h
MAINTAINERS +2 -0
index 2b775f4369e0..0276f1d53caf 100644
@@ -10996,8 +10996,10 @@ M:	Rajneesh Bhardwaj <[email protected]>
 M:	David E Box <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	arch/x86/platform/intel/pmc_ipc.c
 F:	Documentation/ABI/testing/sysfs-platform-intel-pmc
 F:	drivers/platform/x86/intel/pmc/
+F:	linux/platform_data/x86/intel_pmc_ipc.h
 
 INTEL PMIC GPIO DRIVERS
 M:	Andy Shevchenko <[email protected]>
arch/x86/Kconfig +9 -0
index 5edec175b9bf..bceae28b9381 100644
@@ -666,6 +666,15 @@ config X86_AMD_PLATFORM_DEVICE
 	  I2C and UART depend on COMMON_CLK to set clock. GPIO driver is
 	  implemented under PINCTRL subsystem.
 
+config INTEL_PMC_IPC
+	tristate "Intel Core SoC Power Management Controller IPC mailbox"
+	depends on ACPI
+	help
+	  This option enables sideband register access support for Intel SoC
+	  power management controller IPC mailbox.
+
+	  If you don't require the option or are in doubt, say N.
+
 config IOSF_MBI
 	tristate "Intel SoC IOSF Sideband support for SoC platforms"
 	depends on PCI
arch/x86/platform/intel/Makefile +1 -0
index dbee3b00f9d0..470fc68de6ba 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_IOSF_MBI)			+= iosf_mbi.o
+obj-$(CONFIG_INTEL_PMC_IPC)		+= pmc_ipc.o
\ No newline at end of file
arch/x86/platform/intel/pmc_ipc.c new file +75 -0

75 lines not on this page · raw message

include/linux/platform_data/x86/intel_pmc_ipc.h new file +34 -0
new file mode 100644
index 000000000000..d47b89f873fc
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Intel Core SoC Power Management Controller Header File
+ *
+ * Copyright (c) 2023, Intel Corporation.
+ * All Rights Reserved.
+ *
+ * Authors: Choong Yong Liang <[email protected]>
+ *          David E. Box <[email protected]>
+ */
+#ifndef INTEL_PMC_IPC_H
+#define INTEL_PMC_IPC_H
+
+#define IPC_SOC_REGISTER_ACCESS			0xAA
+#define IPC_SOC_SUB_CMD_READ			0x00
+#define IPC_SOC_SUB_CMD_WRITE			0x01
+
+struct pmc_ipc_cmd {
+	u32 cmd;
+	u32 sub_cmd;
+	u32 size;
+	u32 wbuf[4];
+};
+
+/**
+ * intel_pmc_ipc() - PMC IPC Mailbox accessor
+ * @ipc_cmd:  struct pmc_ipc_cmd prepared with input to send
+ * @rbuf:     Allocated u32[4] array for returned IPC data
+ *
+ * Return: 0 on success. Non-zero on mailbox error
+ */
+int intel_pmc_ipc(struct pmc_ipc_cmd *ipc_cmd, u32 *rbuf);
+
+#endif /* INTEL_PMC_IPC_H */
Signature · 1 line
2.34.1
#10 lore raw

PATCH v5 6/9 net: stmmac: configure SerDes on mac_finish

In reply to Choong Yong Liang

SerDes will configure according to the provided interface mode after finish a major reconfiguration of the interface mode.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++++++++
 include/linux/stmmac.h                            |  3 +++
 2 files changed, 16 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +13 -0
index dbd16fc38888..69a33e9f1a5c 100644
@@ -1120,12 +1120,25 @@ static unsigned int stmmac_get_pcs_neg_mode(struct phylink_config *config,
 	return neg_mode;
 }
 
+static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
+			     phy_interface_t interface)
+{
+	struct net_device *ndev = to_net_dev(config->dev);
+	struct stmmac_priv *priv = netdev_priv(ndev);
+
+	if (priv->plat->config_serdes)
+		priv->plat->config_serdes(ndev, priv->plat->bsp_priv, interface);
+
+	return 0;
+}
+
 static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
 	.mac_select_pcs = stmmac_mac_select_pcs,
 	.mac_config = stmmac_mac_config,
 	.mac_link_down = stmmac_mac_link_down,
 	.mac_link_up = stmmac_mac_link_up,
 	.mac_get_pcs_neg_mode = stmmac_get_pcs_neg_mode,
+	.mac_finish = stmmac_mac_finish,
 };
 
 /**
include/linux/stmmac.h +3 -0
index ffd66722eeda..fd3d7d25f871 100644
@@ -279,6 +279,9 @@ struct plat_stmmacenet_data {
 	void (*speed_mode_2500)(struct net_device *ndev, void *priv);
 	unsigned int (*get_pcs_neg_mode)(phy_interface_t interface,
 					 struct pci_dev *pdev);
+	int (*config_serdes)(struct net_device *ndev,
+			     void *priv,
+			     phy_interface_t interface);
 	void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
 	int (*init)(struct platform_device *pdev, void *priv);
 	void (*exit)(struct platform_device *pdev, void *priv);
Signature · 1 line
2.34.1
#11 lore raw

PATCH v5 7/9 stmmac: intel: configure SerDes according to the interface mode

In reply to Choong Yong Liang

From: "Tan, Tee Min" <[email protected]>

Intel platform will configure the SerDes through PMC api based on the provided interface mode.

This patch adds several new functions below:-
- intel_tsn_interface_is_available(): This new function reads FIA lane ownership registers and common lane registers through IPC commands to know which lane the mGbE port is assigned to.
- intel_config_serdes(): To configure the SerDes based on the assigned lane and latest interface mode, it sends IPC command to the PMC through PMC driver/API. The PMC acts as a proxy for R/W on behalf of the driver.
- intel_set_reg_access(): Set the register access to the available TSN interface.

---
 drivers/net/ethernet/stmicro/stmmac/Kconfig   |   2 +
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 115 +++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/dwmac-intel.h |  75 ++++++++++++
 3 files changed, 191 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/Kconfig +2 -0
index 4ec61f1ee71a..25405c305a21 100644
@@ -273,6 +273,8 @@ config DWMAC_INTEL
 	default X86
 	depends on X86 && STMMAC_ETH && PCI
 	depends on COMMON_CLK
+	depends on ACPI
+	select INTEL_PMC_IPC
 	help
 	  This selects the Intel platform specific bus support for the
 	  stmmac driver. This driver is used for Intel Quark/EHL/TGL.
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +114 -1

163 lines not on this page · raw message

drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h +75 -0

79 lines not on this page · raw message

Signature · 1 line
2.34.1
#12 lore raw

PATCH v5 8/9 stmmac: intel: interface switching support for EHL platform

In reply to Choong Yong Liang

'intel_get_pcs_neg_mode' and 'intel_config_serdes' was provided to handle interface mode change for EHL platform.

Modphy register lane was provided to configure serdes on interface mode changing.

---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 21 +++++++++++++++++--
 .../net/ethernet/stmicro/stmmac/dwmac-intel.h |  4 ++++
 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +19 -2
index 74cc0aa96faf..c79d8e3c3b24 100644
@@ -759,6 +759,8 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 static int ehl_common_data(struct pci_dev *pdev,
 			   struct plat_stmmacenet_data *plat)
 {
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
 	plat->rx_queues_to_use = 8;
 	plat->tx_queues_to_use = 8;
 	plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
@@ -774,21 +776,28 @@ static int ehl_common_data(struct pci_dev *pdev,
 	plat->safety_feat_cfg->prtyen = 0;
 	plat->safety_feat_cfg->tmouten = 0;
 
+	intel_priv->tsn_lane_registers = ehl_tsn_lane_registers;
+	intel_priv->max_tsn_lane_registers = ARRAY_SIZE(ehl_tsn_lane_registers);
+
 	return intel_mgbe_common_data(pdev, plat);
 }
 
 static int ehl_sgmii_data(struct pci_dev *pdev,
 			  struct plat_stmmacenet_data *plat)
 {
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
 	plat->bus_id = 1;
 	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
-	plat->speed_mode_2500 = intel_speed_mode_2500;
+	plat->max_speed = SPEED_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
 	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	plat->config_serdes = intel_config_serdes;
 	plat->clk_ptp_rate = 204800000;
 
+	intel_priv->pid_modphy = PID_MODPHY3;
+
 	return ehl_common_data(pdev, plat);
 }
 
@@ -841,12 +850,16 @@ static struct stmmac_pci_info ehl_pse0_rgmii1g_info = {
 static int ehl_pse0_sgmii1g_data(struct pci_dev *pdev,
 				 struct plat_stmmacenet_data *plat)
 {
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
 	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
-	plat->speed_mode_2500 = intel_speed_mode_2500;
+	plat->max_speed = SPEED_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
 	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	plat->config_serdes = intel_config_serdes;
+	intel_priv->pid_modphy = PID_MODPHY1;
+
 	return ehl_pse0_common_data(pdev, plat);
 }
 
@@ -884,12 +897,16 @@ static struct stmmac_pci_info ehl_pse1_rgmii1g_info = {
 static int ehl_pse1_sgmii1g_data(struct pci_dev *pdev,
 				 struct plat_stmmacenet_data *plat)
 {
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
 	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
 	plat->speed_mode_2500 = intel_speed_mode_2500;
 	plat->serdes_powerup = intel_serdes_powerup;
 	plat->serdes_powerdown = intel_serdes_powerdown;
 	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
 	plat->config_serdes = intel_config_serdes;
+	intel_priv->pid_modphy = PID_MODPHY1;
+
 	return ehl_pse1_common_data(pdev, plat);
 }
 
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h +4 -0
index 79c35ba969ea..093eed977ab0 100644
@@ -123,6 +123,10 @@ static const struct pmc_serdes_regs pid_modphy1_2p5g_regs[] = {
 	{ PID_MODPHY1_N_MODPHY_PCR_CMN_ANA_DWORD30,	N_MODPHY_PCR_CMN_ANA_DWORD30_2P5G },
 	{}
 };
+
+static const int ehl_tsn_lane_registers[] = {7, 8, 9, 10, 11};
+#else
+static const int ehl_tsn_lane_registers[] = {};
 #endif /* CONFIG_INTEL_PMC_IPC */
 
 #endif /* __DWMAC_INTEL_H__ */
Signature · 1 line
2.34.1
#13 lore raw

PATCH v5 9/9 stmmac: intel: interface switching support for ADL-N platform

In reply to Choong Yong Liang

'intel_get_pcs_neg_mode' and 'intel_config_serdes' was provided to handle interface mode change for ADL-S platform.

Modphy register lane was provided to configure serdes on interface mode changing.

---
 .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 49 ++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/dwmac-intel.h |  2 +
 2 files changed, 50 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +48 -1
index c79d8e3c3b24..f0f3d35bdb69 100644
@@ -992,6 +992,53 @@ static int adls_sgmii_phy1_data(struct pci_dev *pdev,
 static struct stmmac_pci_info adls_sgmii1g_phy1_info = {
 	.setup = adls_sgmii_phy1_data,
 };
+
+static int adln_common_data(struct pci_dev *pdev,
+			    struct plat_stmmacenet_data *plat)
+{
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
+	plat->rx_queues_to_use = 6;
+	plat->tx_queues_to_use = 4;
+	plat->clk_ptp_rate = 204800000;
+
+	plat->safety_feat_cfg->tsoee = 1;
+	plat->safety_feat_cfg->mrxpee = 0;
+	plat->safety_feat_cfg->mestee = 1;
+	plat->safety_feat_cfg->mrxee = 1;
+	plat->safety_feat_cfg->mtxee = 1;
+	plat->safety_feat_cfg->epsi = 0;
+	plat->safety_feat_cfg->edpp = 0;
+	plat->safety_feat_cfg->prtyen = 0;
+	plat->safety_feat_cfg->tmouten = 0;
+
+	intel_priv->tsn_lane_registers = adln_tsn_lane_registers;
+	intel_priv->max_tsn_lane_registers = ARRAY_SIZE(adln_tsn_lane_registers);
+
+	return intel_mgbe_common_data(pdev, plat);
+}
+
+static int adln_sgmii_phy0_data(struct pci_dev *pdev,
+				struct plat_stmmacenet_data *plat)
+{
+	struct intel_priv_data *intel_priv = plat->bsp_priv;
+
+	plat->bus_id = 1;
+	plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
+	plat->max_speed = SPEED_2500;
+	plat->serdes_powerup = intel_serdes_powerup;
+	plat->serdes_powerdown = intel_serdes_powerdown;
+	plat->get_pcs_neg_mode = intel_get_pcs_neg_mode;
+	plat->config_serdes = intel_config_serdes;
+	intel_priv->pid_modphy = PID_MODPHY1;
+
+	return adln_common_data(pdev, plat);
+}
+
+static struct stmmac_pci_info adln_sgmii1g_phy0_info = {
+	.setup = adln_sgmii_phy0_data,
+};
+
 static const struct stmmac_pci_func_data galileo_stmmac_func_data[] = {
 	{
 		.func = 6,
@@ -1374,7 +1421,7 @@ static const struct pci_device_id intel_eth_pci_id_table[] = {
 	{ PCI_DEVICE_DATA(INTEL, TGLH_SGMII1G_1, &tgl_sgmii1g_phy1_info) },
 	{ PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_0, &adls_sgmii1g_phy0_info) },
 	{ PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_1, &adls_sgmii1g_phy1_info) },
-	{ PCI_DEVICE_DATA(INTEL, ADLN_SGMII1G, &tgl_sgmii1g_phy0_info) },
+	{ PCI_DEVICE_DATA(INTEL, ADLN_SGMII1G, &adln_sgmii1g_phy0_info) },
 	{ PCI_DEVICE_DATA(INTEL, RPLP_SGMII1G, &tgl_sgmii1g_phy0_info) },
 	{}
 };
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h +2 -0
index 093eed977ab0..2c6b50958988 100644
@@ -124,8 +124,10 @@ static const struct pmc_serdes_regs pid_modphy1_2p5g_regs[] = {
 	{}
 };
 
+static const int adln_tsn_lane_registers[] = {6};
 static const int ehl_tsn_lane_registers[] = {7, 8, 9, 10, 11};
 #else
+static const int adln_tsn_lane_registers[] = {};
 static const int ehl_tsn_lane_registers[] = {};
 #endif /* CONFIG_INTEL_PMC_IPC */
 
Signature · 1 line
2.34.1