MLK-11249-3 ARM: imx: improve i.mx6ul's low power idle setting
authorAnson Huang <b20788@freescale.com>
Thu, 16 Jul 2015 13:11:28 +0000 (21:11 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:27 +0000 (14:48 -0500)
For low power idle with ARM power gated, per hardware requirement,
there must be no interrupt coming during the power down
process of ARM core, so RBC counter is enabled to hold interrupts.

However, the previous setting of RBC counter is 1, which is ~30us,
but the hardware design recommend a ~90us is required during ARM
core power down, so we update the RBC counter value to 4(~120us) here.

Previous delay loop to make sure RBC is actually enabled, 3us is
needed, but the loop value assume ARM is running @1GHz, but actually
ARM is running @24MHz now, so we need to update the loop value
according to ARM speed.

The ARM power up timing is based on IPG / 2048, IPG is 1.5MHz during
low power idle, so the total latency of cpuidle exit should be
updated accordingly.

Signed-off-by: Anson Huang <b20788@freescale.com>
(cherry picked from commit 4e1fd49da5e87c5cc23f053692e8d7648a4d4b21)

arch/arm/mach-imx/cpuidle-imx6ul.c
arch/arm/mach-imx/imx6ul_low_power_idle.S

index 7b6b491..814f533 100644 (file)
@@ -130,12 +130,12 @@ static struct cpuidle_driver imx6ul_cpuidle_driver = {
                /* LOW POWER IDLE */
                {
                        /*
-                        * RBC 31us + ARM gating 93us + RBC clear 65us
+                        * RBC 130us + ARM gating 1370us + RBC clear 65us
                         * + PLL2 relock 450us and some margin, here set
-                        * it to 650us.
+                        * it to 2100us.
                         */
-                       .exit_latency = 650,
-                       .target_residency = 1000,
+                       .exit_latency = 2100,
+                       .target_residency = 2500,
                        .enter = imx6ul_enter_wait,
                        .name = "LOW-POWER-IDLE",
                        .desc = "ARM power off",
index bd312d8..5db724e 100644 (file)
@@ -691,14 +691,14 @@ save_and_set_mmdc_io_lpm:
        /*
         * enable the RBC bypass counter here
         * to hold off the interrupts. RBC counter
-        * = 1 (30us). With this setting, the latency
+        * = 4 (120us). With this setting, the latency
         * from wakeup interrupt to ARM power up
-        * is ~40uS.
+        * is ~130uS.
         */
        ldr     r10, [r0, #PM_INFO_MX6Q_CCM_V_OFFSET]
        ldr     r3, [r10, #MX6Q_CCM_CCR]
        bic     r3, r3, #(0x3f << 21)
-       orr     r3, r3, #(0x1 << 21)
+       orr     r3, r3, #(0x4 << 21)
        str     r3, [r10, #MX6Q_CCM_CCR]
 
        /* enable the counter. */
@@ -715,7 +715,7 @@ save_and_set_mmdc_io_lpm:
 
        /*
         * now delay for a short while (3usec)
-        * ARM is at 1GHz at this point
+        * ARM is at 24MHz at this point
         * so a short loop should be enough.
         * this delay is required to ensure that
         * the RBC counter can start counting in
@@ -723,7 +723,7 @@ save_and_set_mmdc_io_lpm:
         * or in case an interrupt arrives just
         * as ARM is about to assert DSM_request.
         */
-       ldr     r4, =2000
+       ldr     r4, =50
 rbc_loop:
        subs    r4, r4, #0x1
        bne     rbc_loop