* [PATCH] clk: sunxi: Fix M factor computation for APB1
@ 2016-11-03 23:53 Stéphan Rafin
2016-11-04 7:49 ` Maxime Ripard
0 siblings, 1 reply; 2+ messages in thread
From: Stéphan Rafin @ 2016-11-03 23:53 UTC (permalink / raw)
To: linux-arm-kernel
commit cfa636886033 ("clk: sunxi: factors: Consolidate get_factors
parameters into a struct") introduced a regression for m factor
computation in sun4i_get_apb1_factors function.
The old code reassigned the "parent_rate" parameter to the targeted
divisor value and was buggy for the returned frequency but not for the
computed factors. Now, returned frequency is good but m factor is
incorrectly computed (its max value 31 is always set resulting in a
significantly slower frequency than the requested one...)
This patch simply restores the original proper computation for m while
keeping the good changes for returned rate.
Signed-off-by: St?phan Rafin <stephan@soliotek.com>
---
drivers/clk/sunxi/clk-sunxi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 838b22a..f2c9274 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -373,7 +373,7 @@ static void sun4i_get_apb1_factors(struct factors_request *req)
else
calcp = 3;
- calcm = (req->parent_rate >> calcp) - 1;
+ calcm = (div >> calcp) - 1;
req->rate = (req->parent_rate >> calcp) / (calcm + 1);
req->m = calcm;
--
2.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] clk: sunxi: Fix M factor computation for APB1
2016-11-03 23:53 [PATCH] clk: sunxi: Fix M factor computation for APB1 Stéphan Rafin
@ 2016-11-04 7:49 ` Maxime Ripard
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2016-11-04 7:49 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 04, 2016 at 12:53:56AM +0100, St?phan Rafin wrote:
> commit cfa636886033 ("clk: sunxi: factors: Consolidate get_factors
> parameters into a struct") introduced a regression for m factor
> computation in sun4i_get_apb1_factors function.
>
> The old code reassigned the "parent_rate" parameter to the targeted
> divisor value and was buggy for the returned frequency but not for the
> computed factors. Now, returned frequency is good but m factor is
> incorrectly computed (its max value 31 is always set resulting in a
> significantly slower frequency than the requested one...)
>
> This patch simply restores the original proper computation for m while
> keeping the good changes for returned rate.
>
> Signed-off-by: St?phan Rafin <stephan@soliotek.com>
Applied (added a Fixes tag), thanks
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161104/a56fa6c0/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-04 7:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 23:53 [PATCH] clk: sunxi: Fix M factor computation for APB1 Stéphan Rafin
2016-11-04 7:49 ` Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox