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:47 -0400
commitd0979335c329bad3b924b9d74fd0b86d57815c8f (patch)
treeeafeee94ca0b11f32895f021b197f66239b4e6a3
parent617b8272a63c9f60bd4b1e33d56318402b0b84be (diff)
clk: at91: 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. Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/at91/clk-peripheral.c6
-rw-r--r--drivers/clk/at91/clk-programmable.c8
-rw-r--r--drivers/clk/at91/clk-usb.c12
3 files changed, 13 insertions, 13 deletions
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index df2c1afa52b4..e4d7b574f1ea 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -134,7 +134,7 @@ at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name,
134 134
135static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph) 135static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
136{ 136{
137 struct clk *parent; 137 struct clk_hw *parent;
138 unsigned long parent_rate; 138 unsigned long parent_rate;
139 int shift = 0; 139 int shift = 0;
140 140
@@ -142,8 +142,8 @@ static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
142 return; 142 return;
143 143
144 if (periph->range.max) { 144 if (periph->range.max) {
145 parent = clk_get_parent_by_index(periph->hw.clk, 0); 145 parent = clk_hw_get_parent_by_index(&periph->hw, 0);
146 parent_rate = __clk_get_rate(parent); 146 parent_rate = clk_hw_get_rate(parent);
147 if (!parent_rate) 147 if (!parent_rate)
148 return; 148 return;
149 149
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index 42ec812404ab..14b270b85fec 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -57,7 +57,7 @@ static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw,
57static int clk_programmable_determine_rate(struct clk_hw *hw, 57static int clk_programmable_determine_rate(struct clk_hw *hw,
58 struct clk_rate_request *req) 58 struct clk_rate_request *req)
59{ 59{
60 struct clk *parent = NULL; 60 struct clk_hw *parent;
61 long best_rate = -EINVAL; 61 long best_rate = -EINVAL;
62 unsigned long parent_rate; 62 unsigned long parent_rate;
63 unsigned long tmp_rate; 63 unsigned long tmp_rate;
@@ -65,11 +65,11 @@ static int clk_programmable_determine_rate(struct clk_hw *hw,
65 int i; 65 int i;
66 66
67 for (i = 0; i < clk_hw_get_num_parents(hw); i++) { 67 for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
68 parent = clk_get_parent_by_index(hw->clk, i); 68 parent = clk_hw_get_parent_by_index(hw, i);
69 if (!parent) 69 if (!parent)
70 continue; 70 continue;
71 71
72 parent_rate = __clk_get_rate(parent); 72 parent_rate = clk_hw_get_rate(parent);
73 for (shift = 0; shift < PROG_PRES_MASK; shift++) { 73 for (shift = 0; shift < PROG_PRES_MASK; shift++) {
74 tmp_rate = parent_rate >> shift; 74 tmp_rate = parent_rate >> shift;
75 if (tmp_rate <= req->rate) 75 if (tmp_rate <= req->rate)
@@ -83,7 +83,7 @@ static int clk_programmable_determine_rate(struct clk_hw *hw,
83 (req->rate - tmp_rate) < (req->rate - best_rate)) { 83 (req->rate - tmp_rate) < (req->rate - best_rate)) {
84 best_rate = tmp_rate; 84 best_rate = tmp_rate;
85 req->best_parent_rate = parent_rate; 85 req->best_parent_rate = parent_rate;
86 req->best_parent_hw = __clk_get_hw(parent); 86 req->best_parent_hw = parent;
87 } 87 }
88 88
89 if (!best_rate) 89 if (!best_rate)
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index 82dce8f2e03b..8ab8502778a2 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -59,7 +59,7 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
59static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw, 59static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
60 struct clk_rate_request *req) 60 struct clk_rate_request *req)
61{ 61{
62 struct clk *parent = NULL; 62 struct clk_hw *parent;
63 long best_rate = -EINVAL; 63 long best_rate = -EINVAL;
64 unsigned long tmp_rate; 64 unsigned long tmp_rate;
65 int best_diff = -1; 65 int best_diff = -1;
@@ -69,7 +69,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
69 for (i = 0; i < clk_hw_get_num_parents(hw); i++) { 69 for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
70 int div; 70 int div;
71 71
72 parent = clk_get_parent_by_index(hw->clk, i); 72 parent = clk_hw_get_parent_by_index(hw, i);
73 if (!parent) 73 if (!parent)
74 continue; 74 continue;
75 75
@@ -77,7 +77,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
77 unsigned long tmp_parent_rate; 77 unsigned long tmp_parent_rate;
78 78
79 tmp_parent_rate = req->rate * div; 79 tmp_parent_rate = req->rate * div;
80 tmp_parent_rate = __clk_round_rate(parent, 80 tmp_parent_rate = clk_hw_round_rate(parent,
81 tmp_parent_rate); 81 tmp_parent_rate);
82 tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div); 82 tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div);
83 if (tmp_rate < req->rate) 83 if (tmp_rate < req->rate)
@@ -89,7 +89,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
89 best_rate = tmp_rate; 89 best_rate = tmp_rate;
90 best_diff = tmp_diff; 90 best_diff = tmp_diff;
91 req->best_parent_rate = tmp_parent_rate; 91 req->best_parent_rate = tmp_parent_rate;
92 req->best_parent_hw = __clk_get_hw(parent); 92 req->best_parent_hw = parent;
93 } 93 }
94 94
95 if (!best_diff || tmp_rate < req->rate) 95 if (!best_diff || tmp_rate < req->rate)
@@ -273,7 +273,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
273 unsigned long *parent_rate) 273 unsigned long *parent_rate)
274{ 274{
275 struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); 275 struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw);
276 struct clk *parent = __clk_get_parent(hw->clk); 276 struct clk_hw *parent = clk_hw_get_parent(hw);
277 unsigned long bestrate = 0; 277 unsigned long bestrate = 0;
278 int bestdiff = -1; 278 int bestdiff = -1;
279 unsigned long tmprate; 279 unsigned long tmprate;
@@ -287,7 +287,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
287 continue; 287 continue;
288 288
289 tmp_parent_rate = rate * usb->divisors[i]; 289 tmp_parent_rate = rate * usb->divisors[i];
290 tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); 290 tmp_parent_rate = clk_hw_round_rate(parent, tmp_parent_rate);
291 tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]); 291 tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]);
292 if (tmprate < rate) 292 if (tmprate < rate)
293 tmpdiff = rate - tmprate; 293 tmpdiff = rate - tmprate;