The AXP805 PMIC used with H6 is capable of shutting down the system.
Add support for using it to shut down the system power.
The original placeholder power off code is moved to A64 code, as it's
still TODO to implement PMIC operations for A64.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
/* Turn off all secondary CPUs */
sunxi_disable_secondary_cpus(plat_my_core_pos());
- ERROR("PSCI: Full shutdown not implemented, halting\n");
- wfi();
- panic();
+ sunxi_power_down();
}
static void __dead2 sunxi_system_reset(void)
void sunxi_pmic_setup(void);
void sunxi_security_setup(void);
+void __dead2 sunxi_power_down(void);
+
#endif /* __SUNXI_PRIVATE_H__ */
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <arch_helpers.h>
#include <debug.h>
int sunxi_pmic_setup(void)
return 0;
}
+
+void __dead2 sunxi_power_down(void)
+{
+ ERROR("PSCI: Full shutdown not implemented, halting\n");
+ wfi();
+ panic();
+}
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <arch_helpers.h>
#include <debug.h>
#include <delay_timer.h>
#include <errno.h>
return 0;
}
+
+void __dead2 sunxi_power_down(void)
+{
+ uint8_t val;
+
+ switch (pmic) {
+ case AXP805:
+ val = 0x26; /* Default value for REG 32H */
+ axp_i2c_read(AXP805_ADDR, 0x32, &val);
+ val |= 0x80;
+ axp_i2c_write(AXP805_ADDR, 0x32, val);
+ break;
+ default:
+ break;
+ }
+
+ udelay(1000);
+ ERROR("PSCI: Cannot communicate with PMIC, halting\n");
+ wfi();
+ panic();
+}