Re: [PATCH] gianfar: Fix setup of RX time stamping

2010-06-16 Thread David Miller
From: Anton Vorontsov cbouatmai...@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.rudig...@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 cbouatmai...@gmail.com

Applied, thanks guys.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] gianfar: Fix setup of RX time stamping

2010-06-11 Thread Anton Vorontsov
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.rudig...@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 cbouatmai...@gmail.com

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] gianfar: Fix setup of RX time stamping

2010-06-11 Thread Manfred Rudigier
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.rudig...@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 = ~RCTRL_PAL_MASK;
-   rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8);
+   rctrl |= RCTRL_PADDING(8);
priv-padding = 8;
}
 
+   /* Enable HW time stamping if requested from user space */
+   if (priv-hwts_rx_en)
+   rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE;
+
/* keep vlan related bits if it's enabled */
if (priv-vlgrp) {
rctrl |= 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;
 
ctype = of_get_property(np, phy-connection-type, NULL);
 
@@ -805,12 +810,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev,
 
switch (config.rx_filter) {
case HWTSTAMP_FILTER_NONE:
-   priv-hwts_rx_en = 0;
+   if (priv-hwts_rx_en) {
+   stop_gfar(netdev);
+   priv-hwts_rx_en = 0;
+   startup_gfar(netdev);
+   }
break;
default:
if (!(priv-device_flags  FSL_GIANFAR_DEV_HAS_TIMER))
return -ERANGE;
-   priv-hwts_rx_en = 1;
+   if (!priv-hwts_rx_en) {
+   stop_gfar(netdev);
+   priv-hwts_rx_en = 1;
+   startup_gfar(netdev);
+   }
config.rx_filter = HWTSTAMP_FILTER_ALL;
break;
}
-- 
1.6.3.3
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev