ARM: OMAP2+: clock: Remove all direct dereferencing of struct clk
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / arm / mach-omap2 / clkt2xxx_virt_prcm_set.c
index 3d9d746..3524f0e 100644 (file)
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
 
-#include <plat/cpu.h>
 #include <plat/clock.h>
 #include <plat/sram.h>
 #include <plat/sdrc.h>
 
+#include "soc.h"
 #include "clock.h"
 #include "clock2xxx.h"
 #include "opp2xxx.h"
@@ -68,14 +68,15 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
 long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
 {
        const struct prcm_config *ptr;
-       long highest_rate;
+       long highest_rate, sys_clk_rate;
 
        highest_rate = -EINVAL;
+       sys_clk_rate = __clk_get_rate(sclk);
 
        for (ptr = rate_table; ptr->mpu_speed; ptr++) {
                if (!(ptr->flags & cpu_mask))
                        continue;
-               if (ptr->xtal_speed != sclk->rate)
+               if (ptr->xtal_speed != sys_clk_rate)
                        continue;
 
                highest_rate = ptr->mpu_speed;
@@ -94,12 +95,15 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
        const struct prcm_config *prcm;
        unsigned long found_speed = 0;
        unsigned long flags;
+       long sys_clk_rate;
+
+       sys_clk_rate = __clk_get_rate(sclk);
 
        for (prcm = rate_table; prcm->mpu_speed; prcm++) {
                if (!(prcm->flags & cpu_mask))
                        continue;
 
-               if (prcm->xtal_speed != sclk->rate)
+               if (prcm->xtal_speed != sys_clk_rate)
                        continue;
 
                if (prcm->mpu_speed <= rate) {