qti/sc7180: Do shutdown handling outside qtiseclib

With an open source SPMI driver we can now remove qtiseclib involvement
in reset and shutdown handling by setting the required registers
directly.

Change-Id: I6bf1db15734048df583daa2a4ee98701c6ece621
Signed-off-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Julius Werner 2019-02-20 17:33:23 -08:00
parent f40008a4be
commit 522a22771f
7 changed files with 69 additions and 18 deletions

View File

@ -50,4 +50,7 @@ unsigned int plat_qti_my_cluster_pos(void);
void gic_set_spi_routing(unsigned int id, unsigned int irm, u_register_t mpidr);
void qti_pmic_prepare_reset(void);
void qti_pmic_prepare_shutdown(void);
#endif /* QTI_PLAT_H */

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2020, Google LLC. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <drivers/delay_timer.h>
#include <qti_plat.h>
#include <spmi_arb.h>
/*
* This driver implements PON support for PM8998-compatible PMICs. This can
* include other part numbers like PM6150.
*/
#define PON_PS_HOLD_RESET_CTL 0x85a
#define RESET_TYPE_WARM_RESET 1
#define RESET_TYPE_SHUTDOWN 4
#define PON_PS_HOLD_RESET_CTL2 0x85b
#define S2_RESET_EN BIT(7)
static void configure_ps_hold(uint32_t reset_type)
{
/* QTI recommends disabling reset for 10 cycles before reconfiguring. */
spmi_arb_write8(PON_PS_HOLD_RESET_CTL2, 0);
mdelay(1);
spmi_arb_write8(PON_PS_HOLD_RESET_CTL, reset_type);
spmi_arb_write8(PON_PS_HOLD_RESET_CTL2, S2_RESET_EN);
mdelay(1);
}
void qti_pmic_prepare_reset(void)
{
configure_ps_hold(RESET_TYPE_WARM_RESET);
}
void qti_pmic_prepare_shutdown(void)
{
configure_ps_hold(RESET_TYPE_SHUTDOWN);
}

View File

@ -9,6 +9,8 @@
#include <arch_helpers.h>
#include <bl31/bl31.h>
#include <common/debug.h>
#include <drivers/delay_timer.h>
#include <lib/mmio.h>
#include <lib/psci/psci.h>
#include <platform.h>
@ -204,14 +206,25 @@ __dead2 void qti_domain_power_down_wfi(const psci_power_state_t *target_state)
/* We should never reach here */
}
static __dead2 void assert_ps_hold(void)
{
mmio_write_32(QTI_PS_HOLD_REG, 0);
mdelay(1000);
/* Should be dead before reaching this. */
panic();
}
__dead2 void qti_system_off(void)
{
qtiseclib_psci_system_off();
qti_pmic_prepare_shutdown();
assert_ps_hold();
}
__dead2 void qti_system_reset(void)
{
qtiseclib_psci_system_reset();
qti_pmic_prepare_reset();
assert_ps_hold();
}
void qti_get_sys_suspend_power_state(psci_power_state_t *req_state)

View File

@ -78,10 +78,6 @@ void qtiseclib_psci_cpu_standby(uint8_t pwr_state);
void qtiseclib_psci_node_power_off(const uint8_t *states);
void qtiseclib_psci_node_suspend(const uint8_t *states);
void qtiseclib_psci_node_suspend_finish(const uint8_t *states);
__attribute__ ((noreturn))
void qtiseclib_psci_system_off(void);
__attribute__ ((noreturn))
void qtiseclib_psci_system_reset(void);
void qtiseclib_disable_cluster_coherency(uint8_t state);
#endif /* QTISECLIB_INTERFACE_H */

View File

@ -108,18 +108,6 @@ void qtiseclib_psci_node_suspend_finish(const uint8_t *states)
{
}
void qtiseclib_psci_system_off(void)
{
while (1) {
};
}
void qtiseclib_psci_system_reset(void)
{
while (1) {
};
}
void qtiseclib_disable_cluster_coherency(uint8_t state)
{
}

View File

@ -173,4 +173,10 @@
*/
#define BL31_LIMIT (BL31_BASE + BL31_SIZE)
/*----------------------------------------------------------------------------*/
/* AOSS registers */
/*----------------------------------------------------------------------------*/
#define QTI_PS_HOLD_REG 0x0C264000
/*----------------------------------------------------------------------------*/
#endif /* PLATFORM_DEF_H */

View File

@ -51,6 +51,7 @@ QTI_BL31_SOURCES := $(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_helpers.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_kryo4_silver.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_kryo4_gold.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_uart_console.S \
$(QTI_PLAT_PATH)/common/src/pm8998.c \
$(QTI_PLAT_PATH)/common/src/qti_stack_protector.c \
$(QTI_PLAT_PATH)/common/src/qti_common.c \
$(QTI_PLAT_PATH)/common/src/qti_bl31_setup.c \
@ -60,6 +61,7 @@ QTI_BL31_SOURCES := $(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_helpers.S \
$(QTI_PLAT_PATH)/common/src/qti_topology.c \
$(QTI_PLAT_PATH)/common/src/qti_pm.c \
$(QTI_PLAT_PATH)/common/src/qti_rng.c \
$(QTI_PLAT_PATH)/common/src/spmi_arb.c \
$(QTI_PLAT_PATH)/qtiseclib/src/qtiseclib_cb_interface.c \