main: Disable battery watchdog

This allows us to run without a battery.  Otherwise, it would reboot
after about five seconds.
This commit is contained in:
Sean Cross 2014-09-09 14:59:07 +08:00
parent 4a2c43cde7
commit 05532408dc

26
main.c
View file

@ -193,16 +193,34 @@ static int list_registers(void)
return 0; return 0;
} }
#define PMIC_BASE 0xa0700a00
#define PMIC_CTRL0 (PMIC_BASE + 0x04)
#define PMIC_CTRL1 (PMIC_BASE + 0x04)
#define PMIC_CTRL2 (PMIC_BASE + 0x08)
#define PMIC_CTRL3 (PMIC_BASE + 0x0c)
#define PMIC_CTRL4 (PMIC_BASE + 0x10)
#define PMIC_CTRL5 (PMIC_BASE + 0x14)
#define PMIC_CTRL6 (PMIC_BASE + 0x18)
#define PMIC_CTRL7 (PMIC_BASE + 0x1c)
#define PMIC_CTRL8 (PMIC_BASE + 0x20)
#define PMIC_CTRL9 (PMIC_BASE + 0x24)
#define PMIC_CTRL10 (PMIC_BASE + 0x28)
static int do_init(void) static int do_init(void)
{ {
list_registers(); list_registers();
/* Kick WDT */ /* Disable system watchdog */
writel(0x1971, 0xa0030008);
/* Disable WDT */
writel(0x2200, 0xa0030000); writel(0x2200, 0xa0030000);
/* Enable USB Download mode (required for no-battery operation) */
writew(0x8000, PMIC_CTRL10);
/* Disable battery watchdog */
writew(0x2, PMIC_CTRL9);
serial_puts("\n\nFernly shell\n"); serial_puts("\n\nFernly shell\n");
return 0; return 0;