* [PATCH] aspeed: watchdog: Add status function
@ 2018-03-26 21:17 Eddie James
2018-03-26 22:00 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Eddie James @ 2018-03-26 21:17 UTC (permalink / raw)
To: linux-watchdog; +Cc: linux-kernel, linux, wim, joel, openbmc, Eddie James
Populate the status watchdog operation to return the "timeout status"
register of the ASPEED watchdog.
Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
---
drivers/watchdog/aspeed_wdt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index a5b8eb2..d6dd5c9 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -55,6 +55,7 @@ struct aspeed_wdt_config {
#define WDT_CTRL_WDT_INTR BIT(2)
#define WDT_CTRL_RESET_SYSTEM BIT(1)
#define WDT_CTRL_ENABLE BIT(0)
+#define WDT_TIMEOUT_STATUS 0x10
/*
* WDT_RESET_WIDTH controls the characteristics of the external pulse (if
@@ -138,6 +139,13 @@ static int aspeed_wdt_ping(struct watchdog_device *wdd)
return 0;
}
+static unsigned int aspeed_wdt_status(struct watchdog_device *wdd)
+{
+ struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
+
+ return readl(wdt->base + WDT_TIMEOUT_STATUS);
+}
+
static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
unsigned int timeout)
{
@@ -171,6 +179,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
.start = aspeed_wdt_start,
.stop = aspeed_wdt_stop,
.ping = aspeed_wdt_ping,
+ .status = aspeed_wdt_status,
.set_timeout = aspeed_wdt_set_timeout,
.restart = aspeed_wdt_restart,
.owner = THIS_MODULE,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] aspeed: watchdog: Add status function
2018-03-26 21:17 [PATCH] aspeed: watchdog: Add status function Eddie James
@ 2018-03-26 22:00 ` Guenter Roeck
2018-03-26 22:08 ` Eddie James
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2018-03-26 22:00 UTC (permalink / raw)
To: Eddie James, linux-watchdog; +Cc: linux-kernel, wim, joel, openbmc
On 03/26/2018 02:17 PM, Eddie James wrote:
> Populate the status watchdog operation to return the "timeout status"
> register of the ASPEED watchdog.
>
> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
> ---
> drivers/watchdog/aspeed_wdt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index a5b8eb2..d6dd5c9 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -55,6 +55,7 @@ struct aspeed_wdt_config {
> #define WDT_CTRL_WDT_INTR BIT(2)
> #define WDT_CTRL_RESET_SYSTEM BIT(1)
> #define WDT_CTRL_ENABLE BIT(0)
> +#define WDT_TIMEOUT_STATUS 0x10
>
> /*
> * WDT_RESET_WIDTH controls the characteristics of the external pulse (if
> @@ -138,6 +139,13 @@ static int aspeed_wdt_ping(struct watchdog_device *wdd)
> return 0;
> }
>
> +static unsigned int aspeed_wdt_status(struct watchdog_device *wdd)
> +{
> + struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
> +
> + return readl(wdt->base + WDT_TIMEOUT_STATUS);
> +}
Does the register report WDIOF_* status flags/bits as defined in the API ?
This seems more than unlikely.
Guenter
> +
> static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
> unsigned int timeout)
> {
> @@ -171,6 +179,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
> .start = aspeed_wdt_start,
> .stop = aspeed_wdt_stop,
> .ping = aspeed_wdt_ping,
> + .status = aspeed_wdt_status,
> .set_timeout = aspeed_wdt_set_timeout,
> .restart = aspeed_wdt_restart,
> .owner = THIS_MODULE,
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] aspeed: watchdog: Add status function
2018-03-26 22:00 ` Guenter Roeck
@ 2018-03-26 22:08 ` Eddie James
0 siblings, 0 replies; 3+ messages in thread
From: Eddie James @ 2018-03-26 22:08 UTC (permalink / raw)
To: Guenter Roeck, linux-watchdog; +Cc: linux-kernel, wim, joel, openbmc
On 03/26/2018 05:00 PM, Guenter Roeck wrote:
> On 03/26/2018 02:17 PM, Eddie James wrote:
>> Populate the status watchdog operation to return the "timeout status"
>> register of the ASPEED watchdog.
>>
>> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
>> ---
>> drivers/watchdog/aspeed_wdt.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/watchdog/aspeed_wdt.c
>> b/drivers/watchdog/aspeed_wdt.c
>> index a5b8eb2..d6dd5c9 100644
>> --- a/drivers/watchdog/aspeed_wdt.c
>> +++ b/drivers/watchdog/aspeed_wdt.c
>> @@ -55,6 +55,7 @@ struct aspeed_wdt_config {
>> #define WDT_CTRL_WDT_INTR BIT(2)
>> #define WDT_CTRL_RESET_SYSTEM BIT(1)
>> #define WDT_CTRL_ENABLE BIT(0)
>> +#define WDT_TIMEOUT_STATUS 0x10
>> /*
>> * WDT_RESET_WIDTH controls the characteristics of the external
>> pulse (if
>> @@ -138,6 +139,13 @@ static int aspeed_wdt_ping(struct
>> watchdog_device *wdd)
>> return 0;
>> }
>> +static unsigned int aspeed_wdt_status(struct watchdog_device *wdd)
>> +{
>> + struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
>> +
>> + return readl(wdt->base + WDT_TIMEOUT_STATUS);
>> +}
>
> Does the register report WDIOF_* status flags/bits as defined in the
> API ?
> This seems more than unlikely.
Ah, I see I'm misusing the API. It does not... I will rework.
Thanks,
Eddie
>
> Guenter
>
>> +
>> static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
>> unsigned int timeout)
>> {
>> @@ -171,6 +179,7 @@ static int aspeed_wdt_restart(struct
>> watchdog_device *wdd,
>> .start = aspeed_wdt_start,
>> .stop = aspeed_wdt_stop,
>> .ping = aspeed_wdt_ping,
>> + .status = aspeed_wdt_status,
>> .set_timeout = aspeed_wdt_set_timeout,
>> .restart = aspeed_wdt_restart,
>> .owner = THIS_MODULE,
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-26 22:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 21:17 [PATCH] aspeed: watchdog: Add status function Eddie James
2018-03-26 22:00 ` Guenter Roeck
2018-03-26 22:08 ` Eddie James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).