RE: [RFC PATCH] watchdog: ep93xx: Use the WatchDog Timer DriverCore.

From: H Hartley Sweeten
Date: Tue Aug 02 2011 - 13:02:44 EST


On Tuesday, August 02, 2011 2:58 AM, Wim Van Sebroeck wrote:
> Hi H Hartley,

Hello!

> [...]
>> @@ -210,43 +126,31 @@ static int __init ep93xx_wdt_init(void)
>> {
>> int err;
>>
>> - err = misc_register(&ep93xx_wdt_miscdev);
>> + ep93xx_wdd.bootstatus = readl(EP93XX_WDT_WATCHDOG);
>> + ep93xx_wdd.timeout = timeout;
>> +
>> + err = watchdog_register_device(&ep93xx_wdd);
>> + if (err)
>> + return err;
>>
>> - boot_status = __raw_readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0;
>> + setup_timer(&timer, ep93xx_timer_ping, 1);
>
> Shouldn't the bootstatus setting be:
> ep93xx_wdd.bootstatus = readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0;
> (or something similar with the WDIOF_OVERHEAT, ... flags).

The ep93xx watchdog status register doesn't line up nicely with the standard
WDIOF_* flags. The register has these bits defined:

PLSDN 6 Pulse Disable Not
OVRID 5 Software Override of HWDIS
SWDIS 4 Software Watchdog Disable
HWDIS 3 Hardware Watchdog Disable
URST 2 User Reset Detected
3KRST 1 Three-Key Reset Detected
WD 0 Watchdog Reset Detected

The original bootstatus setting just checked for the WD bit. I would like
to pass the full status register so that userspace can figure out what caused
the reset. Is this an inappropriate abuse of WDIOC_GETBOOTSTATUS?

Regards,
Hartley--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/