sf: params: Add S25FS256S_64K spi flash support
[oweals/u-boot.git] / drivers / power / axp209.c
index 71aa000daab759b459a4215c71091bcc09b75f16..731b75e50a04924a1c61ce4dada402f2cca0f64e 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/arch/pmic_bus.h>
 #include <axp_pmic.h>
 
@@ -166,5 +167,32 @@ int axp_init(void)
                        return rc;
        }
 
+       /*
+        * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting
+        * from android these are sometimes on.
+        */
+       rc = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT);
+       if (rc)
+               return rc;
+
+       rc = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
+       if (rc)
+               return rc;
+
+       rc = pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT);
+       if (rc)
+               return rc;
+
+       return 0;
+}
+
+int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       pmic_bus_write(AXP209_SHUTDOWN, AXP209_POWEROFF);
+
+       /* infinite loop during shutdown */
+       while (1) {}
+
+       /* not reached */
        return 0;
 }