I see da9063 RTC is firing nIRQ just once.
[ 2.841628] da9063-rtc da9063-rtc: registered as rtc0
[ 2.847116] da9063-rtc da9063-rtc: setting system clock to 2021-10-25T14:28:35 UTC (1635172115)
and later hwclock called once from init scripts...
63: 1 0 0 0 sifive-gpio 1 da9063-irq
65: 0 0 0 1 da9063-irq 1 ALARM
The EVENT_A register is clear
i2cget -f -y 0 0x58 0x06
If i issue
hwclock again i get timeout despite EVENT_A register holds E_ALARM bit and all other events are cleared:
+ i2cget -f -y 0 0x58 0x06
+ i2cget -f -y 0 0x58 0x07
+ i2cget -f -y 0 0x58 0x08
+ i2cget -f -y 0 0x58 0x09
However nIRQ hasn’t been fired. Moreover the MASK seems to be set correctly :
i2cget -f -y 0 0x58 0x0A
It turns out to be a bug in SiFive PLIC irqchip driver, see for detail:
I think Guo Ren will provide a quickfix.
For the impatient :
11:12AM - 28 Oct 21 UTC
enable the da9063 RTC and Watchdog.
Signed-off-by: Nikita Shubin <nikita.shubin
11:15AM - 28 Oct 21 UTC
This is a quickfix based on Guo Ren's work:
I can claim that the da9063 RTC is fully operational.
Setting RTC clock to wakeup shutdowned system:
02:09PM - 01 Nov 21 UTC
in case if threaded irq registered successfully - add da9063
as a wakeup source
sh -c "echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm"
This will do a full “reset”, actually it’s shutdown + wakeup later.
@Maquefel Do you have plans to submit changes to drivers/rtc/rtc-da9063.c upstream?
I’ve already submitted this particular patch:
Not sure everything is correct and waiting for feedback.
I see there is no reply (unless I missed something) for 2 weeks now. You might want to wait a week and ping the patch. Kernel merge window is now closed thus people should start replying.
I assume this is separate work from your OpenSBI patches to support reset on FU740?
Side note: we should really rename
sifive_unmatched, like we did in U-Boot. This rest is not FU740 specific, it’s platform specific and that’s Unmatched.
Yes surprisingly long response time, i always thought that this particular subsystem is not overwhelmed so much. I’ll ping them before the end of the week, may be earlier.
Yes indeed, the method proposed in OpenSBI patches is different - i am currently experimenting with TICK ALARM, with no recent progress, i get weird results with board being powered off and then preventing the onKEY power it back again (turns off shortly after key pressed), until cable plugged/unplugged (the BATTERY is missing).
That’s not a problem, i ll keep it in mind and introduce patch together with I2C minor reworks, in case you don’t have time for this.
@davidlt , as Adam Thomson pointed out we don’t need the sysfs entry - we can simply set alarm via:
rtcwake -m no -s 60
It comes from util-linux package so it’s hard to miss it.
@Maquefel now that
[PATCH v3] rtc: da9063: add as wakeup source is merged a few days ago could you also send a DT change patch for Unmatched? IIRC we will need
wakeup-source in DT to use sysfs knob.
@davidlt Hello David!
No we don’t need the dts entry to make “/sys/class/rtc/rtc0/wakealarm” available.
As we always have the IRQ we just add it as a wakeup source.