watchdog: mpc8xxx: provide boot status
authorChristophe Leroy <christophe.leroy@c-s.fr>
Mon, 17 Sep 2018 06:22:50 +0000 (06:22 +0000)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sat, 13 Oct 2018 13:19:38 +0000 (15:19 +0200)
commit38e48b718934d32d45bb9f917b3430822fca76bb
tree8cd0202885d4620d974aa0385ca2943f2fe2cfc2
parent59c66636aec742abd7652fb4b4a4e5995ee7f444
watchdog: mpc8xxx: provide boot status

mpc8xxx watchdog driver supports the following platforms:
- mpc8xx
- mpc83xx
- mpc86xx

Those three platforms have a 32 bits register which provides the
reason of the last boot, including whether it was caused by the
watchdog.

mpc8xx: Register RSR, bit SWRS (bit 3)
mpc83xx: Register RSR, bit SWRS (bit 28)
mpc86xx: Register RSTRSCR, bit WDT_RR (bit 11)

This patch maps the register as defined in the device tree and updates
wdt.bootstatus based on the value of the watchdog related bit. Then
the information can be retrieved via the WDIOC_GETBOOTSTATUS ioctl.

Hereunder is an example of devicetree for mpc8xx,
the Reset Status Register being at offset 0x288:

WDT: watchdog@0 {
compatible = "fsl,mpc823-wdt";
reg = <0x0 0x10 0x288 0x4>;
};

On the mpc83xx, RSR is at offset 0x910
On the mpc86xx, RSTRSCR is at offset 0xe0094

Suggested-by: Radu Rendec <radu.rendec@gmail.com>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr> # On mpc885
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/mpc8xxx_wdt.c