* [PATCH net] phy: mscc: Fix PTP for vsc8574 and VSC8572
@ 2025-09-15 8:01 Horatiu Vultur
2025-09-16 13:32 ` Paolo Abeni
0 siblings, 1 reply; 3+ messages in thread
From: Horatiu Vultur @ 2025-09-15 8:01 UTC (permalink / raw)
To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
richardcochran, vladimir.oltean, vadim.fedorenko, rosenp,
rmk+kernel, christophe.jaillet, steen.hegelund
Cc: netdev, linux-kernel, Horatiu Vultur
When trying to enable PTP on vsc8574 and vsc8572 it is not working even
if the function vsc8584_ptp_init it says that it has support for PHY
timestamping. It is not working because there is no PTP device.
So, to fix this make sure to create a PTP device also for this PHYs as
they have the same PTP IP as the other vsc PHYs.
Fixes: 774626fa440e ("net: phy: mscc: Add PTP support for 2 more VSC PHYs")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
drivers/net/phy/mscc/mscc_main.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index ef0ef1570d392..89b5cd96e8720 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -2259,6 +2259,7 @@ static int vsc8574_probe(struct phy_device *phydev)
u32 default_mode[4] = {VSC8531_LINK_1000_ACTIVITY,
VSC8531_LINK_100_ACTIVITY, VSC8531_LINK_ACTIVITY,
VSC8531_DUPLEX_COLLISION};
+ int ret;
vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL);
if (!vsc8531)
@@ -2267,8 +2268,11 @@ static int vsc8574_probe(struct phy_device *phydev)
phydev->priv = vsc8531;
vsc8584_get_base_addr(phydev);
- devm_phy_package_join(&phydev->mdio.dev, phydev,
- vsc8531->base_addr, 0);
+ ret = devm_phy_package_join(&phydev->mdio.dev, phydev,
+ vsc8531->base_addr,
+ sizeof(struct vsc85xx_shared_private));
+ if (ret)
+ return ret;
vsc8531->nleds = 4;
vsc8531->supp_led_modes = VSC8584_SUPP_LED_MODES;
@@ -2279,6 +2283,16 @@ static int vsc8574_probe(struct phy_device *phydev)
if (!vsc8531->stats)
return -ENOMEM;
+ if (phy_package_probe_once(phydev)) {
+ ret = vsc8584_ptp_probe_once(phydev);
+ if (ret)
+ return ret;
+ }
+
+ ret = vsc8584_ptp_probe(phydev);
+ if (ret)
+ return ret;
+
return vsc85xx_dt_led_modes_get(phydev, default_mode);
}
@@ -2648,7 +2662,7 @@ static struct phy_driver vsc85xx_driver[] = {
.config_aneg = &vsc85xx_config_aneg,
.aneg_done = &genphy_aneg_done,
.read_status = &vsc85xx_read_status,
- .handle_interrupt = vsc85xx_handle_interrupt,
+ .handle_interrupt = vsc8584_handle_interrupt,
.config_intr = &vsc85xx_config_intr,
.suspend = &genphy_suspend,
.resume = &genphy_resume,
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] phy: mscc: Fix PTP for vsc8574 and VSC8572
2025-09-15 8:01 [PATCH net] phy: mscc: Fix PTP for vsc8574 and VSC8572 Horatiu Vultur
@ 2025-09-16 13:32 ` Paolo Abeni
2025-09-17 7:46 ` Horatiu Vultur
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2025-09-16 13:32 UTC (permalink / raw)
To: Horatiu Vultur, andrew, hkallweit1, linux, davem, edumazet, kuba,
richardcochran, vladimir.oltean, vadim.fedorenko, rosenp,
rmk+kernel, christophe.jaillet, steen.hegelund
Cc: netdev, linux-kernel
On 9/15/25 10:01 AM, Horatiu Vultur wrote:
> When trying to enable PTP on vsc8574 and vsc8572 it is not working even
> if the function vsc8584_ptp_init it says that it has support for PHY
> timestamping. It is not working because there is no PTP device.
> So, to fix this make sure to create a PTP device also for this PHYs as
> they have the same PTP IP as the other vsc PHYs.
[...]
> diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> index ef0ef1570d392..89b5cd96e8720 100644
> --- a/drivers/net/phy/mscc/mscc_main.c
> +++ b/drivers/net/phy/mscc/mscc_main.c
> @@ -2259,6 +2259,7 @@ static int vsc8574_probe(struct phy_device *phydev)
> u32 default_mode[4] = {VSC8531_LINK_1000_ACTIVITY,
> VSC8531_LINK_100_ACTIVITY, VSC8531_LINK_ACTIVITY,
> VSC8531_DUPLEX_COLLISION};
> + int ret;
>
> vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL);
> if (!vsc8531)
vsc8574_probe() is also used by 8504 and 8552, is the side effect intended?
/P
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] phy: mscc: Fix PTP for vsc8574 and VSC8572
2025-09-16 13:32 ` Paolo Abeni
@ 2025-09-17 7:46 ` Horatiu Vultur
0 siblings, 0 replies; 3+ messages in thread
From: Horatiu Vultur @ 2025-09-17 7:46 UTC (permalink / raw)
To: Paolo Abeni
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, richardcochran,
vladimir.oltean, vadim.fedorenko, rosenp, rmk+kernel,
christophe.jaillet, steen.hegelund, netdev, linux-kernel
The 09/16/2025 15:32, Paolo Abeni wrote:
Hi Paolo,
>
> On 9/15/25 10:01 AM, Horatiu Vultur wrote:
> > When trying to enable PTP on vsc8574 and vsc8572 it is not working even
> > if the function vsc8584_ptp_init it says that it has support for PHY
> > timestamping. It is not working because there is no PTP device.
> > So, to fix this make sure to create a PTP device also for this PHYs as
> > they have the same PTP IP as the other vsc PHYs.
>
> [...]
>
> > diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> > index ef0ef1570d392..89b5cd96e8720 100644
> > --- a/drivers/net/phy/mscc/mscc_main.c
> > +++ b/drivers/net/phy/mscc/mscc_main.c
> > @@ -2259,6 +2259,7 @@ static int vsc8574_probe(struct phy_device *phydev)
> > u32 default_mode[4] = {VSC8531_LINK_1000_ACTIVITY,
> > VSC8531_LINK_100_ACTIVITY, VSC8531_LINK_ACTIVITY,
> > VSC8531_DUPLEX_COLLISION};
> > + int ret;
> >
> > vsc8531 = devm_kzalloc(&phydev->mdio.dev, sizeof(*vsc8531), GFP_KERNEL);
> > if (!vsc8531)
>
> vsc8574_probe() is also used by 8504 and 8552, is the side effect intended?
No, that side effect is not intended because I have checked the vsc8552
and vsc8504 datasheet and I couldn't find anything about timestamping.
So this is a mistake.
My first thought was to use vsc8514_probe for these devices but this
will introduce another side effect as the statistics will be different.
So, I will need to create another probe function for these 2 devices.
>
> /P
>
--
/Horatiu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-17 7:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-15 8:01 [PATCH net] phy: mscc: Fix PTP for vsc8574 and VSC8572 Horatiu Vultur
2025-09-16 13:32 ` Paolo Abeni
2025-09-17 7:46 ` Horatiu Vultur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®