Skip to content

Commit e0237f5

Browse files
ryan-wannernoglitch
authored andcommitted
clk: at91: clk-master: Add check for divide by 3
A potential divider for the master clock is div/3. The register configuration for div/3 is MASTER_PRES_MAX. The current bit shifting method does not work for this case. Checking for MASTER_PRES_MAX will ensure the correct decimal value is stored in the system. Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
1 parent af98cae commit e0237f5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/clk/at91/clk-master.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ clk_sama7g5_master_recalc_rate(struct clk_hw *hw,
580580
{
581581
struct clk_master *master = to_clk_master(hw);
582582

583+
if (master->div == MASTER_PRES_MAX)
584+
return DIV_ROUND_CLOSEST_ULL(parent_rate, 3);
585+
583586
return DIV_ROUND_CLOSEST_ULL(parent_rate, (1 << master->div));
584587
}
585588

0 commit comments

Comments
 (0)