aspeed: ast2500: fix D2-PLL clock setting in RGMII mode
authorCédric Le Goater <clg@kaod.org>
Mon, 29 Oct 2018 06:06:41 +0000 (07:06 +0100)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 5 Nov 2018 16:41:58 +0000 (10:41 -0600)
commit1e5d8aaf4f060d8f46bc53fd24b8f2679657e856
treebfbdceabfc1d44ebe7ba031c800e67d57eb2c408
parentf55f565d7124d815adb47c8b2de42b10b5dc25b3
aspeed: ast2500: fix D2-PLL clock setting in RGMII mode

The algorithm in the ast2500_calc_clock_config() routine suffers from
integer rounding and the requested rate does not get the appropriate
set of Numerator, Denumerator, Post Divider parameters.

This is the case for the D2-PLL clock used by the MAC controllers in
RGMII mode. The requested rated is 250MHz but a 251MHz is assigned.

The easiest way to fix this problem is to introduce an array of clock
settings defining the N, M, P parameters for well known frequencies
used by the Aspeed SoC.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/clk/aspeed/clk_ast2500.c