aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-07-30 20:20:57 -0400
committerMichael Turquette <mturquette@baylibre.com>2015-08-24 19:48:48 -0400
commit6f220c22438ab846c824a042746a54058cf22af7 (patch)
tree58ee542e1b70d18d6e36d3f81553b03a1b1bd97c
parentd0979335c329bad3b924b9d74fd0b86d57815c8f (diff)
clk: bcm: 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. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/bcm/clk-kona.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/clk/bcm/clk-kona.c b/drivers/clk/bcm/clk-kona.c
index 05fa322bc5fb..3a15347b4233 100644
--- a/drivers/clk/bcm/clk-kona.c
+++ b/drivers/clk/bcm/clk-kona.c
@@ -1011,7 +1011,7 @@ static long kona_peri_clk_round_rate(struct clk_hw *hw, unsigned long rate,
1011 struct bcm_clk_div *div = &bcm_clk->u.peri->div; 1011 struct bcm_clk_div *div = &bcm_clk->u.peri->div;
1012 1012
1013 if (!divider_exists(div)) 1013 if (!divider_exists(div))
1014 return __clk_get_rate(hw->clk); 1014 return clk_hw_get_rate(hw);
1015 1015
1016 /* Quietly avoid a zero rate */ 1016 /* Quietly avoid a zero rate */
1017 return round_rate(bcm_clk->ccu, div, &bcm_clk->u.peri->pre_div, 1017 return round_rate(bcm_clk->ccu, div, &bcm_clk->u.peri->pre_div,
@@ -1022,8 +1022,7 @@ static int kona_peri_clk_determine_rate(struct clk_hw *hw,
1022 struct clk_rate_request *req) 1022 struct clk_rate_request *req)
1023{ 1023{
1024 struct kona_clk *bcm_clk = to_kona_clk(hw); 1024 struct kona_clk *bcm_clk = to_kona_clk(hw);
1025 struct clk *clk = hw->clk; 1025 struct clk_hw *current_parent;
1026 struct clk *current_parent;
1027 unsigned long parent_rate; 1026 unsigned long parent_rate;
1028 unsigned long best_delta; 1027 unsigned long best_delta;
1029 unsigned long best_rate; 1028 unsigned long best_rate;
@@ -1048,14 +1047,14 @@ static int kona_peri_clk_determine_rate(struct clk_hw *hw,
1048 } 1047 }
1049 1048
1050 /* Unless we can do better, stick with current parent */ 1049 /* Unless we can do better, stick with current parent */
1051 current_parent = clk_get_parent(clk); 1050 current_parent = clk_hw_get_parent(hw);
1052 parent_rate = __clk_get_rate(current_parent); 1051 parent_rate = clk_hw_get_rate(current_parent);
1053 best_rate = kona_peri_clk_round_rate(hw, req->rate, &parent_rate); 1052 best_rate = kona_peri_clk_round_rate(hw, req->rate, &parent_rate);
1054 best_delta = abs(best_rate - req->rate); 1053 best_delta = abs(best_rate - req->rate);
1055 1054
1056 /* Check whether any other parent clock can produce a better result */ 1055 /* Check whether any other parent clock can produce a better result */
1057 for (which = 0; which < parent_count; which++) { 1056 for (which = 0; which < parent_count; which++) {
1058 struct clk *parent = clk_get_parent_by_index(clk, which); 1057 struct clk_hw *parent = clk_hw_get_parent_by_index(hw, which);
1059 unsigned long delta; 1058 unsigned long delta;
1060 unsigned long other_rate; 1059 unsigned long other_rate;
1061 1060
@@ -1064,14 +1063,14 @@ static int kona_peri_clk_determine_rate(struct clk_hw *hw,
1064 continue; 1063 continue;
1065 1064
1066 /* We don't support CLK_SET_RATE_PARENT */ 1065 /* We don't support CLK_SET_RATE_PARENT */
1067 parent_rate = __clk_get_rate(parent); 1066 parent_rate = clk_hw_get_rate(parent);
1068 other_rate = kona_peri_clk_round_rate(hw, req->rate, 1067 other_rate = kona_peri_clk_round_rate(hw, req->rate,
1069 &parent_rate); 1068 &parent_rate);
1070 delta = abs(other_rate - req->rate); 1069 delta = abs(other_rate - req->rate);
1071 if (delta < best_delta) { 1070 if (delta < best_delta) {
1072 best_delta = delta; 1071 best_delta = delta;
1073 best_rate = other_rate; 1072 best_rate = other_rate;
1074 req->best_parent_hw = __clk_get_hw(parent); 1073 req->best_parent_hw = parent;
1075 req->best_parent_rate = parent_rate; 1074 req->best_parent_rate = parent_rate;
1076 } 1075 }
1077 } 1076 }
@@ -1139,7 +1138,7 @@ static int kona_peri_clk_set_rate(struct clk_hw *hw, unsigned long rate,
1139 if (parent_rate > (unsigned long)LONG_MAX) 1138 if (parent_rate > (unsigned long)LONG_MAX)
1140 return -EINVAL; 1139 return -EINVAL;
1141 1140
1142 if (rate == __clk_get_rate(hw->clk)) 1141 if (rate == clk_hw_get_rate(hw))
1143 return 0; 1142 return 0;
1144 1143
1145 if (!divider_exists(div)) 1144 if (!divider_exists(div))
@@ -1258,6 +1257,7 @@ bool __init kona_ccu_init(struct ccu_data *ccu)
1258 unsigned long flags; 1257 unsigned long flags;
1259 unsigned int which; 1258 unsigned int which;
1260 struct clk **clks = ccu->clk_data.clks; 1259 struct clk **clks = ccu->clk_data.clks;
1260 struct kona_clk *kona_clks = ccu->kona_clks;
1261 bool success = true; 1261 bool success = true;
1262 1262
1263 flags = ccu_lock(ccu); 1263 flags = ccu_lock(ccu);
@@ -1268,7 +1268,7 @@ bool __init kona_ccu_init(struct ccu_data *ccu)
1268 1268
1269 if (!clks[which]) 1269 if (!clks[which])
1270 continue; 1270 continue;
1271 bcm_clk = to_kona_clk(__clk_get_hw(clks[which])); 1271 bcm_clk = &kona_clks[which];
1272 success &= __kona_clk_init(bcm_clk); 1272 success &= __kona_clk_init(bcm_clk);
1273 } 1273 }
1274 1274