]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/arm/mach-davinci/da850.c
Merge tag 'armsoc-fixes-nc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[mirror_ubuntu-bionic-kernel.git] / arch / arm / mach-davinci / da850.c
index 9780829f8a0572219bae198715036c4d878a5af8..7475f02ffea550ab08e64b3e81de72c406dff7e7 100644 (file)
@@ -563,7 +563,7 @@ static struct clk_lookup da850_clks[] = {
        CLK("spi_davinci.0",    NULL,           &spi0_clk),
        CLK("spi_davinci.1",    NULL,           &spi1_clk),
        CLK("vpif",             NULL,           &vpif_clk),
-       CLK("ahci_da850",               NULL,           &sata_clk),
+       CLK("ahci_da850",       NULL,           &sata_clk),
        CLK("davinci-rproc.0",  NULL,           &dsp_clk),
        CLK(NULL,               NULL,           &ehrpwm_clk),
        CLK("ehrpwm.0",         "fck",          &ehrpwm0_clk),
@@ -1194,14 +1194,28 @@ static int da850_set_armrate(struct clk *clk, unsigned long index)
        return clk_set_rate(pllclk, index);
 }
 
-static int da850_set_pll0rate(struct clk *clk, unsigned long index)
+static int da850_set_pll0rate(struct clk *clk, unsigned long rate)
 {
-       unsigned int prediv, mult, postdiv;
-       struct da850_opp *opp;
        struct pll_data *pll = clk->pll_data;
+       struct cpufreq_frequency_table *freq;
+       unsigned int prediv, mult, postdiv;
+       struct da850_opp *opp = NULL;
        int ret;
 
-       opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
+       rate /= 1000;
+
+       for (freq = da850_freq_table;
+            freq->frequency != CPUFREQ_TABLE_END; freq++) {
+               /* rate is in Hz, freq->frequency is in KHz */
+               if (freq->frequency == rate) {
+                       opp = (struct da850_opp *)freq->driver_data;
+                       break;
+               }
+       }
+
+       if (!opp)
+               return -EINVAL;
+
        prediv = opp->prediv;
        mult = opp->mult;
        postdiv = opp->postdiv;