]> git.baikalelectronics.ru Git - kernel.git/commit
stmmac: Fix calculations for ptp counters when clock input = 50Mhz.
authorPhil Reid <preid@electromag.com.au>
Mon, 14 Dec 2015 03:32:01 +0000 (11:32 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Dec 2015 04:20:56 +0000 (23:20 -0500)
commite560aeef0d9dcbb4c6d22342746127733c63b998
treed6dbf0a3419cfa6aaf5c7eb5416919ed2ff14f0a
parenta0e6ffa3781a727f8de49458a2f3bba4fb8cebe1
stmmac: Fix calculations for ptp counters when clock input = 50Mhz.

stmmac_config_sub_second_increment set the sub second increment to 20ns.
Driver is configured to use the fine adjustment method where the sub second
register is incremented when the acculumator incremented by the addend
register wraps overflows. This accumulator is update on every ptp clk
cycle. If a ptp clk with a period of greater than 20ns was used the
sub second register would not get updated correctly.

Instead set the sub sec increment to twice the period of the ptp clk.
This result in the addend register being set mid range and overflow
the accumlator every 2 clock cycles.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c