* [PATCH] net:phy:dp83640: Initialize PTP clocks at device init.
@ 2014-02-03 14:36 Stefan Sørensen
2014-02-03 16:33 ` Richard Cochran
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Sørensen @ 2014-02-03 14:36 UTC (permalink / raw)
To: richardcochran, netdev; +Cc: Stefan Sørensen
The trigger and events functionality can be useful even if packet
timestamping is not used, but the required PTP clock is only enabled
when packet timestamping is started. This patch moves the clock enable
to when the interface is configured.
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
drivers/net/phy/dp83640.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 80c5fc8..14616e4 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -1064,6 +1064,13 @@ static void dp83640_remove(struct phy_device *phydev)
kfree(dp83640);
}
+static int dp83640_config_init(struct phy_device *phydev)
+{
+ enable_status_frames(phydev, true);
+ ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
+ return 0;
+}
+
static int dp83640_ack_interrupt(struct phy_device *phydev)
{
int err = phy_read(phydev, MII_DP83640_MISR);
@@ -1201,11 +1208,6 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
mutex_lock(&dp83640->clock->extreg_lock);
- if (dp83640->hwts_tx_en || dp83640->hwts_rx_en) {
- enable_status_frames(phydev, true);
- ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
- }
-
ext_write(0, phydev, PAGE5, PTP_TXCFG0, txcfg0);
ext_write(0, phydev, PAGE5, PTP_RXCFG0, rxcfg0);
@@ -1337,6 +1339,7 @@ static struct phy_driver dp83640_driver = {
.flags = PHY_HAS_INTERRUPT,
.probe = dp83640_probe,
.remove = dp83640_remove,
+ .config_init = dp83640_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.ack_interrupt = dp83640_ack_interrupt,
--
1.8.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net:phy:dp83640: Initialize PTP clocks at device init.
2014-02-03 14:36 [PATCH] net:phy:dp83640: Initialize PTP clocks at device init Stefan Sørensen
@ 2014-02-03 16:33 ` Richard Cochran
2014-02-04 8:04 ` Richard Cochran
2014-02-05 4:08 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Richard Cochran @ 2014-02-03 16:33 UTC (permalink / raw)
To: Stefan Sørensen; +Cc: netdev
On Mon, Feb 03, 2014 at 03:36:58PM +0100, Stefan Sørensen wrote:
> The trigger and events functionality can be useful even if packet
> timestamping is not used, but the required PTP clock is only enabled
> when packet timestamping is started. This patch moves the clock enable
> to when the interface is configured.
Hm, I vaguely recall that there might have been some reason not enable
the clock too early. (Maybe this was related to multiple PHYs?)
Quickly looking at the code once again, I can't see anything wrong with
this now, but I'll look at it again tomorrow.
Thanks,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net:phy:dp83640: Initialize PTP clocks at device init.
2014-02-03 14:36 [PATCH] net:phy:dp83640: Initialize PTP clocks at device init Stefan Sørensen
2014-02-03 16:33 ` Richard Cochran
@ 2014-02-04 8:04 ` Richard Cochran
2014-02-05 4:08 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Richard Cochran @ 2014-02-04 8:04 UTC (permalink / raw)
To: Stefan Sørensen; +Cc: netdev
On Mon, Feb 03, 2014 at 03:36:58PM +0100, Stefan Sørensen wrote:
> The trigger and events functionality can be useful even if packet
> timestamping is not used, but the required PTP clock is only enabled
> when packet timestamping is started. This patch moves the clock enable
> to when the interface is configured.
I looked in the code and in the docs, and I can't find any reason not
to enable the clock earlier.
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net:phy:dp83640: Initialize PTP clocks at device init.
2014-02-03 14:36 [PATCH] net:phy:dp83640: Initialize PTP clocks at device init Stefan Sørensen
2014-02-03 16:33 ` Richard Cochran
2014-02-04 8:04 ` Richard Cochran
@ 2014-02-05 4:08 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-02-05 4:08 UTC (permalink / raw)
To: stefan.sorensen; +Cc: richardcochran, netdev
From: Stefan Sørensen <stefan.sorensen@spectralink.com>
Date: Mon, 3 Feb 2014 15:36:58 +0100
> The trigger and events functionality can be useful even if packet
> timestamping is not used, but the required PTP clock is only enabled
> when packet timestamping is started. This patch moves the clock enable
> to when the interface is configured.
>
> Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-05 4:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-03 14:36 [PATCH] net:phy:dp83640: Initialize PTP clocks at device init Stefan Sørensen
2014-02-03 16:33 ` Richard Cochran
2014-02-04 8:04 ` Richard Cochran
2014-02-05 4:08 ` David Miller
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).