netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Siddharth Narayan Vadapalli <s-vadapalli@ti.com>
To: Raag Jadav <raagjadav@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	Bjarni Jonasson <bjarni.jonasson@microchip.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Kishon Vijay Abraham <kishon@ti.com>, <s-vadapalli@ti.com>
Subject: Re: [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation
Date: Thu, 24 Feb 2022 16:11:55 +0530	[thread overview]
Message-ID: <220e82d4-1c20-c540-7dcf-a8fb25f8935d@ti.com> (raw)
In-Reply-To: <1644043492-31307-1-git-send-email-raagjadav@gmail.com>

Hi All,

On 05/02/22 12:14, Raag Jadav wrote:
> Enable MAC SerDes autonegotiation to distinguish between
> 1000BASE-X, SGMII and QSGMII MAC.
> 
> Signed-off-by: Raag Jadav <raagjadav@gmail.com>
> ---
>   drivers/net/phy/mscc/mscc.h      |  2 ++
>   drivers/net/phy/mscc/mscc_main.c | 24 ++++++++++++++++++++++++
>   2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
> index a50235f..366db14 100644
> --- a/drivers/net/phy/mscc/mscc.h
> +++ b/drivers/net/phy/mscc/mscc.h
> @@ -195,6 +195,8 @@ enum rgmii_clock_delay {
>   #define MSCC_PHY_EXTENDED_INT_MS_EGR	  BIT(9)
>   
>   /* Extended Page 3 Registers */
> +#define MSCC_PHY_SERDES_PCS_CTRL	  16
> +#define MSCC_PHY_SERDES_ANEG		  BIT(7)
>   #define MSCC_PHY_SERDES_TX_VALID_CNT	  21
>   #define MSCC_PHY_SERDES_TX_CRC_ERR_CNT	  22
>   #define MSCC_PHY_SERDES_RX_VALID_CNT	  28
> diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> index ebfeeb3..6db43a5 100644
> --- a/drivers/net/phy/mscc/mscc_main.c
> +++ b/drivers/net/phy/mscc/mscc_main.c
> @@ -1685,6 +1685,25 @@ static int vsc8574_config_host_serdes(struct phy_device *phydev)
>   			   PROC_CMD_RST_CONF_PORT | PROC_CMD_FIBER_1000BASE_X);
>   }
>   
> +static int vsc85xx_config_inband_aneg(struct phy_device *phydev, bool enabled)
> +{
> +	int rc;
> +	u16 reg_val = 0;
> +
> +	if (enabled)
> +		reg_val = MSCC_PHY_SERDES_ANEG;
> +
> +	mutex_lock(&phydev->lock);
> +
> +	rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_3,
> +			      MSCC_PHY_SERDES_PCS_CTRL, MSCC_PHY_SERDES_ANEG,
> +			      reg_val);
> +
> +	mutex_unlock(&phydev->lock);
> +
> +	return rc;
> +}
> +
>   static int vsc8584_config_init(struct phy_device *phydev)
>   {
>   	struct vsc8531_private *vsc8531 = phydev->priv;
> @@ -1772,6 +1791,11 @@ static int vsc8584_config_init(struct phy_device *phydev)
>   					      VSC8572_RGMII_TX_DELAY_MASK);
>   		if (ret)
>   			return ret;
> +	} else {
> +		/* Enable clause 37 */
> +		ret = vsc85xx_config_inband_aneg(phydev, true);
> +		if (ret)
> +			return ret;
>   	}
>   
>   	ret = genphy_soft_reset(phydev);

The same auto-negotiation configuration is also required for VSC8514.
The following patch is required to get Ethernet working with the Quad
port Ethernet Add-On card (QSGMII mode) connected to Texas Instruments
J7 common processor board.

Let me know if I should send it as a separate patch.

Thanks and Regards,
Siddharth Vadapalli.

8<------------------SNIP----------------------------

 From 2ab92251ba7a09bc97476cef6c760beefb0d3cae Mon Sep 17 00:00:00 2001
From: Siddharth Vadapalli <s-vadapalli@ti.com>
Date: Thu, 17 Feb 2022 15:45:20 +0530
Subject: [PATCH] net: phy: mscc: Add auto-negotiation feature to VSC8514

Auto-negotiation is currently enabled for VSC8584. It is also required
for VSC8514. Invoke the vsc85xx_config_inband_aneg() function from the
vsc8514_config_init() function present in mscc_main.c to start the
auto-negotiation process. This is required to get Ethernet working with
the Quad port Ethernet Add-On card (QSGMII mode) connected to Texas
Instruments J7 common processor board.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---
  drivers/net/phy/mscc/mscc_main.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/drivers/net/phy/mscc/mscc_main.c 
b/drivers/net/phy/mscc/mscc_main.c
index 6db43a5c3b5e..b9a5662e7934 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -2119,6 +2119,11 @@ static int vsc8514_config_init(struct phy_device 
*phydev)

  	ret = genphy_soft_reset(phydev);

+	if (ret)
+		return ret;
+
+	ret = vsc85xx_config_inband_aneg(phydev, true);
+
  	if (ret)
  		return ret;

  parent reply	other threads:[~2022-02-24 10:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05  6:44 [PATCH] net: phy: mscc: enable MAC SerDes autonegotiation Raag Jadav
2022-02-05 14:57 ` Andrew Lunn
2022-02-06 17:12   ` Raag Jadav
2022-02-06 17:18     ` Russell King (Oracle)
2022-02-06 18:01     ` Andrew Lunn
2022-02-07 17:49       ` Raag Jadav
2022-02-08  2:09         ` Andrew Lunn
2022-02-08 15:57           ` Raag Jadav
2022-02-08 16:01             ` Russell King (Oracle)
2022-02-08 19:12             ` Andrew Lunn
2022-02-10 16:48               ` Raag Jadav
2022-02-08  9:45         ` Russell King (Oracle)
2022-02-08 15:53           ` Raag Jadav
2022-02-24 10:41 ` Siddharth Narayan Vadapalli [this message]
2022-02-24 10:48 ` Russell King (Oracle)
2022-02-26  7:23   ` Raag Jadav
2022-02-26 16:31     ` Russell King (Oracle)
2022-03-27  8:32       ` Raag Jadav
2022-03-24 10:06     ` Siddharth Vadapalli
2022-03-27  8:30       ` Raag Jadav
2022-03-28  8:13         ` Siddharth Vadapalli

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=220e82d4-1c20-c540-7dcf-a8fb25f8935d@ti.com \
    --to=s-vadapalli@ti.com \
    --cc=andrew@lunn.ch \
    --cc=bjarni.jonasson@microchip.com \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kishon@ti.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=raagjadav@gmail.com \
    --cc=steen.hegelund@microchip.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 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).