Commit 9f7d5042 authored by Lori Hikichi's avatar Lori Hikichi Committed by Stephen Boyd
Browse files

clk: iproc: round clock rate to the closest



Change from 'DIV_ROUND_UP' to 'DIV_ROUND_CLOSEST' when calculating the
clock divisor in the iProc ASIU clock driver to allow to get to the
closest clock rate.

Fixes: 5fe225c1 ("clk: iproc: add initial common clock support")
Signed-off-by: default avatarLori Hikichi <lhikichi@broadcom.com>
Signed-off-by: default avatarRay Jui <ray.jui@broadcom.com>
Link: https://lore.kernel.org/r/20200612225212.124301-1-ray.jui@broadcom.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent b3a9e3b9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static long iproc_asiu_clk_round_rate(struct clk_hw *hw, unsigned long rate,
	if (rate == *parent_rate)
		return *parent_rate;

	div = DIV_ROUND_UP(*parent_rate, rate);
	div = DIV_ROUND_CLOSEST(*parent_rate, rate);
	if (div < 2)
		return *parent_rate;

@@ -145,7 +145,7 @@ static int iproc_asiu_clk_set_rate(struct clk_hw *hw, unsigned long rate,
		return 0;
	}

	div = DIV_ROUND_UP(parent_rate, rate);
	div = DIV_ROUND_CLOSEST(parent_rate, rate);
	if (div < 2)
		return -EINVAL;