Skip to content

Commit 73ecd80

Browse files
jchandra-cavmgregkh
authored andcommitted
watchdog: sbsa: use 32-bit read for WCV
[ Upstream commit 93ac3de ] 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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 49995a2 commit 73ecd80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/watchdog/sbsa_gwdt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
*/
5151

5252
#include <linux/io.h>
53+
#include <linux/io-64-nonatomic-lo-hi.h>
5354
#include <linux/interrupt.h>
5455
#include <linux/module.h>
5556
#include <linux/moduleparam.h>
@@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd)
159160
!(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0))
160161
timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR);
161162

162-
timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) -
163+
timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) -
163164
arch_counter_get_cntvct();
164165

165166
do_div(timeleft, gwdt->clk);

0 commit comments

Comments
 (0)