Commit da722186f654 ("net: fec: set GPR bit on suspend by DT configuration.")
refactor the fec_devtype, need adjust ptp driver accordingly.
Fixes: da722186f654 ("net: fec: set GPR bit on suspend by DT configuration.")
Signed-off-by: Joakim Zhang <redacted>
---
drivers/net/ethernet/freescale/fec_ptp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
@@ -604,6 +604,10 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)fep->ptp_caps.enable=fec_ptp_enable;fep->cycle_speed=clk_get_rate(fep->clk_ptp);+if(!fep->cycle_speed){+fep->cycle_speed=NSEC_PER_SEC;+dev_err(&fep->pdev->dev,"clk_ptp clock rate is zero\n");
If this is supposed to be an error message, it doesn't convey that
something is really wrong to the user. Maybe something like this would
be more meaningful to the user:
"PTP clock rate should not be zero, using 1GHz instead. PTP
clock may be unreliable.\n"
It may be appropriate not to publish PTP support for the interface if
we don't have a valid clock rate, which is probably the safer approach
and would probably make the problem more noticable to the end user so
it gets fixed.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
If this is supposed to be an error message, it doesn't convey that something is
really wrong to the user. Maybe something like this would be more meaningful
to the user:
"PTP clock rate should not be zero, using 1GHz instead. PTP
clock may be unreliable.\n"
Make Sense.
It may be appropriate not to publish PTP support for the interface if we don't
have a valid clock rate, which is probably the safer approach and would
probably make the problem more noticable to the end user so it gets fixed.
Do you mean that print an error message then return directly? It seems better.
if (!fep->cycle_speed) {
dev_err(&fep->pdev->dev, "PTP clock rate should not be zero!\n");
return;
}
Best Regards,
Joakim Zhang
--
RMK's Patch system:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ar
mlinux.org.uk%2Fdeveloper%2Fpatches%2F&data=04%7C01%7Cqiangqin
g.zhang%40nxp.com%7Cb3c85322e359446e4eee08d930b06701%7C686ea1d3
bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637594356476903644%7CUnknow
n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1ha
WwiLCJXVCI6Mn0%3D%7C1000&sdata=TH4fZJRu8Ii6w7y05N8CHWoQR
R9OegsYB7VAwgSpTcU%3D&reserved=0
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
From: "Russell King (Oracle)" <linux@armlinux.org.uk> Date: 2021-06-16 13:29:14
Hi Joakim,
On Wed, Jun 16, 2021 at 11:40:29AM +0000, Joakim Zhang wrote:
Do you mean that print an error message then return directly? It seems better.
Nearly - one has to ensure that the cleanup functions don't provoke a
crash though. I notice fec_ptp_stop() makes use of fep->time_keep
and also fep->ptp_clock.
fep->time_keep is initialised after where you need to test for zero
cycle_speed, so the initialisation would need moving earlier.
I would have thought that ftp->ptp_clock should be NULL, so that's
probably okay, but should be checked that this assumption is in fact
true.
if (!fep->cycle_speed) {
dev_err(&fep->pdev->dev, "PTP clock rate should not be zero!\n");
I'd still say something like "PTP clock rate should not be zero,
disabling PTP" - say what's wrong and what we are doing. Also,
please avoid exclaimation marks in error messages.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!