Closed huaqianli closed 1 year ago
Just to note this clearly: This will also need the k3-wdt firmware patch - or an update of upstream once the needed changes are accepted there.
Yes, I didn't add it because I don't know which commit id will be used. Once the k3-wdt firmware is merged, I will update it.
Quick question: How do I obtain the status from the kernel driver easiest?
Quick question: How do I obtain the status from the kernel driver easiest?
From my perspective, waiting for an email from community is the easiest way. You and @BaochengSu have more experience on upstreaming, maybe you know better.
Misunderstanding: I meant how to read back the reset status on the device if this patch here is applied?
Misunderstanding: I meant how to read back the reset status on the device if this patch here is applied?
Here is an example:
void foo(void)
{
if ((fd = open("/dev/watchdog", O_RDWR)) < 0) {
printf("Failed to open watchdog\n");
return;
}
if (ioctl(fd, WDIOC_GETBOOTSTATUS, &status) < 0) {
printf("Failed to get boot status!");
}
if (WDIOF_CARDRESET & status) {
// WDIOF_CARDRESET is detected, do what you want to do
}
}
Ah, found it myself: cat /sys/class/watchdog/watchdog0/bootstatus
This patch adds the WDIOF_CARDRESET support for the TI AM65x platform watchdog, to know if the board reboot is due to a watchdog reset.
This is done via reserved memory(RAM), which indicates if specific info saved in k3-rti-wdt, triggering the watchdog reset in last boot.