2021-12-01 19:01:11 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Stephan Gerhold <stephan@gerhold.net>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <arch.h>
|
|
|
|
#include <common/debug.h>
|
2021-12-01 19:04:44 +00:00
|
|
|
#include <drivers/arm/gicv2.h>
|
2021-12-01 19:01:11 +00:00
|
|
|
#include <drivers/delay_timer.h>
|
|
|
|
#include <lib/mmio.h>
|
|
|
|
#include <lib/psci/psci.h>
|
|
|
|
#include <plat/common/platform.h>
|
|
|
|
|
|
|
|
#include <msm8916_mmap.h>
|
2021-12-01 19:04:44 +00:00
|
|
|
#include "msm8916_pm.h"
|
|
|
|
|
|
|
|
static int msm8916_pwr_domain_on(u_register_t mpidr)
|
|
|
|
{
|
|
|
|
unsigned int core = MPIDR_AFFLVL0_VAL(mpidr);
|
|
|
|
|
|
|
|
VERBOSE("PSCI: Booting CPU %d\n", core);
|
|
|
|
msm8916_cpu_boot(core);
|
|
|
|
|
|
|
|
return PSCI_E_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void msm8916_pwr_domain_on_finish(const psci_power_state_t *target_state)
|
|
|
|
{
|
|
|
|
gicv2_pcpu_distif_init();
|
|
|
|
gicv2_cpuif_enable();
|
|
|
|
}
|
2021-12-01 19:01:11 +00:00
|
|
|
|
|
|
|
static void __dead2 msm8916_system_reset(void)
|
|
|
|
{
|
|
|
|
mmio_write_32(MPM_PS_HOLD, 0);
|
|
|
|
mdelay(1000);
|
|
|
|
|
|
|
|
ERROR("PSCI: System reset failed\n");
|
|
|
|
panic();
|
|
|
|
}
|
|
|
|
|
|
|
|
static const plat_psci_ops_t msm8916_psci_ops = {
|
2021-12-01 19:04:44 +00:00
|
|
|
.pwr_domain_on = msm8916_pwr_domain_on,
|
|
|
|
.pwr_domain_on_finish = msm8916_pwr_domain_on_finish,
|
2021-12-01 19:01:11 +00:00
|
|
|
.system_off = msm8916_system_reset,
|
|
|
|
.system_reset = msm8916_system_reset,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Defined and used in msm8916_helpers.S */
|
|
|
|
extern uintptr_t msm8916_entry_point;
|
|
|
|
|
|
|
|
int plat_setup_psci_ops(uintptr_t sec_entrypoint,
|
|
|
|
const plat_psci_ops_t **psci_ops)
|
|
|
|
{
|
|
|
|
msm8916_entry_point = sec_entrypoint;
|
|
|
|
*psci_ops = &msm8916_psci_ops;
|
|
|
|
return 0;
|
|
|
|
}
|