Commit 1b14afa6 authored by Stephen Boyd's avatar Stephen Boyd Committed by Michael Turquette

clk: sunxi: Convert to clk_hw based provider APIs

We're removing struct clk from the clk provider API, so switch
this code to using the clk_hw based provider APIs.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: "Emilio López" <emilio@elopez.com.ar>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent b73d616d
...@@ -82,20 +82,20 @@ static long clk_factors_round_rate(struct clk_hw *hw, unsigned long rate, ...@@ -82,20 +82,20 @@ static long clk_factors_round_rate(struct clk_hw *hw, unsigned long rate,
static int clk_factors_determine_rate(struct clk_hw *hw, static int clk_factors_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) struct clk_rate_request *req)
{ {
struct clk *clk = hw->clk, *parent, *best_parent = NULL; struct clk_hw *parent, *best_parent = NULL;
int i, num_parents; int i, num_parents;
unsigned long parent_rate, best = 0, child_rate, best_child_rate = 0; unsigned long parent_rate, best = 0, child_rate, best_child_rate = 0;
/* find the parent that can help provide the fastest rate <= rate */ /* find the parent that can help provide the fastest rate <= rate */
num_parents = clk_hw_get_num_parents(hw); num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++) { for (i = 0; i < num_parents; i++) {
parent = clk_get_parent_by_index(clk, i); parent = clk_hw_get_parent_by_index(hw, i);
if (!parent) if (!parent)
continue; continue;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)
parent_rate = __clk_round_rate(parent, req->rate); parent_rate = clk_hw_round_rate(parent, req->rate);
else else
parent_rate = __clk_get_rate(parent); parent_rate = clk_hw_get_rate(parent);
child_rate = clk_factors_round_rate(hw, req->rate, child_rate = clk_factors_round_rate(hw, req->rate,
&parent_rate); &parent_rate);
...@@ -110,7 +110,7 @@ static int clk_factors_determine_rate(struct clk_hw *hw, ...@@ -110,7 +110,7 @@ static int clk_factors_determine_rate(struct clk_hw *hw,
if (!best_parent) if (!best_parent)
return -EINVAL; return -EINVAL;
req->best_parent_hw = __clk_get_hw(best_parent); req->best_parent_hw = best_parent;
req->best_parent_rate = best; req->best_parent_rate = best;
req->rate = best_child_rate; req->rate = best_child_rate;
......
...@@ -56,12 +56,12 @@ static int ar100_determine_rate(struct clk_hw *hw, ...@@ -56,12 +56,12 @@ static int ar100_determine_rate(struct clk_hw *hw,
for (i = 0; i < nparents; i++) { for (i = 0; i < nparents; i++) {
unsigned long parent_rate; unsigned long parent_rate;
unsigned long tmp_rate; unsigned long tmp_rate;
struct clk *parent; struct clk_hw *parent;
unsigned long div; unsigned long div;
int shift; int shift;
parent = clk_get_parent_by_index(hw->clk, i); parent = clk_hw_get_parent_by_index(hw, i);
parent_rate = __clk_get_rate(parent); parent_rate = clk_hw_get_rate(parent);
div = DIV_ROUND_UP(parent_rate, req->rate); div = DIV_ROUND_UP(parent_rate, req->rate);
/* /*
...@@ -99,7 +99,7 @@ static int ar100_determine_rate(struct clk_hw *hw, ...@@ -99,7 +99,7 @@ static int ar100_determine_rate(struct clk_hw *hw,
tmp_rate = (parent_rate >> shift) / div; tmp_rate = (parent_rate >> shift) / div;
if (!req->best_parent_hw || tmp_rate > best_rate) { if (!req->best_parent_hw || tmp_rate > best_rate) {
req->best_parent_hw = __clk_get_hw(parent); req->best_parent_hw = parent;
req->best_parent_rate = parent_rate; req->best_parent_rate = parent_rate;
best_rate = tmp_rate; best_rate = tmp_rate;
} }
......
...@@ -123,20 +123,20 @@ static long sun6i_ahb1_clk_round(unsigned long rate, u8 *divp, u8 *pre_divp, ...@@ -123,20 +123,20 @@ static long sun6i_ahb1_clk_round(unsigned long rate, u8 *divp, u8 *pre_divp,
static int sun6i_ahb1_clk_determine_rate(struct clk_hw *hw, static int sun6i_ahb1_clk_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req) struct clk_rate_request *req)
{ {
struct clk *clk = hw->clk, *parent, *best_parent = NULL; struct clk_hw *parent, *best_parent = NULL;
int i, num_parents; int i, num_parents;
unsigned long parent_rate, best = 0, child_rate, best_child_rate = 0; unsigned long parent_rate, best = 0, child_rate, best_child_rate = 0;
/* find the parent that can help provide the fastest rate <= rate */ /* find the parent that can help provide the fastest rate <= rate */
num_parents = clk_hw_get_num_parents(hw); num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++) { for (i = 0; i < num_parents; i++) {
parent = clk_get_parent_by_index(clk, i); parent = clk_hw_get_parent_by_index(hw, i);
if (!parent) if (!parent)
continue; continue;
if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)
parent_rate = __clk_round_rate(parent, req->rate); parent_rate = clk_hw_round_rate(parent, req->rate);
else else
parent_rate = __clk_get_rate(parent); parent_rate = clk_hw_get_rate(parent);
child_rate = sun6i_ahb1_clk_round(req->rate, NULL, NULL, i, child_rate = sun6i_ahb1_clk_round(req->rate, NULL, NULL, i,
parent_rate); parent_rate);
...@@ -151,7 +151,7 @@ static int sun6i_ahb1_clk_determine_rate(struct clk_hw *hw, ...@@ -151,7 +151,7 @@ static int sun6i_ahb1_clk_determine_rate(struct clk_hw *hw,
if (!best_parent) if (!best_parent)
return -EINVAL; return -EINVAL;
req->best_parent_hw = __clk_get_hw(best_parent); req->best_parent_hw = best_parent;
req->best_parent_rate = best; req->best_parent_rate = best;
req->rate = best_child_rate; req->rate = best_child_rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment