[PATCH] drivers: mfd: da9063: Add restart notifier implementation

Adam Thomson Adam.Thomson.Opensource at diasemi.com
Thu Sep 30 02:28:37 PDT 2021


On 30 September 2021 08:51, David Abdurachmanov wrote:

> > Regardless of this though, the consensus right now would be to use the RTC as
> a
> > wake event to restart the platform. An alarm can be set for a couple of seconds
> > into the future (or longer if required) and that would provide the event
> > required to come up from powerdown/shutdown, in the absence of
> AUTOBOOT being
> > set in OTP. I believe this would be the safest route to take in this case. You
> > can then just use the SHUTDOWN bit on CONTROL_F to take down the board.
> 
> Today I was looking into OpenBSD DA9063 drivers and they might be
> doing what you described for the reset.
> 
> dev/fdt/dapmic.c
> 
> [..]
> 241 void
> 242 dapmic_reset(void)
> 243 {
> 244     struct dapmic_softc *sc = dapmic_cd.cd_devs[0];
> 245     uint8_t reg;
> 246
> 247     /* Enable tick alarm wakeup with a one second interval. */
> 248     reg = dapmic_reg_read(sc, ALARM_MO);
> 249     reg &= ~ALARM_MO_TICK_TYPE;
> 250     reg |= ALARM_MO_TICK_WAKE;
> 251     dapmic_reg_write(sc, ALARM_MO, reg);
> 252
> 253     /* Enable tick function. */
> 254     reg = dapmic_reg_read(sc, ALARM_Y);
> 255     reg |= ALARM_Y_TICK_ON;
> 256     dapmic_reg_write(sc, ALARM_Y, reg);
> 257
> 258     /* Clear events such that we wake up again. */
> 259     dapmic_reg_write(sc, EVENT_A, dapmic_reg_read(sc, EVENT_A));
> 260     dapmic_reg_write(sc, CONTROL_F, CONTROL_F_SHUTDOWN);
> 261 }
> [..]

This is using the tick alarm which is repeating. That is one option or
alternatively there's a one-shot alarm option which can be used which might be
preferable as you won't see continues events from the RTC when the system boots
up again.


More information about the linux-riscv mailing list