hw21/26: mask unwanted wakeup event by default
If events are not masked they lead to an immeditate restart of the PMIC from powerdown().
This commit is contained in:
parent
a39cba028a
commit
3a9ef955c2
|
|
@ -31,6 +31,11 @@
|
|||
#define PMIC_REG_EVENT_B 0x07
|
||||
#define PMIC_REG_EVENT_COMP1V2_MASK 0x04
|
||||
|
||||
#define PMIC_REG_IRQ_MASK_A 0x0A
|
||||
#define PMIC_REG_IRQ_MASK_B 0x0B
|
||||
#define PMIC_REG_IRQ_MASK_C 0x0C
|
||||
#define PMIC_REG_IRQ_MASK_D 0x0D
|
||||
|
||||
#define PMIC_REG_CONTROL_A 0x0E /* Control register for power states */
|
||||
#define PMIC_REG_CONTROL_D 0x11 /* Control register for blink/watchdog */
|
||||
#define PMIC_REG_GPIO14_15 0x1C /* Configuration of GPIO14/15 (mode, wake) */
|
||||
|
|
|
|||
|
|
@ -452,6 +452,15 @@ static void init_pmic_spl(void)
|
|||
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, 0);
|
||||
}
|
||||
|
||||
/* Mask unwanted IRQs to avoid accidental wakeup */
|
||||
const uint8_t mask_a = PMIC_REG_EVENT_ONKEY_MASK |
|
||||
PMIC_REG_EVENT_RTC_ALARM_MASK |
|
||||
PMIC_REG_EVENT_RTC_TICK_MASK;
|
||||
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_A, ~(mask_a) & 0x1F);
|
||||
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_B, ~PMIC_REG_EVENT_COMP1V2_MASK);
|
||||
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_C, ~0x00);
|
||||
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_D, ~0x00);
|
||||
|
||||
da9063_release_i2c_bus(bus);
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +565,7 @@ static void check_reset_reason(unsigned int reset_reason_shm_location)
|
|||
start_reason |= SR_WAKEUP;
|
||||
}
|
||||
else {
|
||||
printf("unknown reset reason\n");
|
||||
/* Unknown reset reason */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +591,7 @@ static void check_reset_reason(unsigned int reset_reason_shm_location)
|
|||
reset_reason = reset_regs->rr_value;
|
||||
}
|
||||
else {
|
||||
puts("Unknown start reason\n");
|
||||
/* Unknown start reason, assume reboot */
|
||||
start_reason = SR_REBOOT;
|
||||
reset_reason = reset_regs->rr_value;
|
||||
}
|
||||
|
|
@ -637,7 +646,7 @@ static void powerdown(void)
|
|||
bus = da9063_claim_i2c_bus();
|
||||
|
||||
/* Final call, will not return */
|
||||
da9063_set_reg(PMIC_REG_CONTROL_A, 0x00);
|
||||
(void)da9063_set_reg(PMIC_REG_CONTROL_A, 0x00);
|
||||
|
||||
da9063_release_i2c_bus(bus);
|
||||
|
||||
|
|
@ -737,6 +746,9 @@ void am33xx_spl_board_init(void)
|
|||
/* Switch on ignition gate so we can read state later */
|
||||
pmic_ignition_gate_on();
|
||||
|
||||
/* Setup PMIC */
|
||||
init_pmic_spl();
|
||||
|
||||
/*
|
||||
* If this is a power-on start, see if ignition is active.
|
||||
* If not, power down as this is considered an unwanted system start.
|
||||
|
|
@ -745,9 +757,6 @@ void am33xx_spl_board_init(void)
|
|||
stop_if_ignition_is_off();
|
||||
}
|
||||
|
||||
/* Setup PMIC */
|
||||
init_pmic_spl();
|
||||
|
||||
init_leds();
|
||||
set_status_led(1, 0); /* Red */
|
||||
set_indicator_led(1, 0); /* Red */
|
||||
|
|
|
|||
Loading…
Reference in New Issue