The Soc will enter to different boot mode(defined in asm/arch-rockchip/boot_mode.h)
according to the value from this register.
+config ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON
+ bool "Disable device boot on power plug-in"
+ depends on PMIC_RK8XX
+ 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 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 ROCKCHIP_STIMER
bool "Rockchip STIMER support"
default y
.ops = &rk8xx_sysreset_ops,
};
+/* In the event of a plug-in and the appropriate option has been
+ * selected, we simply shutdown instead of continue the normal boot
+ * process. Please note the rk808 is not supported as it doesn't
+ * have the appropriate register.
+ */
+void rk8xx_off_for_plugin(struct udevice *dev)
+{
+ struct rk8xx_priv *priv = dev_get_priv(dev);
+
+ switch (priv->variant) {
+ case RK805_ID:
+ case RK816_ID:
+ case RK818_ID:
+ if (pmic_reg_read(dev, RK8XX_ON_SOURCE) & RK8XX_ON_PLUG_IN) {
+ printf("Power Off due to plug-in event\n");
+ pmic_clrsetbits(dev, REG_DEVCTRL, 0, BIT(0));
+ }
+ break;
+ case RK809_ID:
+ case RK817_ID:
+ if (pmic_reg_read(dev, RK817_ON_SOURCE) & RK8XX_ON_PLUG_IN) {
+ printf("Power Off due to plug-in event\n");
+ pmic_clrsetbits(dev, RK817_REG_SYS_CFG3, 0,
+ BIT(0));
+ }
+ break;
+ default:
+ printf("PMIC RK%x: Cannot read boot reason.\n",
+ priv->variant);
+ }
+}
+
static struct reg_data rk817_init_reg[] = {
/* enable the under-voltage protection,
* the under-voltage protection will shutdown the LDO3 and reset the PMIC
pmic_reg_read(dev, on_source),
pmic_reg_read(dev, off_source));
printf("\n");
+ if (CONFIG_IS_ENABLED(ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON))
+ rk8xx_off_for_plugin(dev);
return 0;
}