From b67a7c7c47e1272f1dc0d904feddd10f0110bb36 Mon Sep 17 00:00:00 2001 From: Varun Wadekar Date: Fri, 8 Jan 2016 17:38:51 -0800 Subject: [PATCH] Tegra186: support for the latest platform port handlers This patch adds support for the newer platform handler functions. Commit I6db74b020b141048b6b8c03e1bef7ed8f72fd75b merges the upstream code which has already moved all the upstream supported platforms over to these handler functions. Change-Id: I621eff038f3c0dc1b90793edcd4dd7c71b196045 Signed-off-by: Varun Wadekar --- plat/nvidia/tegra/include/t186/tegra_def.h | 4 +-- .../tegra/soc/t186/plat_psci_handlers.c | 32 +++++++------------ plat/nvidia/tegra/soc/t186/plat_setup.c | 17 ++++++++++ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/plat/nvidia/tegra/include/t186/tegra_def.h b/plat/nvidia/tegra/include/t186/tegra_def.h index 10fea1158..16615a853 100644 --- a/plat/nvidia/tegra/include/t186/tegra_def.h +++ b/plat/nvidia/tegra/include/t186/tegra_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -37,7 +37,7 @@ * This value is used by the PSCI implementation during the `SYSTEM_SUSPEND` * call as the `state-id` field in the 'power state' parameter. ******************************************************************************/ -#define PLAT_SYS_SUSPEND_STATE_ID 0 +#define PSTATE_ID_SOC_POWERDN 1 /******************************************************************************* * Implementation defined ACTLR_EL3 bit definitions diff --git a/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c b/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c index d1e469dea..aa4291a65 100644 --- a/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c +++ b/plat/nvidia/tegra/soc/t186/plat_psci_handlers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -40,22 +40,28 @@ #include #include -int32_t tegra_soc_validate_power_state(unsigned int power_state) +int32_t tegra_soc_validate_power_state(unsigned int power_state, + psci_power_state_t *req_state) { + int pwr_lvl = psci_get_pstate_pwrlvl(power_state); + /* Sanity check the requested afflvl */ if (psci_get_pstate_type(power_state) == PSTATE_TYPE_STANDBY) { /* * It's possible to enter standby only on affinity level 0 i.e. * a cpu on Tegra. Ignore any other affinity level. */ - if (psci_get_pstate_afflvl(power_state) != MPIDR_AFFLVL0) + if (pwr_lvl != MPIDR_AFFLVL0) return PSCI_E_INVALID_PARAMS; + + /* power domain in standby state */ + req_state->pwr_domain_state[pwr_lvl] = PLAT_MAX_RET_STATE; } return PSCI_E_SUCCESS; } -int tegra_soc_prepare_cpu_on(unsigned long mpidr) +int tegra_soc_pwr_domain_on(u_register_t mpidr) { int target_cpu = mpidr & MPIDR_CPU_MASK; int target_cluster = (mpidr & MPIDR_CLUSTER_MASK) >> @@ -74,23 +80,7 @@ int tegra_soc_prepare_cpu_on(unsigned long mpidr) return PSCI_E_SUCCESS; } -int tegra_soc_prepare_cpu_on_finish(unsigned long mpidr) -{ - /* - * Check if we are exiting from SOC_POWERDN. - */ - if (tegra_system_suspended()) { - - /* - * System resume complete. - */ - tegra_pm_system_suspend_exit(); - } - - return PSCI_E_SUCCESS; -} - -int tegra_soc_prepare_cpu_off(unsigned long mpidr) +int tegra_soc_pwr_domain_off(const psci_power_state_t *target_state) { cpu_context_t *ctx = cm_get_context(NON_SECURE); gp_regs_t *gp_regs = get_gpregs_ctx(ctx); diff --git a/plat/nvidia/tegra/soc/t186/plat_setup.c b/plat/nvidia/tegra/soc/t186/plat_setup.c index f88478d8b..626035119 100644 --- a/plat/nvidia/tegra/soc/t186/plat_setup.c +++ b/plat/nvidia/tegra/soc/t186/plat_setup.c @@ -32,6 +32,23 @@ #include #include +/******************************************************************************* + * The Tegra power domain tree has a single system level power domain i.e. a + * single root node. The first entry in the power domain descriptor specifies + * the number of power domains at the highest power level. + ******************************************************************************* + */ +const unsigned char tegra_power_domain_tree_desc[] = { + /* No of root nodes */ + 1, + /* No of clusters */ + PLATFORM_CLUSTER_COUNT, + /* No of CPU cores - cluster0 */ + PLATFORM_MAX_CPUS_PER_CLUSTER, + /* No of CPU cores - cluster1 */ + PLATFORM_MAX_CPUS_PER_CLUSTER +}; + /* * Table of regions to map using the MMU. */