lpm-levels: Add L3 flag to the smc call

For L3 level collapse, the secure level OS needs a flag to clear the
vote to keep L3 active. Send this flag along with L2 flag in the smc
call.

Change-Id: I79794465ff725fb0d37c3519a37a0f8cb04ed441
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
Archana Sathyakumar 2015-03-06 13:20:28 -07:00 committed by Maulik Shah
parent a81bc97fdd
commit ddfac78378
4 changed files with 29 additions and 8 deletions

View File

@ -278,7 +278,7 @@ static int parse_cluster_params(struct device_node *node, struct lpm_cluster *c)
struct lpm_match match_tbl[] = {
{"l2", set_l2_mode},
{"cci", set_system_mode},
{"l3", set_system_mode},
{"l3", set_l3_mode},
{"cbf", set_system_mode},
};

View File

@ -207,28 +207,31 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
{
int lpm = mode;
int rc = 0;
struct low_power_ops *cpu_ops = per_cpu(cpu_cluster,
smp_processor_id())->lpm_dev;
if (ops->tz_flag == MSM_SCM_L2_OFF ||
ops->tz_flag == MSM_SCM_L2_GDHS)
if (cpu_ops->tz_flag & MSM_SCM_L2_OFF ||
cpu_ops->tz_flag & MSM_SCM_L2_GDHS)
coresight_cti_ctx_restore();
switch (mode) {
case MSM_SPM_MODE_POWER_COLLAPSE:
ops->tz_flag = MSM_SCM_L2_OFF;
cpu_ops->tz_flag = MSM_SCM_L2_OFF;
coresight_cti_ctx_save();
break;
case MSM_SPM_MODE_GDHS:
ops->tz_flag = MSM_SCM_L2_GDHS;
cpu_ops->tz_flag = MSM_SCM_L2_GDHS;
coresight_cti_ctx_save();
break;
case MSM_SPM_MODE_CLOCK_GATING:
case MSM_SPM_MODE_RETENTION:
case MSM_SPM_MODE_DISABLED:
ops->tz_flag = MSM_SCM_L2_ON;
cpu_ops->tz_flag = MSM_SCM_L2_ON;
break;
default:
ops->tz_flag = MSM_SCM_L2_ON;
cpu_ops->tz_flag = MSM_SCM_L2_ON;
lpm = MSM_SPM_MODE_DISABLED;
break;
}
@ -245,6 +248,22 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
return rc;
}
int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
{
struct low_power_ops *cpu_ops = per_cpu(cpu_cluster,
smp_processor_id())->lpm_dev;
switch (mode) {
case MSM_SPM_MODE_POWER_COLLAPSE:
cpu_ops->tz_flag |= MSM_SCM_L3_PC_OFF;
break;
default:
break;
}
return msm_spm_config_low_power_mode(ops->spm, mode, notify_rpm);
}
int set_system_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
{
if (mode == MSM_SPM_MODE_CLOCK_GATING)

View File

@ -94,6 +94,7 @@ struct lpm_cluster {
int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
void lpm_suspend_wake_time(uint64_t wakeup_time);
int set_system_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
struct lpm_cluster *lpm_of_parse_cluster(struct platform_device *pdev);
void free_cluster_node(struct lpm_cluster *cluster);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
* Author: San Mehat <san@android.com>
*
* This software is licensed under the terms of the GNU General Public
@ -45,6 +45,7 @@ enum msm_pm_l2_scm_flag {
MSM_SCM_L2_OFF = 1,
MSM_SCM_L2_RET = 2,
MSM_SCM_L2_GDHS = 3,
MSM_SCM_L3_PC_OFF = 4,
};
#define MSM_PM_MODE(cpu, mode_nr) ((cpu) * MSM_PM_SLEEP_MODE_NR + (mode_nr))