]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(sc7280): add support for PSCI_OS_INIT_MODE
authorMaulik Shah <quic_mkshah@quicinc.com>
Tue, 14 Feb 2023 07:33:24 +0000 (13:03 +0530)
committerWing Li <wingers@google.com>
Fri, 24 Mar 2023 02:27:21 +0000 (19:27 -0700)
Enable PSCI_OS_INIT_MODE support for sc7280.

Change-Id: If94d59190c0bd876e748cd80b2641ce7616fd817
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
plat/qti/common/src/qti_pm.c
plat/qti/sc7280/platform.mk

index ae361e97346ceb6098be90507c3dbd6fbac1b699..1405ca6fba961a4a24720c881083e15badfc6349 100644 (file)
 #define QTI_LOCAL_PSTATE_WIDTH         4
 #define QTI_LOCAL_PSTATE_MASK          ((1 << QTI_LOCAL_PSTATE_WIDTH) - 1)
 
+#if PSCI_OS_INIT_MODE
+#define QTI_LAST_AT_PLVL_MASK          (QTI_LOCAL_PSTATE_MASK <<       \
+                                        (QTI_LOCAL_PSTATE_WIDTH *      \
+                                         (PLAT_MAX_PWR_LVL + 1)))
+#endif
+
 /* Make composite power state parameter till level 0 */
 #define qti_make_pwrstate_lvl0(lvl0_state, type) \
                (((lvl0_state) << PSTATE_ID_SHIFT) | ((type) << PSTATE_TYPE_SHIFT))
@@ -88,7 +94,12 @@ int qti_validate_power_state(unsigned int power_state,
         *  search if the number of entries justify the additional complexity.
         */
        for (i = 0; !!qti_pm_idle_states[i]; i++) {
+#if PSCI_OS_INIT_MODE
+               if ((power_state & ~QTI_LAST_AT_PLVL_MASK) ==
+                   qti_pm_idle_states[i])
+#else
                if (power_state == qti_pm_idle_states[i])
+#endif
                        break;
        }
 
@@ -100,11 +111,14 @@ int qti_validate_power_state(unsigned int power_state,
        state_id = psci_get_pstate_id(power_state);
 
        /* Parse the State ID and populate the state info parameter */
-       while (state_id) {
-               req_state->pwr_domain_state[i++] = state_id &
+       for (i = QTI_PWR_LVL0; i <= PLAT_MAX_PWR_LVL; i++) {
+               req_state->pwr_domain_state[i] = state_id &
                    QTI_LOCAL_PSTATE_MASK;
                state_id >>= QTI_LOCAL_PSTATE_WIDTH;
        }
+#if PSCI_OS_INIT_MODE
+       req_state->last_at_pwrlvl = state_id & QTI_LOCAL_PSTATE_MASK;
+#endif
 
        return PSCI_E_SUCCESS;
 }
@@ -177,6 +191,18 @@ static void qti_node_power_off(const psci_power_state_t *target_state)
        }
 }
 
+#if PSCI_OS_INIT_MODE
+static int qti_node_suspend(const psci_power_state_t *target_state)
+{
+       qtiseclib_psci_node_suspend((const uint8_t *)target_state->
+                                   pwr_domain_state);
+       if (is_cpu_off(target_state)) {
+               plat_qti_gic_cpuif_disable();
+               qti_set_cpupwrctlr_val();
+       }
+       return PSCI_E_SUCCESS;
+}
+#else
 static void qti_node_suspend(const psci_power_state_t *target_state)
 {
        qtiseclib_psci_node_suspend((const uint8_t *)target_state->
@@ -186,6 +212,7 @@ static void qti_node_suspend(const psci_power_state_t *target_state)
                qti_set_cpupwrctlr_val();
        }
 }
+#endif
 
 static void qti_node_suspend_finish(const psci_power_state_t *target_state)
 {
index df07bc4a7a27b8149554fab32d68e3d223a7544f..528a1d44167662c6e87bad6e3d7abe6a0d17a17c 100644 (file)
@@ -28,6 +28,7 @@ ENABLE_PLAT_COMPAT            :=      0
 # Enable PSCI v1.0 extended state ID format
 PSCI_EXTENDED_STATE_ID :=  1
 ARM_RECOM_STATE_ID_ENC  :=  1
+PSCI_OS_INIT_MODE      :=  1
 
 COLD_BOOT_SINGLE_CPU           :=      1
 PROGRAMMABLE_RESET_ADDRESS     :=      1