netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation
@ 2025-11-14  8:42 Horatiu Vultur
  2025-11-14  9:21 ` Maxime Chevallier
  2025-11-18 14:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Horatiu Vultur @ 2025-11-14  8:42 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Horatiu Vultur

The lan8814 supports two interfaces towards the host (QSGMII and QUSGMII).
Currently the lan8814 disables the auto-negotiation towards the host
side. So, extend this to allow to configure to use in-band
auto-negotiation.
I have tested this only with the QSGMII interface.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/phy/micrel.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 57ea947369fed..5d90ccc20df75 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2988,6 +2988,8 @@ static int ksz886x_cable_test_get_status(struct phy_device *phydev,
 #define LAN_EXT_PAGE_ACCESS_ADDRESS_DATA		0x17
 #define LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC		0x4000
 
+#define LAN8814_QSGMII_TX_CONFIG			0x35
+#define LAN8814_QSGMII_TX_CONFIG_QSGMII			BIT(3)
 #define LAN8814_QSGMII_SOFT_RESET			0x43
 #define LAN8814_QSGMII_SOFT_RESET_BIT			BIT(0)
 #define LAN8814_QSGMII_PCS1G_ANEG_CONFIG		0x13
@@ -4501,12 +4503,24 @@ static void lan8814_setup_led(struct phy_device *phydev, int val)
 static int lan8814_config_init(struct phy_device *phydev)
 {
 	struct kszphy_priv *lan8814 = phydev->priv;
+	int ret;
 
-	/* Disable ANEG with QSGMII PCS Host side */
-	lanphy_modify_page_reg(phydev, LAN8814_PAGE_PORT_REGS,
-			       LAN8814_QSGMII_PCS1G_ANEG_CONFIG,
-			       LAN8814_QSGMII_PCS1G_ANEG_CONFIG_ANEG_ENA,
-			       0);
+	/* Based on the interface type select how the advertise ability is
+	 * encoded, to set as SGMII or as USGMII.
+	 */
+	if (phydev->interface == PHY_INTERFACE_MODE_QSGMII)
+		ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS,
+					     LAN8814_QSGMII_TX_CONFIG,
+					     LAN8814_QSGMII_TX_CONFIG_QSGMII,
+					     LAN8814_QSGMII_TX_CONFIG_QSGMII);
+	else
+		ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS,
+					     LAN8814_QSGMII_TX_CONFIG,
+					     LAN8814_QSGMII_TX_CONFIG_QSGMII,
+					     0);
+
+	if (ret < 0)
+		return ret;
 
 	/* MDI-X setting for swap A,B transmit */
 	lanphy_modify_page_reg(phydev, LAN8814_PAGE_PCS_DIGITAL, LAN8814_ALIGN_SWAP,
@@ -6640,6 +6654,8 @@ static struct phy_driver ksphy_driver[] = {
 	.suspend	= genphy_suspend,
 	.resume		= kszphy_resume,
 	.config_intr	= lan8814_config_intr,
+	.inband_caps	= lan8842_inband_caps,
+	.config_inband	= lan8842_config_inband,
 	.handle_interrupt = lan8814_handle_interrupt,
 	.cable_test_start	= lan8814_cable_test_start,
 	.cable_test_get_status	= ksz886x_cable_test_get_status,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation
  2025-11-14  8:42 [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation Horatiu Vultur
@ 2025-11-14  9:21 ` Maxime Chevallier
  2025-11-18 14:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Chevallier @ 2025-11-14  9:21 UTC (permalink / raw)
  To: Horatiu Vultur, andrew, hkallweit1, linux, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel

Hi Horatiu,

On 14/11/2025 09:42, Horatiu Vultur wrote:
> The lan8814 supports two interfaces towards the host (QSGMII and QUSGMII).
> Currently the lan8814 disables the auto-negotiation towards the host
> side. So, extend this to allow to configure to use in-band
> auto-negotiation.
> I have tested this only with the QSGMII interface.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
>  drivers/net/phy/micrel.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 57ea947369fed..5d90ccc20df75 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -2988,6 +2988,8 @@ static int ksz886x_cable_test_get_status(struct phy_device *phydev,
>  #define LAN_EXT_PAGE_ACCESS_ADDRESS_DATA		0x17
>  #define LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC		0x4000
>  
> +#define LAN8814_QSGMII_TX_CONFIG			0x35
> +#define LAN8814_QSGMII_TX_CONFIG_QSGMII			BIT(3)
>  #define LAN8814_QSGMII_SOFT_RESET			0x43
>  #define LAN8814_QSGMII_SOFT_RESET_BIT			BIT(0)
>  #define LAN8814_QSGMII_PCS1G_ANEG_CONFIG		0x13
> @@ -4501,12 +4503,24 @@ static void lan8814_setup_led(struct phy_device *phydev, int val)
>  static int lan8814_config_init(struct phy_device *phydev)
>  {
>  	struct kszphy_priv *lan8814 = phydev->priv;
> +	int ret;
>  
> -	/* Disable ANEG with QSGMII PCS Host side */
> -	lanphy_modify_page_reg(phydev, LAN8814_PAGE_PORT_REGS,
> -			       LAN8814_QSGMII_PCS1G_ANEG_CONFIG,
> -			       LAN8814_QSGMII_PCS1G_ANEG_CONFIG_ANEG_ENA,
> -			       0);
> +	/* Based on the interface type select how the advertise ability is
> +	 * encoded, to set as SGMII or as USGMII.
> +	 */
> +	if (phydev->interface == PHY_INTERFACE_MODE_QSGMII)
> +		ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS,
> +					     LAN8814_QSGMII_TX_CONFIG,
> +					     LAN8814_QSGMII_TX_CONFIG_QSGMII,
> +					     LAN8814_QSGMII_TX_CONFIG_QSGMII);
> +	else
> +		ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS,
> +					     LAN8814_QSGMII_TX_CONFIG,
> +					     LAN8814_QSGMII_TX_CONFIG_QSGMII,
> +					     0);
> +
> +	if (ret < 0)
> +		return ret;
>  
>  	/* MDI-X setting for swap A,B transmit */
>  	lanphy_modify_page_reg(phydev, LAN8814_PAGE_PCS_DIGITAL, LAN8814_ALIGN_SWAP,
> @@ -6640,6 +6654,8 @@ static struct phy_driver ksphy_driver[] = {
>  	.suspend	= genphy_suspend,
>  	.resume		= kszphy_resume,
>  	.config_intr	= lan8814_config_intr,
> +	.inband_caps	= lan8842_inband_caps,
> +	.config_inband	= lan8842_config_inband,
>  	.handle_interrupt = lan8814_handle_interrupt,
>  	.cable_test_start	= lan8814_cable_test_start,
>  	.cable_test_get_status	= ksz886x_cable_test_get_status,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation
  2025-11-14  8:42 [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation Horatiu Vultur
  2025-11-14  9:21 ` Maxime Chevallier
@ 2025-11-18 14:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-18 14:30 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 14 Nov 2025 09:42:24 +0100 you wrote:
> The lan8814 supports two interfaces towards the host (QSGMII and QUSGMII).
> Currently the lan8814 disables the auto-negotiation towards the host
> side. So, extend this to allow to configure to use in-band
> auto-negotiation.
> I have tested this only with the QSGMII interface.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation
    https://git.kernel.org/netdev/net-next/c/19f1d6c7230b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-18 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14  8:42 [PATCH net-next] net: phy: micrel: lan8814: Enable in-band auto-negotiation Horatiu Vultur
2025-11-14  9:21 ` Maxime Chevallier
2025-11-18 14:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).