aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm34xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r--arch/arm/mach-omap2/pm34xx.c159
1 files changed, 13 insertions, 146 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f864e4b085d..0c5e3a46a3ad 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -29,6 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/console.h> 31#include <linux/console.h>
32#include <trace/events/power.h>
32 33
33#include <plat/sram.h> 34#include <plat/sram.h>
34#include "clockdomain.h" 35#include "clockdomain.h"
@@ -311,11 +312,6 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
311 return IRQ_HANDLED; 312 return IRQ_HANDLED;
312} 313}
313 314
314static void restore_control_register(u32 val)
315{
316 __asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val));
317}
318
319/* Function to restore the table entry that was modified for enabling MMU */ 315/* Function to restore the table entry that was modified for enabling MMU */
320static void restore_table_entry(void) 316static void restore_table_entry(void)
321{ 317{
@@ -337,7 +333,7 @@ static void restore_table_entry(void)
337 control_reg_value = __raw_readl(scratchpad_address 333 control_reg_value = __raw_readl(scratchpad_address
338 + OMAP343X_CONTROL_REG_VALUE_OFFSET); 334 + OMAP343X_CONTROL_REG_VALUE_OFFSET);
339 /* This will enable caches and prediction */ 335 /* This will enable caches and prediction */
340 restore_control_register(control_reg_value); 336 set_cr(control_reg_value);
341} 337}
342 338
343void omap_sram_idle(void) 339void omap_sram_idle(void)
@@ -496,7 +492,7 @@ console_still_active:
496 492
497 pwrdm_post_transition(); 493 pwrdm_post_transition();
498 494
499 omap2_clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); 495 clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
500} 496}
501 497
502int omap3_can_sleep(void) 498int omap3_can_sleep(void)
@@ -519,8 +515,14 @@ static void omap3_pm_idle(void)
519 if (omap_irq_pending() || need_resched()) 515 if (omap_irq_pending() || need_resched())
520 goto out; 516 goto out;
521 517
518 trace_power_start(POWER_CSTATE, 1, smp_processor_id());
519 trace_cpu_idle(1, smp_processor_id());
520
522 omap_sram_idle(); 521 omap_sram_idle();
523 522
523 trace_power_end(smp_processor_id());
524 trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
525
524out: 526out:
525 local_fiq_enable(); 527 local_fiq_enable();
526 local_irq_enable(); 528 local_irq_enable();
@@ -688,149 +690,15 @@ static void __init omap3_d2d_idle(void)
688 690
689static void __init prcm_setup_regs(void) 691static void __init prcm_setup_regs(void)
690{ 692{
691 u32 omap3630_auto_uart4_mask = cpu_is_omap3630() ?
692 OMAP3630_AUTO_UART4_MASK : 0;
693 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ? 693 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ?
694 OMAP3630_EN_UART4_MASK : 0; 694 OMAP3630_EN_UART4_MASK : 0;
695 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ? 695 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ?
696 OMAP3630_GRPSEL_UART4_MASK : 0; 696 OMAP3630_GRPSEL_UART4_MASK : 0;
697 697
698 698 /* XXX This should be handled by hwmod code or SCM init code */
699 /* XXX Reset all wkdeps. This should be done when initializing
700 * powerdomains */
701 omap2_prm_write_mod_reg(0, OMAP3430_IVA2_MOD, PM_WKDEP);
702 omap2_prm_write_mod_reg(0, MPU_MOD, PM_WKDEP);
703 omap2_prm_write_mod_reg(0, OMAP3430_DSS_MOD, PM_WKDEP);
704 omap2_prm_write_mod_reg(0, OMAP3430_NEON_MOD, PM_WKDEP);
705 omap2_prm_write_mod_reg(0, OMAP3430_CAM_MOD, PM_WKDEP);
706 omap2_prm_write_mod_reg(0, OMAP3430_PER_MOD, PM_WKDEP);
707 if (omap_rev() > OMAP3430_REV_ES1_0) {
708 omap2_prm_write_mod_reg(0, OMAP3430ES2_SGX_MOD, PM_WKDEP);
709 omap2_prm_write_mod_reg(0, OMAP3430ES2_USBHOST_MOD, PM_WKDEP);
710 } else
711 omap2_prm_write_mod_reg(0, GFX_MOD, PM_WKDEP);
712
713 /*
714 * Enable interface clock autoidle for all modules.
715 * Note that in the long run this should be done by clockfw
716 */
717 omap2_cm_write_mod_reg(
718 OMAP3430_AUTO_MODEM_MASK |
719 OMAP3430ES2_AUTO_MMC3_MASK |
720 OMAP3430ES2_AUTO_ICR_MASK |
721 OMAP3430_AUTO_AES2_MASK |
722 OMAP3430_AUTO_SHA12_MASK |
723 OMAP3430_AUTO_DES2_MASK |
724 OMAP3430_AUTO_MMC2_MASK |
725 OMAP3430_AUTO_MMC1_MASK |
726 OMAP3430_AUTO_MSPRO_MASK |
727 OMAP3430_AUTO_HDQ_MASK |
728 OMAP3430_AUTO_MCSPI4_MASK |
729 OMAP3430_AUTO_MCSPI3_MASK |
730 OMAP3430_AUTO_MCSPI2_MASK |
731 OMAP3430_AUTO_MCSPI1_MASK |
732 OMAP3430_AUTO_I2C3_MASK |
733 OMAP3430_AUTO_I2C2_MASK |
734 OMAP3430_AUTO_I2C1_MASK |
735 OMAP3430_AUTO_UART2_MASK |
736 OMAP3430_AUTO_UART1_MASK |
737 OMAP3430_AUTO_GPT11_MASK |
738 OMAP3430_AUTO_GPT10_MASK |
739 OMAP3430_AUTO_MCBSP5_MASK |
740 OMAP3430_AUTO_MCBSP1_MASK |
741 OMAP3430ES1_AUTO_FAC_MASK | /* This is es1 only */
742 OMAP3430_AUTO_MAILBOXES_MASK |
743 OMAP3430_AUTO_OMAPCTRL_MASK |
744 OMAP3430ES1_AUTO_FSHOSTUSB_MASK |
745 OMAP3430_AUTO_HSOTGUSB_MASK |
746 OMAP3430_AUTO_SAD2D_MASK |
747 OMAP3430_AUTO_SSI_MASK,
748 CORE_MOD, CM_AUTOIDLE1);
749
750 omap2_cm_write_mod_reg(
751 OMAP3430_AUTO_PKA_MASK |
752 OMAP3430_AUTO_AES1_MASK |
753 OMAP3430_AUTO_RNG_MASK |
754 OMAP3430_AUTO_SHA11_MASK |
755 OMAP3430_AUTO_DES1_MASK,
756 CORE_MOD, CM_AUTOIDLE2);
757
758 if (omap_rev() > OMAP3430_REV_ES1_0) {
759 omap2_cm_write_mod_reg(
760 OMAP3430_AUTO_MAD2D_MASK |
761 OMAP3430ES2_AUTO_USBTLL_MASK,
762 CORE_MOD, CM_AUTOIDLE3);
763 }
764
765 omap2_cm_write_mod_reg(
766 OMAP3430_AUTO_WDT2_MASK |
767 OMAP3430_AUTO_WDT1_MASK |
768 OMAP3430_AUTO_GPIO1_MASK |
769 OMAP3430_AUTO_32KSYNC_MASK |
770 OMAP3430_AUTO_GPT12_MASK |
771 OMAP3430_AUTO_GPT1_MASK,
772 WKUP_MOD, CM_AUTOIDLE);
773
774 omap2_cm_write_mod_reg(
775 OMAP3430_AUTO_DSS_MASK,
776 OMAP3430_DSS_MOD,
777 CM_AUTOIDLE);
778
779 omap2_cm_write_mod_reg(
780 OMAP3430_AUTO_CAM_MASK,
781 OMAP3430_CAM_MOD,
782 CM_AUTOIDLE);
783
784 omap2_cm_write_mod_reg(
785 omap3630_auto_uart4_mask |
786 OMAP3430_AUTO_GPIO6_MASK |
787 OMAP3430_AUTO_GPIO5_MASK |
788 OMAP3430_AUTO_GPIO4_MASK |
789 OMAP3430_AUTO_GPIO3_MASK |
790 OMAP3430_AUTO_GPIO2_MASK |
791 OMAP3430_AUTO_WDT3_MASK |
792 OMAP3430_AUTO_UART3_MASK |
793 OMAP3430_AUTO_GPT9_MASK |
794 OMAP3430_AUTO_GPT8_MASK |
795 OMAP3430_AUTO_GPT7_MASK |
796 OMAP3430_AUTO_GPT6_MASK |
797 OMAP3430_AUTO_GPT5_MASK |
798 OMAP3430_AUTO_GPT4_MASK |
799 OMAP3430_AUTO_GPT3_MASK |
800 OMAP3430_AUTO_GPT2_MASK |
801 OMAP3430_AUTO_MCBSP4_MASK |
802 OMAP3430_AUTO_MCBSP3_MASK |
803 OMAP3430_AUTO_MCBSP2_MASK,
804 OMAP3430_PER_MOD,
805 CM_AUTOIDLE);
806
807 if (omap_rev() > OMAP3430_REV_ES1_0) {
808 omap2_cm_write_mod_reg(
809 OMAP3430ES2_AUTO_USBHOST_MASK,
810 OMAP3430ES2_USBHOST_MOD,
811 CM_AUTOIDLE);
812 }
813
814 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG); 699 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG);
815 700
816 /* 701 /*
817 * Set all plls to autoidle. This is needed until autoidle is
818 * enabled by clockfw
819 */
820 omap2_cm_write_mod_reg(1 << OMAP3430_AUTO_IVA2_DPLL_SHIFT,
821 OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
822 omap2_cm_write_mod_reg(1 << OMAP3430_AUTO_MPU_DPLL_SHIFT,
823 MPU_MOD,
824 CM_AUTOIDLE2);
825 omap2_cm_write_mod_reg((1 << OMAP3430_AUTO_PERIPH_DPLL_SHIFT) |
826 (1 << OMAP3430_AUTO_CORE_DPLL_SHIFT),
827 PLL_MOD,
828 CM_AUTOIDLE);
829 omap2_cm_write_mod_reg(1 << OMAP3430ES2_AUTO_PERIPH2_DPLL_SHIFT,
830 PLL_MOD,
831 CM_AUTOIDLE2);
832
833 /*
834 * Enable control of expternal oscillator through 702 * Enable control of expternal oscillator through
835 * sys_clkreq. In the long run clock framework should 703 * sys_clkreq. In the long run clock framework should
836 * take care of this. 704 * take care of this.
@@ -928,8 +796,7 @@ void omap3_pm_off_mode_enable(int enable)
928 pwrst->pwrdm == core_pwrdm && 796 pwrst->pwrdm == core_pwrdm &&
929 state == PWRDM_POWER_OFF) { 797 state == PWRDM_POWER_OFF) {
930 pwrst->next_state = PWRDM_POWER_RET; 798 pwrst->next_state = PWRDM_POWER_RET;
931 WARN_ONCE(1, 799 pr_warn("%s: Core OFF disabled due to errata i583\n",
932 "%s: Core OFF disabled due to errata i583\n",
933 __func__); 800 __func__);
934 } else { 801 } else {
935 pwrst->next_state = state; 802 pwrst->next_state = state;
@@ -990,10 +857,10 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
990static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) 857static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
991{ 858{
992 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) 859 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
993 omap2_clkdm_allow_idle(clkdm); 860 clkdm_allow_idle(clkdm);
994 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && 861 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
995 atomic_read(&clkdm->usecount) == 0) 862 atomic_read(&clkdm->usecount) == 0)
996 omap2_clkdm_sleep(clkdm); 863 clkdm_sleep(clkdm);
997 return 0; 864 return 0;
998} 865}
999 866