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

void mxc_pm_lowpower ( int  mode  ) 

Implementing steps required to transition to low-power modes

Parameters:
mode The desired low-power mode. Possible values are, WAIT_MODE, DOZE_MODE, STOP_MODE or DSM_MODE

Definition at line 288 of file mxc_pm.c.

References mxc_ccm_modify_reg(), and mxc_init_irq().

{
      unsigned int lpm;
      int enable_flag;
      unsigned long reg;

      local_irq_disable();
      enable_flag = 0;

      switch (mode) {
      case STOP_MODE:
            /* State Retention mode */
            lpm = 2;
            /* Disable timer interrupt */
            disable_irq(MXC_INT_GPT);
            enable_flag = 1;

            /* Enable Well Bias and set VSTBY
             * VSTBY pin will be asserted during SR mode. This asks the
             * PM IC to set the core voltage to the standby voltage
             * Must clear the MXC_CCM_CCMR_SBYCS bit as well  */
            mxc_ccm_modify_reg(MXC_CCM_CCMR,
                           MXC_CCM_CCMR_WBEN | MXC_CCM_CCMR_VSTBY |
                           MXC_CCM_CCMR_SBYCS,
                           MXC_CCM_CCMR_WBEN | MXC_CCM_CCMR_VSTBY |
                           MXC_CCM_CCMR_SBYCS);

            mxc_ccm_modify_reg(MXC_CCM_CCMR,
                           MXC_CCM_CCMR_LPM_MASK,
                           lpm << MXC_CCM_CCMR_LPM_OFFSET);
            cpu_do_idle();
            break;

      case DSM_MODE:
            /* Deep Sleep Mode */
            lpm = 3;
            /* Disable timer interrupt */
            disable_irq(MXC_INT_GPT);
            enable_flag = 1;
            /* Enabled Well Bias
             * SBYCS = 0, MCU clock source is disabled*/
            mxc_ccm_modify_reg(MXC_CCM_CCMR,
                           MXC_CCM_CCMR_WBEN | MXC_CCM_CCMR_VSTBY |
                           MXC_CCM_CCMR_SBYCS | MXC_CCM_CCMR_LPM_MASK,
                           MXC_CCM_CCMR_WBEN | MXC_CCM_CCMR_VSTBY |
                           MXC_CCM_CCMR_SBYCS |
                           (lpm << MXC_CCM_CCMR_LPM_OFFSET));

            /* wake up by keypad */
            reg = __raw_readl(MXC_CCM_WIMR);
            reg &= ~(1 << 18);
            __raw_writel(reg, MXC_CCM_WIMR);

            flush_cache_all();
            l2x0_disable();

            mxc_pm_arch_entry(IO_ADDRESS(MX31_NFC_BASE_ADDR), 2048);
            printk(KERN_INFO "Resume from DSM\n");

            l2x0_enable();
            mxc_init_irq();

            break;
      default:
      case WAIT_MODE:
            /* Wait is the default mode used when idle. */
            reg = __raw_readl(MXC_CCM_CCMR);
            reg &= ~MXC_CCM_CCMR_LPM_MASK;
            __raw_writel(reg, MXC_CCM_CCMR);
            break;
      }

      if (enable_flag) {
            /* Enable timer interrupt */
            enable_irq(MXC_INT_GPT);
      }
      local_irq_enable();
}


Generated by  Doxygen 1.6.0   Back to index