[net-next,v3,3/3] phy: mscc: Add support for VSC8531_02

Message ID 20230511120808.28646-4-harini.katakam@amd.com
State New
Headers
Series Add support for VSC8531_02 PHY and DT RGMII tuning |

Commit Message

Harini Katakam May 11, 2023, 12:08 p.m. UTC
  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(-)
  

Comments

Andrew Lunn May 11, 2023, 2:11 p.m. UTC | #1
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
  
Andrew Lunn May 11, 2023, 2:16 p.m. UTC | #2
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
  
Harini Katakam May 11, 2023, 4:17 p.m. UTC | #3
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
  

Patch

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",