clk: at91: Convert to clk_hw based provider APIs
authorStephen Boyd <sboyd@codeaurora.org>
Fri, 31 Jul 2015 00:20:57 +0000 (17:20 -0700)
committerMichael Turquette <mturquette@baylibre.com>
Mon, 24 Aug 2015 23:48:47 +0000 (16:48 -0700)
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>
drivers/clk/at91/clk-peripheral.c
drivers/clk/at91/clk-programmable.c
drivers/clk/at91/clk-usb.c

index df2c1afa52b4acaa6204d5595a76c65f7dc0cb70..e4d7b574f1ea33a198a454e0223818c9e539ebb9 100644 (file)
@@ -134,7 +134,7 @@ at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name,
 
 static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
 {
-       struct clk *parent;
+       struct clk_hw *parent;
        unsigned long parent_rate;
        int shift = 0;
 
@@ -142,8 +142,8 @@ static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
                return;
 
        if (periph->range.max) {
-               parent = clk_get_parent_by_index(periph->hw.clk, 0);
-               parent_rate = __clk_get_rate(parent);
+               parent = clk_hw_get_parent_by_index(&periph->hw, 0);
+               parent_rate = clk_hw_get_rate(parent);
                if (!parent_rate)
                        return;
 
index 42ec812404ab2da191b3923ae9335a7c31d3653b..14b270b85fec277a6fdea1ad0df260eeee95f27b 100644 (file)
@@ -57,7 +57,7 @@ static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw,
 static int clk_programmable_determine_rate(struct clk_hw *hw,
                                           struct clk_rate_request *req)
 {
-       struct clk *parent = NULL;
+       struct clk_hw *parent;
        long best_rate = -EINVAL;
        unsigned long parent_rate;
        unsigned long tmp_rate;
@@ -65,11 +65,11 @@ static int clk_programmable_determine_rate(struct clk_hw *hw,
        int i;
 
        for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
-               parent = clk_get_parent_by_index(hw->clk, i);
+               parent = clk_hw_get_parent_by_index(hw, i);
                if (!parent)
                        continue;
 
-               parent_rate = __clk_get_rate(parent);
+               parent_rate = clk_hw_get_rate(parent);
                for (shift = 0; shift < PROG_PRES_MASK; shift++) {
                        tmp_rate = parent_rate >> shift;
                        if (tmp_rate <= req->rate)
@@ -83,7 +83,7 @@ static int clk_programmable_determine_rate(struct clk_hw *hw,
                    (req->rate - tmp_rate) < (req->rate - best_rate)) {
                        best_rate = tmp_rate;
                        req->best_parent_rate = parent_rate;
-                       req->best_parent_hw = __clk_get_hw(parent);
+                       req->best_parent_hw = parent;
                }
 
                if (!best_rate)
index 82dce8f2e03bd43f909504ce9775076d3561ee8f..8ab8502778a282bac38b56ce9ecb7cd92c8962e2 100644 (file)
@@ -59,7 +59,7 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
 static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
                                             struct clk_rate_request *req)
 {
-       struct clk *parent = NULL;
+       struct clk_hw *parent;
        long best_rate = -EINVAL;
        unsigned long tmp_rate;
        int best_diff = -1;
@@ -69,7 +69,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
        for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
                int div;
 
-               parent = clk_get_parent_by_index(hw->clk, i);
+               parent = clk_hw_get_parent_by_index(hw, i);
                if (!parent)
                        continue;
 
@@ -77,7 +77,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
                        unsigned long tmp_parent_rate;
 
                        tmp_parent_rate = req->rate * div;
-                       tmp_parent_rate = __clk_round_rate(parent,
+                       tmp_parent_rate = clk_hw_round_rate(parent,
                                                           tmp_parent_rate);
                        tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div);
                        if (tmp_rate < req->rate)
@@ -89,7 +89,7 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
                                best_rate = tmp_rate;
                                best_diff = tmp_diff;
                                req->best_parent_rate = tmp_parent_rate;
-                               req->best_parent_hw = __clk_get_hw(parent);
+                               req->best_parent_hw = parent;
                        }
 
                        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,
                                          unsigned long *parent_rate)
 {
        struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw);
-       struct clk *parent = __clk_get_parent(hw->clk);
+       struct clk_hw *parent = clk_hw_get_parent(hw);
        unsigned long bestrate = 0;
        int bestdiff = -1;
        unsigned long tmprate;
@@ -287,7 +287,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
                        continue;
 
                tmp_parent_rate = rate * usb->divisors[i];
-               tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate);
+               tmp_parent_rate = clk_hw_round_rate(parent, tmp_parent_rate);
                tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]);
                if (tmprate < rate)
                        tmpdiff = rate - tmprate;
This page took 0.11545 seconds and 5 git commands to generate.