diff options
-rw-r--r-- | arch/arm/mach-sunxi/Kconfig | 10 | ||||
-rw-r--r-- | board/sunxi/board.c | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 2c18cf02d1..d7f9a03152 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -785,6 +785,16 @@ config AXP_GPIO ---help--- Say Y here to enable support for the gpio pins of the axp PMIC ICs. +config AXP_DISABLE_BOOT_ON_POWERON + bool "Disable device boot on power plug-in" + depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER + default n + ---help--- + Say Y here to prevent the device from booting up because of a plug-in + event. When set, the device will boot into the SPL briefly to + determine why it was powered on, and if it was determined because of + a plug-in event instead of a button press event it will shut back off. + config VIDEO_SUNXI bool "Enable graphical uboot console on HDMI, LCD or VGA" depends on !MACH_SUN8I_A83T diff --git a/board/sunxi/board.c b/board/sunxi/board.c index d0a93da409..91463009b0 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -28,6 +28,7 @@ #include <asm/arch/dram.h> #include <asm/arch/mmc.h> #include <asm/arch/prcm.h> +#include <asm/arch/pmic_bus.h> #include <asm/arch/spl.h> #include <asm/global_data.h> #include <linux/delay.h> @@ -602,6 +603,16 @@ void sunxi_board_init(void) defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER power_failed = axp_init(); + if (IS_ENABLED(CONFIG_AXP_DISABLE_BOOT_ON_POWERON) && !power_failed) { + u8 boot_reason; + + pmic_bus_read(AXP_POWER_STATUS, &boot_reason); + if (boot_reason & AXP_POWER_STATUS_ALDO_IN) { + printf("Power on by plug-in, shutting down.\n"); + pmic_bus_write(0x32, BIT(7)); + } + } + #if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \ defined CONFIG_AXP818_POWER power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT); |