* [PATCH] gianfar: Fix setup of RX time stamping
@ 2010-06-11 11:49 Manfred Rudigier
2010-06-11 12:20 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: Manfred Rudigier @ 2010-06-11 11:49 UTC (permalink / raw)
To: 'David Miller'
Cc: 'netdev@vger.kernel.org', 'Anton Vorontsov',
Richard Cochran, 'linuxppc-dev@ozlabs.org'
Previously the RCTRL_TS_ENABLE bit was set unconditionally. However, if
the RCTRL_TS_ENABLE is set without TMR_CTRL[TE], the driver does not work
properly on some boards (Anton had problems with the MPC8313ERDB and
MPC8568EMDS).
With this patch the bit will only be set if requested from user space
with the SIOCSHWTSTAMP ioctl command, meaning that time stamping is
disabled during normal operation. Users who are not interested in time
stamps will not experience problems with buggy CPU revisions or
performance drops any more.
The setting of TMR_CTRL[TE] is still up to the user. This is considered
safe because users wanting HW timestamps must initialize the eTSEC clock
first anyway, e.g. with the recently submitted PTP clock driver.
Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
---
drivers/net/gianfar.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 46c69cd..227b628 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -381,10 +381,14 @@ static void gfar_init_mac(struct net_device *ndev)
/* Insert receive time stamps into padding alignment bytes */
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) {
rctrl &=3D ~RCTRL_PAL_MASK;
- rctrl |=3D RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8);
+ rctrl |=3D RCTRL_PADDING(8);
priv->padding =3D 8;
}
=20
+ /* Enable HW time stamping if requested from user space */
+ if (priv->hwts_rx_en)
+ rctrl |=3D RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE;
+
/* keep vlan related bits if it's enabled */
if (priv->vlgrp) {
rctrl |=3D RCTRL_VLEX | RCTRL_PRSDEP_INIT;
@@ -747,7 +751,8 @@ static int gfar_of_init(struct of_device *ofdev, struct=
net_device **pdev)
FSL_GIANFAR_DEV_HAS_CSUM |
FSL_GIANFAR_DEV_HAS_VLAN |
FSL_GIANFAR_DEV_HAS_MAGIC_PACKET |
- FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
+ FSL_GIANFAR_DEV_HAS_EXTENDED_HASH |
+ FSL_GIANFAR_DEV_HAS_TIMER;
=20
ctype =3D of_get_property(np, "phy-connection-type", NULL);
=20
@@ -805,12 +810,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *net=
dev,
=20
switch (config.rx_filter) {
case HWTSTAMP_FILTER_NONE:
- priv->hwts_rx_en =3D 0;
+ if (priv->hwts_rx_en) {
+ stop_gfar(netdev);
+ priv->hwts_rx_en =3D 0;
+ startup_gfar(netdev);
+ }
break;
default:
if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER))
return -ERANGE;
- priv->hwts_rx_en =3D 1;
+ if (!priv->hwts_rx_en) {
+ stop_gfar(netdev);
+ priv->hwts_rx_en =3D 1;
+ startup_gfar(netdev);
+ }
config.rx_filter =3D HWTSTAMP_FILTER_ALL;
break;
}
--=20
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gianfar: Fix setup of RX time stamping
2010-06-11 11:49 [PATCH] gianfar: Fix setup of RX time stamping Manfred Rudigier
@ 2010-06-11 12:20 ` Anton Vorontsov
2010-06-16 21:40 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Anton Vorontsov @ 2010-06-11 12:20 UTC (permalink / raw)
To: Manfred Rudigier
Cc: 'netdev@vger.kernel.org', Richard Cochran,
'David Miller', 'linuxppc-dev@ozlabs.org'
On Fri, Jun 11, 2010 at 01:49:05PM +0200, Manfred Rudigier wrote:
> Previously the RCTRL_TS_ENABLE bit was set unconditionally. However, if
> the RCTRL_TS_ENABLE is set without TMR_CTRL[TE], the driver does not work
> properly on some boards (Anton had problems with the MPC8313ERDB and
> MPC8568EMDS).
>
> With this patch the bit will only be set if requested from user space
> with the SIOCSHWTSTAMP ioctl command, meaning that time stamping is
> disabled during normal operation. Users who are not interested in time
> stamps will not experience problems with buggy CPU revisions or
> performance drops any more.
>
> The setting of TMR_CTRL[TE] is still up to the user. This is considered
> safe because users wanting HW timestamps must initialize the eTSEC clock
> first anyway, e.g. with the recently submitted PTP clock driver.
>
> Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
> ---
Looks OK. I tested that it doesn't break anything, but I didn't
test the timestamping functionality. So
Reviewed-by: Anton Vorontsov <cbouatmailru@gmail.com>
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gianfar: Fix setup of RX time stamping
2010-06-11 12:20 ` Anton Vorontsov
@ 2010-06-16 21:40 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-06-16 21:40 UTC (permalink / raw)
To: cbouatmailru; +Cc: netdev, richard.cochran, Manfred.Rudigier, linuxppc-dev
From: Anton Vorontsov <cbouatmailru@gmail.com>
Date: Fri, 11 Jun 2010 16:20:23 +0400
> On Fri, Jun 11, 2010 at 01:49:05PM +0200, Manfred Rudigier wrote:
>> Previously the RCTRL_TS_ENABLE bit was set unconditionally. However, if
>> the RCTRL_TS_ENABLE is set without TMR_CTRL[TE], the driver does not work
>> properly on some boards (Anton had problems with the MPC8313ERDB and
>> MPC8568EMDS).
>>
>> With this patch the bit will only be set if requested from user space
>> with the SIOCSHWTSTAMP ioctl command, meaning that time stamping is
>> disabled during normal operation. Users who are not interested in time
>> stamps will not experience problems with buggy CPU revisions or
>> performance drops any more.
>>
>> The setting of TMR_CTRL[TE] is still up to the user. This is considered
>> safe because users wanting HW timestamps must initialize the eTSEC clock
>> first anyway, e.g. with the recently submitted PTP clock driver.
>>
>> Signed-off-by: Manfred Rudigier <manfred.rudigier@omicron.at>
>> ---
>
> Looks OK. I tested that it doesn't break anything, but I didn't
> test the timestamping functionality. So
>
> Reviewed-by: Anton Vorontsov <cbouatmailru@gmail.com>
Applied, thanks guys.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-16 21:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11 11:49 [PATCH] gianfar: Fix setup of RX time stamping Manfred Rudigier
2010-06-11 12:20 ` Anton Vorontsov
2010-06-16 21:40 ` 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).