]> git.baikalelectronics.ru Git - kernel.git/commit
clk: at91: usb: fix at91rm9200 round and set rate
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 14 Nov 2014 18:54:49 +0000 (19:54 +0100)
committerMichael Turquette <mturquette@linaro.org>
Mon, 17 Nov 2014 18:38:40 +0000 (10:38 -0800)
commit4bce121223a4f68f90510f9218adcf14067a622d
treebecb282ec5a16929bc69a105e7ad2ef09cac6875
parent5b69731116214c747dd19798112a990641d3723e
clk: at91: usb: fix at91rm9200 round and set rate

at91rm9200_clk_usb_set_rate might fail depending on the requested rate,
because the parent_rate / rate remainder is not necessarily zero.
Moreover, when rounding down the calculated rate we might alter the
divisor calculation and end up with an invalid divisor.

To solve those problems, accept a non zero remainder, and always round
division to the closest result.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Andreas Henriksson <andreas.henriksson@endian.se>
Tested-by: Andreas Henriksson <andreas.henriksson@endian.se>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/at91/clk-usb.c