target: msm8953: Add PMI632 power off sequence support
For PMI632 PS_HOLD needs to be configured only for warm reset
and it should be disabled for hard reset or shutdown.
CRs-Fixed: 2166255
Change-Id: I0368257916e10596d8859c4c882f4c63cb824e2f
Signed-off-by: Umang Agrawal <uagrawal@codeaurora.org>
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 5b1c20e..0fc517b 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017-2018, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -223,6 +223,7 @@
uint32_t pm8x41_resin_status();
void pm8x41_reset_configure(uint8_t);
void pm8994_reset_configure(uint8_t);
+void pmi632_reset_configure(uint8_t);
void pm8x41_v2_reset_configure(uint8_t);
uint8_t pmi8950_get_pmi_subtype();
int pm8x41_ldo_set_voltage(struct pm8x41_ldo *ldo, uint32_t voltage);
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 0c389eb..442bc35 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017-2018, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -389,6 +389,40 @@
return 0;
}
+void pmi632_reset_configure(uint8_t reset_type)
+{
+ /* Slave ID of pm8953 and pmi632 */
+ uint8_t slave_id[] = {0, 2};
+ uint8_t i;
+
+ /* Reset sequence
+ 1. Disable the ps hold for pm8953 and pmi632
+ 2. set reset type for both pm8953 & pmi632
+ 3. Enable ps hold for pm8953 to trigger the reset
+ */
+ /* disable PS_HOLD_RESET */
+ pm8xxx_reg_write(slave_id[0], PON_PS_HOLD_RESET_CTL2, 0x0);
+ pm8xxx_reg_write(slave_id[1], PON_PS_HOLD_RESET_CTL2, 0x0);
+
+ /* Delay needed for disable to kick in. */
+ udelay(300);
+
+ /* configure reset type */
+ for (i = 0; i < ARRAY_SIZE(slave_id); i++)
+ pm8xxx_reg_write(slave_id[i], PON_PS_HOLD_RESET_CTL, reset_type);
+
+ if (reset_type == PON_PSHOLD_WARM_RESET)
+ {
+ /* enable PS_HOLD_RESET */
+ for (i = 0; i < ARRAY_SIZE(slave_id); i++)
+ pm8xxx_reg_write(slave_id[i], PON_PS_HOLD_RESET_CTL2, BIT(S2_RESET_EN_BIT));
+ }
+ else
+ {
+ pm8xxx_reg_write(slave_id[0], PON_PS_HOLD_RESET_CTL2, BIT(S2_RESET_EN_BIT));
+ }
+}
+
void pm8994_reset_configure(uint8_t reset_type)
{
/* Slave ID of pm8994 and pmi8994 */
diff --git a/target/msm8953/init.c b/target/msm8953/init.c
index 19713a3..c2f1eb6 100644
--- a/target/msm8953/init.c
+++ b/target/msm8953/init.c
@@ -627,11 +627,6 @@
crypto_init_params(&ce_params);
}
-void pmic_reset_configure(uint8_t reset_type)
-{
- pm8994_reset_configure(reset_type);
-}
-
uint32_t target_get_pmic()
{
if (target_is_pmi_enabled()) {
@@ -646,6 +641,17 @@
}
}
+void pmic_reset_configure(uint8_t reset_type)
+{
+ uint32_t pmi_type;
+
+ pmi_type = target_get_pmic();
+ if (pmi_type == PMIC_IS_PMI632)
+ pmi632_reset_configure(reset_type);
+ else
+ pm8994_reset_configure(reset_type);
+}
+
struct qmp_reg qmp_settings[] =
{
{0x804, 0x01}, /* USB3PHY_PCIE_USB3_PCS_POWER_DOWN_CONTROL */