1 /* 2 * Copyright (c) 2020, Google LLC. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <drivers/delay_timer.h> 8 9 #include <qti_plat.h> 10 #include <spmi_arb.h> 11 12 /* 13 * This driver implements PON support for PM8998-compatible PMICs. This can 14 * include other part numbers like PM6150. 15 */ 16 17 #define RESET_TYPE_WARM_RESET 1 18 #define RESET_TYPE_SHUTDOWN 4 19 20 #define S2_RESET_EN BIT(7) 21 configure_ps_hold(uint32_t reset_type)22static void configure_ps_hold(uint32_t reset_type) 23 { 24 /* QTI recommends disabling reset for 10 cycles before reconfiguring. */ 25 spmi_arb_write8(PON_PS_HOLD_RESET_CTL2, 0); 26 mdelay(1); 27 28 spmi_arb_write8(PON_PS_HOLD_RESET_CTL, reset_type); 29 spmi_arb_write8(PON_PS_HOLD_RESET_CTL2, S2_RESET_EN); 30 mdelay(1); 31 } 32 qti_pmic_prepare_reset(void)33void qti_pmic_prepare_reset(void) 34 { 35 configure_ps_hold(RESET_TYPE_WARM_RESET); 36 } 37 qti_pmic_prepare_shutdown(void)38void qti_pmic_prepare_shutdown(void) 39 { 40 configure_ps_hold(RESET_TYPE_SHUTDOWN); 41 } 42