]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: ti: cpts: fix overflow check period
authorGrygorii Strashko <grygorii.strashko@ti.com>
Wed, 7 Dec 2016 00:00:45 +0000 (18:00 -0600)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Dec 2016 16:13:48 +0000 (11:13 -0500)
commit7ec4da0007aa913f69c94968eb36e1d7f5e673e6
tree922593476d473306781aeed5be9ded19b0ce81f1
parente9b927b0a1d20e121169f044a2a1d75ba7fa7209
net: ethernet: ti: cpts: fix overflow check period

The CPTS drivers uses 8sec period for overflow checking with
assumption that CPTS retclk will not exceed 500MHz. But that's not
true on some TI platforms (Kesytone 2). As result, it is possible that
CPTS counter will overflow more than once between two readings.

Hence, fix it by selecting overflow check period dynamically as
max_sec_before_overflow/2, where
 max_sec_before_overflow = max_counter_val / rftclk_freq.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpts.c
drivers/net/ethernet/ti/cpts.h