mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning
@ 2023-05-11 12:08 Harini Katakam
  2023-05-11 12:08 ` [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Harini Katakam @ 2023-05-11 12:08 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl
  Cc: netdev, linux-kernel, harinikatakamlinux, michal.simek,
	harini.katakam, radhey.shyam.pandey

Add support for VSC8531_02 PHY ID.
Also provide an option to change RGMII delay value via devicetree.

v3 changes:
- Remove patch 2/3 from v2 as custom mscc properties dont need to be
defined. rx-internal-delay-ps and tx-internal-delay-ps can be used.
- Change RGMII delay precedence as advised by Vladimir:
 phy-mode                       rgmii                          rgmii-rxid/rgmii-id
 --------------------------------------------------------------------------------------------
 rx-internal-delay-ps absent    0.2 ns                         2 ns
 rx-internal-delay-ps present   follow rx-internal-delay-ps    follow rx-internal-delay-ps
- Split VSC8531-02 and RGMII delay config into separate patches.
- Correct vendor ID
- Update commit description and subject everywhere to say RGMII delays
instead of RGMII tuning.

v2 changes:
- Added patch to use a common vendor phy id match
- Removed dt include header patch because delays should be specied in
ps, not register values
- Updated DT binding description and commit for optional delay tuning to
be clearer on the precedence
- Updated dt property name to include vendor instead of phy device name
- Switch both VSC8531 and VSC8531-02 to use exact phy id match as they
share the same model number
- Ensure RCT
- Improve optional property read


Harini Katakam (3):
  phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table
  phy: mscc: Add support for RGMII delay configuration
  phy: mscc: Add support for VSC8531_02

 drivers/net/phy/mscc/mscc.h      |  4 ++
 drivers/net/phy/mscc/mscc_main.c | 75 ++++++++++++++++++++++----------
 2 files changed, 57 insertions(+), 22 deletions(-)

-- 
2.17.1


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

* [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table
  2023-05-11 12:08 [PATCH net-next v3 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning Harini Katakam
@ 2023-05-11 12:08 ` Harini Katakam
  2023-05-11 14:05   ` Andrew Lunn
  2023-05-11 12:08 ` [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration Harini Katakam
  2023-05-11 12:08 ` [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02 Harini Katakam
  2 siblings, 1 reply; 10+ messages in thread
From: Harini Katakam @ 2023-05-11 12:08 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl
  Cc: netdev, linux-kernel, harinikatakamlinux, michal.simek,
	harini.katakam, radhey.shyam.pandey

All the PHY devices variants specified have the same mask and
hence can be simplified to one vendor look up for 0x00070400.
Any individual config can be identified by PHY_ID_MATCH_EXACT
in the respective structure.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
---
v3:
Correct vendor ID
v2:
New patch
 drivers/net/phy/mscc/mscc.h      |  1 +
 drivers/net/phy/mscc/mscc_main.c | 14 +-------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
index a50235fdf7d9..9acee8759105 100644
--- a/drivers/net/phy/mscc/mscc.h
+++ b/drivers/net/phy/mscc/mscc.h
@@ -290,6 +290,7 @@ enum rgmii_clock_delay {
 #define PHY_ID_VSC8575			  0x000707d0
 #define PHY_ID_VSC8582			  0x000707b0
 #define PHY_ID_VSC8584			  0x000707c0
+#define PHY_VENDOR_MSCC			0x00070400
 
 #define MSCC_VDDMAC_1500		  1500
 #define MSCC_VDDMAC_1800		  1800
diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 62bf99e45af1..91010524e03d 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -2656,19 +2656,7 @@ static struct phy_driver vsc85xx_driver[] = {
 module_phy_driver(vsc85xx_driver);
 
 static struct mdio_device_id __maybe_unused vsc85xx_tbl[] = {
-	{ PHY_ID_VSC8504, 0xfffffff0, },
-	{ PHY_ID_VSC8514, 0xfffffff0, },
-	{ PHY_ID_VSC8530, 0xfffffff0, },
-	{ PHY_ID_VSC8531, 0xfffffff0, },
-	{ PHY_ID_VSC8540, 0xfffffff0, },
-	{ PHY_ID_VSC8541, 0xfffffff0, },
-	{ PHY_ID_VSC8552, 0xfffffff0, },
-	{ PHY_ID_VSC856X, 0xfffffff0, },
-	{ PHY_ID_VSC8572, 0xfffffff0, },
-	{ PHY_ID_VSC8574, 0xfffffff0, },
-	{ PHY_ID_VSC8575, 0xfffffff0, },
-	{ PHY_ID_VSC8582, 0xfffffff0, },
-	{ PHY_ID_VSC8584, 0xfffffff0, },
+	{ PHY_ID_MATCH_VENDOR(PHY_VENDOR_MSCC) },
 	{ }
 };
 
-- 
2.17.1


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

* [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration
  2023-05-11 12:08 [PATCH net-next v3 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning Harini Katakam
  2023-05-11 12:08 ` [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
@ 2023-05-11 12:08 ` Harini Katakam
  2023-05-11 14:00   ` Simon Horman
  2023-05-13 18:23   ` kernel test robot
  2023-05-11 12:08 ` [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02 Harini Katakam
  2 siblings, 2 replies; 10+ messages in thread
From: Harini Katakam @ 2023-05-11 12:08 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl
  Cc: netdev, linux-kernel, harinikatakamlinux, michal.simek,
	harini.katakam, radhey.shyam.pandey

Add support for optional rx/tx-internal-delay-ps from devicetree.
- When rx/tx-internal-delay-ps is/are specified, these take priority
- When either is absent,
1) use 2ns for respective settings if rgmii-id/rxid/txid is/are present
2) use 0.2ns for respective settings if mode is rgmii

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
---
v3 - Patch split:
- Use rx/tx-internal-delay-ps with phy_get_internal_delay
- Change RGMII delay selection precedence
- Update commit description and subject everywhere to say RGMII delays
instead of RGMII tuning.

 drivers/net/phy/mscc/mscc.h      |  2 ++
 drivers/net/phy/mscc/mscc_main.c | 35 +++++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
index 9acee8759105..ab6c0b7c2136 100644
--- a/drivers/net/phy/mscc/mscc.h
+++ b/drivers/net/phy/mscc/mscc.h
@@ -374,6 +374,8 @@ struct vsc8531_private {
 	 * package.
 	 */
 	unsigned int base_addr;
+	u32 rx_delay;
+	u32 tx_delay;
 
 #if IS_ENABLED(CONFIG_MACSEC)
 	/* MACsec fields:
diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 91010524e03d..9e856231e464 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -525,17 +525,14 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl,
 {
 	u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1;
 	u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1;
+	struct vsc8531_private *vsc8531 = phydev->priv;
 	u16 reg_val = 0;
 	int rc;
 
 	mutex_lock(&phydev->lock);
 
-	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
-	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
-		reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_rx_delay_pos;
-	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
-	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
-		reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_tx_delay_pos;
+	reg_val |= vsc8531->rx_delay << rgmii_rx_delay_pos;
+	reg_val |= vsc8531->tx_delay << rgmii_tx_delay_pos;
 
 	rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2,
 			      rgmii_cntl,
@@ -1808,10 +1805,34 @@ static irqreturn_t vsc8584_handle_interrupt(struct phy_device *phydev)
 	return IRQ_HANDLED;
 }
 
+static const int vsc8531_internal_delay[] = {200, 800, 1100, 1700, 2000, 2300,
+					     2600, 3400};
 static int vsc85xx_config_init(struct phy_device *phydev)
 {
-	int rc, i, phy_id;
+	int delay_size = ARRAY_SIZE(vsc8531_internal_delay);
 	struct vsc8531_private *vsc8531 = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	int rc, i, phy_id;
+
+	vsc8531->rx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
+						   delay_size, true);
+	if (vsc8531->rx_delay < 0) {
+		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
+		    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+			vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
+		else
+			vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
+	}
+
+	vsc8531->tx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
+						   delay_size, false);
+	if (vsc8531->tx_delay < 0) {
+		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
+		    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
+			vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
+		else
+			vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
+	}
 
 	rc = vsc85xx_default_config(phydev);
 	if (rc)
-- 
2.17.1


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

* [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02
  2023-05-11 12:08 [PATCH net-next v3 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning Harini Katakam
  2023-05-11 12:08 ` [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
  2023-05-11 12:08 ` [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration Harini Katakam
@ 2023-05-11 12:08 ` Harini Katakam
  2023-05-11 14:11   ` Andrew Lunn
  2023-05-11 14:16   ` Andrew Lunn
  2 siblings, 2 replies; 10+ messages in thread
From: Harini Katakam @ 2023-05-11 12:08 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl
  Cc: netdev, linux-kernel, harinikatakamlinux, michal.simek,
	harini.katakam, radhey.shyam.pandey

Add support for VSC8531_02 (Rev 2) device. Use exact PHY ID match.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
---
v3 - Patch split

 drivers/net/phy/mscc/mscc.h      |  1 +
 drivers/net/phy/mscc/mscc_main.c | 26 ++++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
index ab6c0b7c2136..6a0521ff61d2 100644
--- a/drivers/net/phy/mscc/mscc.h
+++ b/drivers/net/phy/mscc/mscc.h
@@ -281,6 +281,7 @@ enum rgmii_clock_delay {
 #define PHY_ID_VSC8514			  0x00070670
 #define PHY_ID_VSC8530			  0x00070560
 #define PHY_ID_VSC8531			  0x00070570
+#define PHY_ID_VSC8531_02		  0x00070572
 #define PHY_ID_VSC8540			  0x00070760
 #define PHY_ID_VSC8541			  0x00070770
 #define PHY_ID_VSC8552			  0x000704e0
diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 9e856231e464..aa1df69043e5 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -2434,9 +2434,8 @@ static struct phy_driver vsc85xx_driver[] = {
 	.get_stats      = &vsc85xx_get_stats,
 },
 {
-	.phy_id		= PHY_ID_VSC8531,
+	PHY_ID_MATCH_EXACT(PHY_ID_VSC8531),
 	.name		= "Microsemi VSC8531",
-	.phy_id_mask    = 0xfffffff0,
 	/* PHY_GBIT_FEATURES */
 	.soft_reset	= &genphy_soft_reset,
 	.config_init    = &vsc85xx_config_init,
@@ -2457,6 +2456,29 @@ static struct phy_driver vsc85xx_driver[] = {
 	.get_strings    = &vsc85xx_get_strings,
 	.get_stats      = &vsc85xx_get_stats,
 },
+{
+	PHY_ID_MATCH_EXACT(PHY_ID_VSC8531_02),
+	.name		= "Microsemi VSC8531-02",
+	/* PHY_GBIT_FEATURES */
+	.soft_reset	= &genphy_soft_reset,
+	.config_init	= &vsc85xx_config_init,
+	.config_aneg	= &vsc85xx_config_aneg,
+	.read_status	= &vsc85xx_read_status,
+	.handle_interrupt	= vsc85xx_handle_interrupt,
+	.config_intr	= &vsc85xx_config_intr,
+	.suspend	= &genphy_suspend,
+	.resume		= &genphy_resume,
+	.probe		= &vsc85xx_probe,
+	.set_wol	= &vsc85xx_wol_set,
+	.get_wol	= &vsc85xx_wol_get,
+	.get_tunable	= &vsc85xx_get_tunable,
+	.set_tunable	= &vsc85xx_set_tunable,
+	.read_page	= &vsc85xx_phy_read_page,
+	.write_page	= &vsc85xx_phy_write_page,
+	.get_sset_count = &vsc85xx_get_sset_count,
+	.get_strings	= &vsc85xx_get_strings,
+	.get_stats	= &vsc85xx_get_stats,
+},
 {
 	.phy_id		= PHY_ID_VSC8540,
 	.name		= "Microsemi FE VSC8540 SyncE",
-- 
2.17.1


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

* Re: [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration
  2023-05-11 12:08 ` [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration Harini Katakam
@ 2023-05-11 14:00   ` Simon Horman
  2023-05-13 18:23   ` kernel test robot
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Horman @ 2023-05-11 14:00 UTC (permalink / raw)
  To: Harini Katakam
  Cc: andrew, hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, mkl, netdev, linux-kernel,
	harinikatakamlinux, michal.simek, radhey.shyam.pandey

On Thu, May 11, 2023 at 05:38:07PM +0530, Harini Katakam wrote:
> Add support for optional rx/tx-internal-delay-ps from devicetree.
> - When rx/tx-internal-delay-ps is/are specified, these take priority
> - When either is absent,
> 1) use 2ns for respective settings if rgmii-id/rxid/txid is/are present
> 2) use 0.2ns for respective settings if mode is rgmii
> 
> Signed-off-by: Harini Katakam <harini.katakam@amd.com>
> ---
> v3 - Patch split:
> - Use rx/tx-internal-delay-ps with phy_get_internal_delay
> - Change RGMII delay selection precedence
> - Update commit description and subject everywhere to say RGMII delays
> instead of RGMII tuning.
> 
>  drivers/net/phy/mscc/mscc.h      |  2 ++
>  drivers/net/phy/mscc/mscc_main.c | 35 +++++++++++++++++++++++++-------
>  2 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
> index 9acee8759105..ab6c0b7c2136 100644
> --- a/drivers/net/phy/mscc/mscc.h
> +++ b/drivers/net/phy/mscc/mscc.h
> @@ -374,6 +374,8 @@ struct vsc8531_private {
>  	 * package.
>  	 */
>  	unsigned int base_addr;
> +	u32 rx_delay;
> +	u32 tx_delay;

rx_delay and tx_delay are unsigned...

>  
>  #if IS_ENABLED(CONFIG_MACSEC)
>  	/* MACsec fields:
> diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> index 91010524e03d..9e856231e464 100644
> --- a/drivers/net/phy/mscc/mscc_main.c
> +++ b/drivers/net/phy/mscc/mscc_main.c
> @@ -525,17 +525,14 @@ static int vsc85xx_rgmii_set_skews(struct phy_device *phydev, u32 rgmii_cntl,
>  {
>  	u16 rgmii_rx_delay_pos = ffs(rgmii_rx_delay_mask) - 1;
>  	u16 rgmii_tx_delay_pos = ffs(rgmii_tx_delay_mask) - 1;
> +	struct vsc8531_private *vsc8531 = phydev->priv;
>  	u16 reg_val = 0;
>  	int rc;
>  
>  	mutex_lock(&phydev->lock);
>  
> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
> -	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> -		reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_rx_delay_pos;
> -	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> -	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> -		reg_val |= RGMII_CLK_DELAY_2_0_NS << rgmii_tx_delay_pos;
> +	reg_val |= vsc8531->rx_delay << rgmii_rx_delay_pos;
> +	reg_val |= vsc8531->tx_delay << rgmii_tx_delay_pos;
>  
>  	rc = phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED_2,
>  			      rgmii_cntl,
> @@ -1808,10 +1805,34 @@ static irqreturn_t vsc8584_handle_interrupt(struct phy_device *phydev)
>  	return IRQ_HANDLED;
>  }
>  
> +static const int vsc8531_internal_delay[] = {200, 800, 1100, 1700, 2000, 2300,
> +					     2600, 3400};
>  static int vsc85xx_config_init(struct phy_device *phydev)
>  {
> -	int rc, i, phy_id;
> +	int delay_size = ARRAY_SIZE(vsc8531_internal_delay);
>  	struct vsc8531_private *vsc8531 = phydev->priv;
> +	struct device *dev = &phydev->mdio.dev;
> +	int rc, i, phy_id;
> +
> +	vsc8531->rx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
> +						   delay_size, true);

But phy_get_internal_delay a signed value.

> +	if (vsc8531->rx_delay < 0) {

This comparison can never be true due to the unsigned type of rx_delay.

> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
> +		    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> +			vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
> +		else
> +			vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
> +	}
> +
> +	vsc8531->tx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
> +						   delay_size, false);
> +	if (vsc8531->tx_delay < 0) {

Here too.

> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
> +		    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
> +			vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
> +		else
> +			vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
> +	}
>  
>  	rc = vsc85xx_default_config(phydev);
>  	if (rc)

---
pw-bot: cr

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

* Re: [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table
  2023-05-11 12:08 ` [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
@ 2023-05-11 14:05   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2023-05-11 14:05 UTC (permalink / raw)
  To: Harini Katakam
  Cc: hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl, netdev,
	linux-kernel, harinikatakamlinux, michal.simek,
	radhey.shyam.pandey

On Thu, May 11, 2023 at 05:38:06PM +0530, Harini Katakam wrote:
> All the PHY devices variants specified have the same mask and
> hence can be simplified to one vendor look up for 0x00070400.
> Any individual config can be identified by PHY_ID_MATCH_EXACT
> in the respective structure.
> 
> Signed-off-by: Harini Katakam <harini.katakam@amd.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02
  2023-05-11 12:08 ` [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02 Harini Katakam
@ 2023-05-11 14:11   ` Andrew Lunn
  2023-05-11 16:17     ` Katakam, Harini
  2023-05-11 14:16   ` Andrew Lunn
  1 sibling, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2023-05-11 14:11 UTC (permalink / raw)
  To: Harini Katakam
  Cc: hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl, netdev,
	linux-kernel, harinikatakamlinux, michal.simek,
	radhey.shyam.pandey

On Thu, May 11, 2023 at 05:38:08PM +0530, Harini Katakam wrote:
> Add support for VSC8531_02 (Rev 2) device. Use exact PHY ID match.
> 
> Signed-off-by: Harini Katakam <harini.katakam@amd.com>
> ---
> v3 - Patch split
> 
>  drivers/net/phy/mscc/mscc.h      |  1 +
>  drivers/net/phy/mscc/mscc_main.c | 26 ++++++++++++++++++++++++--
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
> index ab6c0b7c2136..6a0521ff61d2 100644
> --- a/drivers/net/phy/mscc/mscc.h
> +++ b/drivers/net/phy/mscc/mscc.h
> @@ -281,6 +281,7 @@ enum rgmii_clock_delay {
>  #define PHY_ID_VSC8514			  0x00070670
>  #define PHY_ID_VSC8530			  0x00070560
>  #define PHY_ID_VSC8531			  0x00070570
> +#define PHY_ID_VSC8531_02		  0x00070572

Does PHY_ID_VSC8531_01 exist? The current code would support that,
where as now i don't think any entry will match.

      Andrew

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

* Re: [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02
  2023-05-11 12:08 ` [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02 Harini Katakam
  2023-05-11 14:11   ` Andrew Lunn
@ 2023-05-11 14:16   ` Andrew Lunn
  1 sibling, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2023-05-11 14:16 UTC (permalink / raw)
  To: Harini Katakam
  Cc: hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl, netdev,
	linux-kernel, harinikatakamlinux, michal.simek,
	radhey.shyam.pandey

On Thu, May 11, 2023 at 05:38:08PM +0530, Harini Katakam wrote:
> Add support for VSC8531_02 (Rev 2) device. Use exact PHY ID match.

Please add a comment:

Rev 2 requires its own entry so that...

Just to make it clear why the existing PHY_ID_VSC853/0xfffffff0 is not
sufficient.

	Andrew


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

* RE: [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02
  2023-05-11 14:11   ` Andrew Lunn
@ 2023-05-11 16:17     ` Katakam, Harini
  0 siblings, 0 replies; 10+ messages in thread
From: Katakam, Harini @ 2023-05-11 16:17 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: hkallweit1, linux, davem, kuba, edumazet, pabeni,
	vladimir.oltean, wsa+renesas, simon.horman, mkl, netdev,
	linux-kernel, harinikatakamlinux, Simek, Michal, Pandey,
	Radhey Shyam

Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, May 11, 2023 7:42 PM
> To: Katakam, Harini <harini.katakam@amd.com>
> Cc: hkallweit1@gmail.com; linux@armlinux.org.uk; davem@davemloft.net;
> kuba@kernel.org; edumazet@google.com; pabeni@redhat.com;
> vladimir.oltean@nxp.com; wsa+renesas@sang-engineering.com;
> simon.horman@corigine.com; mkl@pengutronix.de;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> harinikatakamlinux@gmail.com; Simek, Michal <michal.simek@amd.com>;
> Pandey, Radhey Shyam <radhey.shyam.pandey@amd.com>
> Subject: Re: [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02
> 
> On Thu, May 11, 2023 at 05:38:08PM +0530, Harini Katakam wrote:
> > Add support for VSC8531_02 (Rev 2) device. Use exact PHY ID match.
> >
> > Signed-off-by: Harini Katakam <harini.katakam@amd.com>
> > ---
> > v3 - Patch split
> >
> >  drivers/net/phy/mscc/mscc.h      |  1 +
> >  drivers/net/phy/mscc/mscc_main.c | 26 ++++++++++++++++++++++++--
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/phy/mscc/mscc.h b/drivers/net/phy/mscc/mscc.h
> > index ab6c0b7c2136..6a0521ff61d2 100644
> > --- a/drivers/net/phy/mscc/mscc.h
> > +++ b/drivers/net/phy/mscc/mscc.h
> > @@ -281,6 +281,7 @@ enum rgmii_clock_delay {
> >  #define PHY_ID_VSC8514			  0x00070670
> >  #define PHY_ID_VSC8530			  0x00070560
> >  #define PHY_ID_VSC8531			  0x00070570
> > +#define PHY_ID_VSC8531_02		  0x00070572
> 
> Does PHY_ID_VSC8531_01 exist? The current code would support that,
> where as now i don't think any entry will match.

Yes, PHY_ID_VSC8531_01 exists:
https://ww1.microchip.com/downloads/en/DeviceDoc/VMDS-10494.pdf
And I'm sorry I realize now that this patch breaks that version.

Also considering your RC on the other thread,
" Just to make it clear why the existing PHY_ID_VSC853/0xfffffff0 is not sufficient."
Currently there is no difference in the phy driver structure between
VSC8531 and VSC8531_02. Let me double check the identification on
my board and skip this patch if possible. The RGMII delay support in
2/3 is generic anyway.

Regards,
Harini


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

* Re: [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration
  2023-05-11 12:08 ` [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration Harini Katakam
  2023-05-11 14:00   ` Simon Horman
@ 2023-05-13 18:23   ` kernel test robot
  1 sibling, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-05-13 18:23 UTC (permalink / raw)
  To: Harini Katakam, andrew, hkallweit1, linux, davem, kuba, edumazet,
	pabeni, vladimir.oltean, wsa+renesas, simon.horman, mkl
  Cc: oe-kbuild-all, netdev, linux-kernel, harinikatakamlinux,
	michal.simek, harini.katakam, radhey.shyam.pandey

Hi Harini,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Harini-Katakam/phy-mscc-Use-PHY_ID_MATCH_VENDOR-to-minimize-PHY-ID-table/20230511-200935
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230511120808.28646-3-harini.katakam%40amd.com
patch subject: [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration
config: openrisc-randconfig-m041-20230509 (https://download.01.org/0day-ci/archive/20230514/202305140248.lh4LUw2j-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305140248.lh4LUw2j-lkp@intel.com/

smatch warnings:
drivers/net/phy/mscc/mscc_main.c:1819 vsc85xx_config_init() warn: unsigned 'vsc8531->rx_delay' is never less than zero.
drivers/net/phy/mscc/mscc_main.c:1829 vsc85xx_config_init() warn: unsigned 'vsc8531->tx_delay' is never less than zero.

vim +1819 drivers/net/phy/mscc/mscc_main.c

  1807	
  1808	static const int vsc8531_internal_delay[] = {200, 800, 1100, 1700, 2000, 2300,
  1809						     2600, 3400};
  1810	static int vsc85xx_config_init(struct phy_device *phydev)
  1811	{
  1812		int delay_size = ARRAY_SIZE(vsc8531_internal_delay);
  1813		struct vsc8531_private *vsc8531 = phydev->priv;
  1814		struct device *dev = &phydev->mdio.dev;
  1815		int rc, i, phy_id;
  1816	
  1817		vsc8531->rx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
  1818							   delay_size, true);
> 1819		if (vsc8531->rx_delay < 0) {
  1820			if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
  1821			    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
  1822				vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
  1823			else
  1824				vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
  1825		}
  1826	
  1827		vsc8531->tx_delay = phy_get_internal_delay(phydev, dev, &vsc8531_internal_delay[0],
  1828							   delay_size, false);
> 1829		if (vsc8531->tx_delay < 0) {
  1830			if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
  1831			    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
  1832				vsc8531->rx_delay = RGMII_CLK_DELAY_2_0_NS;
  1833			else
  1834				vsc8531->rx_delay = RGMII_CLK_DELAY_0_2_NS;
  1835		}
  1836	
  1837		rc = vsc85xx_default_config(phydev);
  1838		if (rc)
  1839			return rc;
  1840	
  1841		rc = vsc85xx_mac_if_set(phydev, phydev->interface);
  1842		if (rc)
  1843			return rc;
  1844	
  1845		rc = vsc85xx_edge_rate_cntl_set(phydev, vsc8531->rate_magic);
  1846		if (rc)
  1847			return rc;
  1848	
  1849		phy_id = phydev->drv->phy_id & phydev->drv->phy_id_mask;
  1850		if (PHY_ID_VSC8531 == phy_id || PHY_ID_VSC8541 == phy_id ||
  1851		    PHY_ID_VSC8530 == phy_id || PHY_ID_VSC8540 == phy_id) {
  1852			rc = vsc8531_pre_init_seq_set(phydev);
  1853			if (rc)
  1854				return rc;
  1855		}
  1856	
  1857		rc = vsc85xx_eee_init_seq_set(phydev);
  1858		if (rc)
  1859			return rc;
  1860	
  1861		for (i = 0; i < vsc8531->nleds; i++) {
  1862			rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]);
  1863			if (rc)
  1864				return rc;
  1865		}
  1866	
  1867		return 0;
  1868	}
  1869	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

end of thread, other threads:[~2023-05-13 18:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 12:08 [PATCH net-next v3 0/3] Add support for VSC8531_02 PHY and DT RGMII tuning Harini Katakam
2023-05-11 12:08 ` [PATCH net-next v3 1/3] phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID table Harini Katakam
2023-05-11 14:05   ` Andrew Lunn
2023-05-11 12:08 ` [PATCH net-next v3 2/3] phy: mscc: Add support for RGMII delay configuration Harini Katakam
2023-05-11 14:00   ` Simon Horman
2023-05-13 18:23   ` kernel test robot
2023-05-11 12:08 ` [PATCH net-next v3 3/3] phy: mscc: Add support for VSC8531_02 Harini Katakam
2023-05-11 14:11   ` Andrew Lunn
2023-05-11 16:17     ` Katakam, Harini
2023-05-11 14:16   ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome