Re: [PATCH RFC net-next 8/9] net: stmmac: qcom-ethqos: support external PCS
From: Maxime Chevallier
Date: Mon Sep 28 2026 - 11:18:02 EST
Hi Ayaan,
On 9/23/26 03:07, Mohd Ayaan Anwar wrote:
> Select the XPCS instance initialized by stmmac when firmware provides
> a pcs-handle. Reject interfaces that are not supported by the selected
> PCS.
>
> Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@xxxxxxxxxxxxxxxx>
> ---
> .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index ac7d6d3e205a1ab5b391def879d6f1033a0961b6..a99a78880c0fb7858e90b6212b37ebfc7fccaf84 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -7,6 +7,8 @@
> #include <linux/platform_device.h>
> #include <linux/phy.h>
> #include <linux/phy/phy.h>
> +#include <linux/pcs/pcs-xpcs.h>
> +#include <linux/property.h>
>
> #include "stmmac.h"
> #include "stmmac_platform.h"
> @@ -681,6 +683,21 @@ static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv)
> netdev_dbg(priv->dev, "PTP rate %lu\n", plat_dat->clk_ptp_rate);
> }
>
> +static struct phylink_pcs *
> +qcom_ethqos_select_pcs(struct stmmac_priv *priv, phy_interface_t interface)
> +{
> + struct phylink_pcs *pcs;
> +
> + if (!priv->hw->xpcs)
> + return ERR_PTR(-ENODEV);
If there's no device (i.e. no PCS), then you should return NULL.
> +
> + pcs = xpcs_to_phylink_pcs(priv->hw->xpcs);
> + if (!test_bit(interface, pcs->supported_interfaces))
> + return ERR_PTR(-EOPNOTSUPP);
phylink already checks if the interface is in pcs->supported_interfaces,
no need to do it here :)
Thanks,
Maxime