Stephen,
Thanks for the review
On 18/03/2019 at 20:54, Stephen Boyd wrote:
Quoting Nicolas Ferre (2019-03-18 03:50:45)
From: Matthias Wieloch matthias.wieloch@few-bauer.de
The prescaler formula of the programmable clock has changed for sama5d2. Update the driver accordingly.
Fixes: a2038077de9a ("clk: at91: add sama5d2 PMC driver") Cc: stable@vger.kernel.org # v4.20+ Signed-off-by: Nicolas Ferre nicolas.ferre@microchip.com [nicolas.ferre@microchip.com: adapt the prescaler range, fix clk_programmable_recalc_rate, split patch] Signed-off-by: Matthias Wieloch matthias.wieloch@few-bauer.de Signed-off-by: Alexandre Belloni alexandre.belloni@bootlin.com
v2: adapt to v5.1-rc1 remove unneeded sentence about DT in commit message
Stephen,
I think it would be good to see this fix going upstream during v5.1-rc phase.
Ok. I can apply this clk-fixes. I presume that things are real bad and it can't wait until v5.2?
To be perfectly clear, it's not a regression. But as we're at the very beginning of the '-rc' phase and as it's a bug, I was thinking about adding it now. But you to choose, no problem either way.
@@ -60,10 +68,18 @@ static int clk_programmable_determine_rate(struct clk_hw *hw, continue; parent_rate = clk_hw_get_rate(parent);
for (shift = 0; shift < PROG_PRES_MASK; shift++) {
tmp_rate = parent_rate >> shift;
if (tmp_rate <= req->rate)
break;
if (layout->is_pres_direct) {
for (shift = 0; shift <= layout->pres_mask; shift++) {
tmp_rate = parent_rate / (shift + 1);
if (tmp_rate <= req->rate)
break;
}
} else {
for (shift = 0; shift < layout->pres_mask; shift++) {
tmp_rate = parent_rate >> shift;
if (tmp_rate <= req->rate)
break;
}
This looks like a lot of copy paste when the if statement could have been pulled into the for loop instead of duplicating the loops and surrounding if condition check for tmp_rate.
Stop condition of loops not being the same made me separate them instead of adding artificial test conditions for shift == layout->pres_mask. I'm not sure the other way around is more obvious then...
}
if (tmp_rate > req->rate)