net: ethernet: renesas: rcar_gen4_ptp: Get clock increment from clock rate
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tue, 21 Nov 2023 15:53:05 +0000 (16:53 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 23 Nov 2023 11:02:49 +0000 (12:02 +0100)
commitbe5f81d37f7971abbad8547624453a1d4f033457
treeacd034b19ca1677ce8e6d95ba01c9b2635fd955f
parent46c361a04635a9f431fec56a75076cbb5262fb93
net: ethernet: renesas: rcar_gen4_ptp: Get clock increment from clock rate

Instead of using hard coded clock increment values for each SoC derive
the clock increment from the module clock. This is done in preparation
to support a second platform, R-Car V4H that uses a 200Mhz clock
compared with the 320Mhz clock used on R-Car S4.

Tested on both SoCs,

S4 reports a clock of 320000000Hz which gives a value of 0x19000000.
Documentation says a 320Mhz clock is used and the correct increment for
that clock is 0x19000000.

V4H reports a clock of 199999992Hz which gives a value of 0x2800001a.
Documentation says a 200Mhz clock is used and the correct increment for
that clock is 0x28000000.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/renesas/rcar_gen4_ptp.c
drivers/net/ethernet/renesas/rcar_gen4_ptp.h
drivers/net/ethernet/renesas/rswitch.c