All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>,
	Thomas Karpiniec <tom.karpiniec@outlook.com>
Cc: netdev@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Choong Yong Liang <yong.liang.choong@linux.intel.com>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/2] net: stmmac: qcom-ethqos: advertise supported SerDes interfaces
Date: Wed, 16 Sep 2026 14:58:25 +0200	[thread overview]
Message-ID: <97924d2f-45f9-44d5-b482-97fcbb70abdc@bootlin.com> (raw)
In-Reply-To: <aqqI9wOnradk9d7K@oss.qualcomm.com>

Hi,

On 9/16/26 14:17, Mohd Ayaan Anwar wrote:
> On Wed, Sep 16, 2026 at 08:39:50PM +1000, Thomas Karpiniec wrote:
>> From: Thomas Karpiniec <tom@wendy.sh>
>>
>> With a QCA8081 PHY and phy-mode = "2500base-x", stmmac reports only
>> 2500BASE-X in phylink's supported_interfaces. Phylink consequently removes
>> 10/100/1000BASE-T modes from the PHY's advertisement, preventing a link
>> with a gigabit switch.
>>
>> The QCA8081 uses SGMII for lower copper speeds and 2500BASE-X for 2.5Gbps.
>> ETHQOS already reconfigures the SerDes in ethqos_mac_finish_serdes() when
>> the PHY changes interface, but does not advertise this capability.
>>
>> Provide a get_interfaces() callback for serial interfaces. Add SGMII and
>> 2500BASE-X when the SerDes validates them, allowing phylink to retain the
>> corresponding copper link modes. Leave the existing stmmac fallback to
>> the firmware interface in place when no interfaces are reported. RGMII
>> configurations are unchanged.
>>
>> Fixes: 61e9be0efbe8 ("net: stmmac: qcom-ethqos: add support for 2.5G BASEX mode")
>> Cc: stable@vger.kernel.org # 7.1+
>> Assisted-by: LLM sparse
>> Signed-off-by: Thomas Karpiniec <tom@wendy.sh>
>> ---
>>  .../stmicro/stmmac/dwmac-qcom-ethqos.c        | 22 +++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> index ac7d6d3e205a..3493e090f1a8 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
>> @@ -1,6 +1,7 @@
>>  // SPDX-License-Identifier: GPL-2.0
>>  // Copyright (c) 2018-19, Linaro Limited
>>  
>> +#include <linux/bitops.h>
>>  #include <linux/module.h>
>>  #include <linux/of.h>
>>  #include <linux/of_net.h>
>> @@ -564,6 +565,26 @@ static void ethqos_pcs_set_inband(struct qcom_ethqos *ethqos, bool enable)
>>  	stmmac_pcs_ctrl_ane(priv, enable, 0);
>>  }
>>  
>> +static void ethqos_get_interfaces_serdes(struct stmmac_priv *priv, void *bsp_priv,
>> +					 unsigned long *interfaces)
>> +{
>> +	struct qcom_ethqos *ethqos = bsp_priv;
>> +
>> +	if (!ethqos->serdes_phy)
>> +		return;
>> +
>> +	/* PHYs such as QCA8081 switch between SGMII and 2500BASE-X with
>> +	 * the negotiated copper speed. mac_finish reconfigures the SerDes
>> +	 * accordingly; let phylink validate all modes that path supports.
>> +	 */
>> +	if (!phy_validate(ethqos->serdes_phy, PHY_MODE_ETHERNET,
>> +			  PHY_INTERFACE_MODE_SGMII, NULL))
>> +		__set_bit(PHY_INTERFACE_MODE_SGMII, interfaces);
>> +	if (!phy_validate(ethqos->serdes_phy, PHY_MODE_ETHERNET,
>> +			  PHY_INTERFACE_MODE_2500BASEX, NULL))
>> +		__set_bit(PHY_INTERFACE_MODE_2500BASEX, interfaces);
>> +}
>> +
> 
> So, I had proposed this exact change a while back:
> https://lore.kernel.org/netdev/aMgootkPQ%2FGcdiXX@oss.qualcomm.com/
> 
> As Russell noted, this behaviour is due to the messed-up integrated
> PCS support in STMMAC/QCOM-ETHQOS.
> 
> I would defer to him for this if he's around.

Indeed, but we haven't heard from him in a while, let's see if we can
figure this out. 

Does this IP have an integrated PCS ? (i.e. dma_cap.pcs is set)
you can check that in debugfs :

mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/stmmaceth/eth0/dma_cap | grep PCS

if it's Y, then you have the integrated one.

Russell worked hard on that, it looks like a lot of the plumbing went
through.

I think the right approach here is to have the PCS itself report the
list of supported interfaces, instead of relying on the glue. looking
at stmmac_pcs.c :

220 int stmmac_integrated_pcs_init(struct stmmac_priv *priv,                                
221                                const struct stmmac_pcs_info *pcs_info)                  
222 {                                                                                       
223         struct stmmac_pcs *spcs;                                                        
224                                                                                         
225         spcs = devm_kzalloc(priv->device, sizeof(*spcs), GFP_KERNEL);                   
226         if (!spcs)                                                                      
227                 return -ENOMEM;                                                         

[...]
                                                             
246         /* Only allow 2500BASE-X if the SerDes has support. */                          
247         if (priv->plat->flags & STMMAC_FLAG_SERDES_SUPPORTS_2500M)                      
248                 __set_bit(PHY_INTERFACE_MODE_2500BASEX,                                 
249                           spcs->pcs.supported_interfaces);                              
250                                                                                         
251         priv->integrated_pcs = spcs;                                                    
252                                                                                         
253         return 0;                                                                       
254 }        

Can you test settung the STMMAC_FLAG_SERDES_SUPPORTS_2500M flag in
dwmac-qcom-ethqos ?

Maxime


  reply	other threads:[~2026-09-16 12:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 10:39 [PATCH net 0/2] stmmac: fix ETHQOS SerDes interface handling Thomas Karpiniec
2026-09-16 10:39 ` [PATCH net 1/2] net: stmmac: propagate platform mac_finish errors Thomas Karpiniec
2026-09-16 12:03   ` Mohd Ayaan Anwar
2026-09-17  4:01     ` Thomas Karpiniec
2026-09-16 13:02   ` Maxime Chevallier
2026-09-16 10:39 ` [PATCH net 2/2] net: stmmac: qcom-ethqos: advertise supported SerDes interfaces Thomas Karpiniec
2026-09-16 12:17   ` Mohd Ayaan Anwar
2026-09-16 12:58     ` Maxime Chevallier [this message]
2026-09-17  4:29       ` Thomas Karpiniec
2026-09-17  5:36         ` Maxime Chevallier
2026-09-17  8:21           ` Coia Prant
2026-09-18  4:36             ` Thomas Karpiniec
2026-09-18  5:18               ` Mohd Ayaan Anwar
2026-09-17 15:59           ` Mohd Ayaan Anwar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97924d2f-45f9-44d5-b482-97fcbb70abdc@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=brgl@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mohd.anwar@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=tom.karpiniec@outlook.com \
    --cc=yong.liang.choong@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.