Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

int mxc_pm_intscale ( long  arm_freq,
long  max_freq,
long  ip_freq 
)

Integer clock scaling

Change main arm clock frequencies without changing the PLL. The integer dividers are changed to produce the desired frequencies. The number of valid frequency are limited and are determined by the current MCU PLL frequency

Parameters:
arm_freq desired ARM frequency (Hz)
max_freq desired MAX frequency (Hz)
ip_freq desired IP frequency (Hz)
Returns:
Returns 0 on success or Returns non zero if error PLL_LESS_ARM_ERR if pll frequency is less than desired core frequency FREQ_OUT_OF_RANGE if desided frequencies ar not possible with the current mcu pll frequency.

Definition at line 189 of file mxc_pm.c.

References cal_pdr0_value().

{
      unsigned long mcu_main_clk;   /* mcu clock domain main clock */
      unsigned long mask;
      unsigned long value;
      int ret_value;

      printk(KERN_INFO "arm_freq=%ld, max_freq=%ld, ip_freq=%ld\n",
             arm_freq, max_freq, ip_freq);
      //print_frequencies();  /* debug */

      mcu_main_clk = clk_get_rate(mcu_pll_clk);
      ret_value = cal_pdr0_value(mcu_main_clk, arm_freq, max_freq, ip_freq,
                           &mask, &value);
      if ((arm_freq != clk_round_rate(cpu_clk, arm_freq)) ||
          (max_freq != clk_round_rate(ahb_clk, max_freq)) ||
          (ip_freq != clk_round_rate(ipg_clk, ip_freq))) {
            return -EINVAL;
      }

      if ((max_freq != clk_get_rate(ahb_clk)) ||
          (ip_freq != clk_get_rate(ipg_clk))) {
            return -EINVAL;
      }

      if (arm_freq != clk_get_rate(cpu_clk)) {
            ret_value = clk_set_rate(cpu_clk, arm_freq);
      }
      return ret_value;
}


Generated by  Doxygen 1.6.0   Back to index