diff options
| author | Jayachandran C <jnair@caviumnetworks.com> | 2018-02-28 05:52:20 -0500 |
|---|---|---|
| committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2018-03-03 09:52:32 -0500 |
| commit | 93ac3deb7c220cbcec032a967220a1f109d58431 (patch) | |
| tree | 8c2778bf30f3104d9a2dfecb008e7cdcddf3e0b3 | |
| parent | 7bd3e7b743956afbec30fb525bc3c5e22e3d475c (diff) | |
watchdog: sbsa: use 32-bit read for WCV
According to SBSA spec v3.1 section 5.3:
All registers are 32 bits in size and should be accessed using
32-bit reads and writes. If an access size other than 32 bits
is used then the results are IMPLEMENTATION DEFINED.
[...]
The Generic Watchdog is little-endian
The current code uses readq to read the watchdog compare register
which does a 64-bit access. This fails on ThunderX2 which does not
implement 64-bit access to this register.
Fix this by using lo_hi_readq() that does two 32-bit reads.
Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
| -rw-r--r-- | drivers/watchdog/sbsa_gwdt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c index 316c2eb122d2..e8bd9887c566 100644 --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | */ | 50 | */ |
| 51 | 51 | ||
| 52 | #include <linux/io.h> | 52 | #include <linux/io.h> |
| 53 | #include <linux/io-64-nonatomic-lo-hi.h> | ||
| 53 | #include <linux/interrupt.h> | 54 | #include <linux/interrupt.h> |
| 54 | #include <linux/module.h> | 55 | #include <linux/module.h> |
| 55 | #include <linux/moduleparam.h> | 56 | #include <linux/moduleparam.h> |
| @@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd) | |||
| 159 | !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0)) | 160 | !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0)) |
| 160 | timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR); | 161 | timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR); |
| 161 | 162 | ||
| 162 | timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) - | 163 | timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) - |
| 163 | arch_counter_get_cntvct(); | 164 | arch_counter_get_cntvct(); |
| 164 | 165 | ||
| 165 | do_div(timeleft, gwdt->clk); | 166 | do_div(timeleft, gwdt->clk); |
