Skip to contentSkip to conversation

watchdog boot status

RFC PATCH New Shubhrajyoti D 5 participants 9 messages Jan 23, 2012 – Feb 20, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover watchdog boot status

This patch series does the following
Patch 1:
Fixes the omap_prcm_get_reset_sources() for omap3/4

Patch 2:
Extends the WDIOC_GETBOOTSTATUS to support omap3/4.

Tested on omap3sdp and omap4sdp.

Rajendra Nayak (1):
ARM: omap: Fix omap_prcm_get_reset_sources() for omap3/4

Shubhrajyoti D (1):
watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

 arch/arm/mach-omap2/prcm.c    |   13 ++++++++-----
 arch/arm/mach-omap2/prm44xx.h |    3 ---
 drivers/watchdog/omap_wdt.c   |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
#1 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

This patch intends to implement the WDIOC_GETBOOTSTATUS ioctl for the omap3 and omap4.

---
 drivers/watchdog/omap_wdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/watchdog/omap_wdt.c +1 -1
index 4b33e3f..5395a4c 100644
@@ -229,7 +229,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
 		if (cpu_is_omap16xx())
 			return put_user(__raw_readw(ARM_SYSST),
 					(int __user *)arg);
-		if (cpu_is_omap24xx())
+		if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx())
 			return put_user(omap_prcm_get_reset_sources(),
 					(int __user *)arg);
 		return put_user(0, (int __user *)arg);
Signature · 1 line
1.7.1
#2 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

Quoted 3 lines · Shubhrajyoti

This patch intends to implement the WDIOC_GETBOOTSTATUS ioctl for the omap3 and omap4.

Instead of just returning the register content why not parse the RSTST register value and check if it's really a watchdog reset or not?

Quoted 27 lines
---
 drivers/watchdog/omap_wdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/watchdog/omap_wdt.c +1 -1
index 4b33e3f..5395a4c 100644
@@ -229,7 +229,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
 		if (cpu_is_omap16xx())
 			return put_user(__raw_readw(ARM_SYSST),
 					(int __user *)arg);
-		if (cpu_is_omap24xx())
+		if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx())
 			return put_user(omap_prcm_get_reset_sources(),
 					(int __user *)arg);
 		return put_user(0, (int __user *)arg);
Signature · 7 lines
1.7.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

Hi Vaibhav,

Quoted 8 lines · Vaibhav
Quoted 3 lines · Shubhrajyoti

This patch intends to implement the WDIOC_GETBOOTSTATUS ioctl for the omap3 and omap4.

Instead of just returning the register content why not parse the RSTST register value and check if it's really a watchdog reset or not?

That is what is done for 24xx and below cpus. So I thought of extending it.

Quoted 33 lines
Quoted 23 lines

---
?drivers/watchdog/omap_wdt.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)

drivers/watchdog/omap_wdt.c +1 -2
index 4b33e3f..5395a4c 100644
@@ -229,7 +229,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
 ? ? ? ? ? ? ? if (cpu_is_omap16xx())
 ? ? ? ? ? ? ? ? ? ? ? return put_user(__raw_readw(ARM_SYSST),
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (int __user *)arg);
- ? ? ? ? ? ? if (cpu_is_omap24xx())
+ ? ? ? ? ? ? if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx())
 ? ? ? ? ? ? ? ? ? ? ? return put_user(omap_prcm_get_reset_sources(),
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (int __user *)arg);
 ? ? ? ? ? ? ? return put_user(0, (int __user *)arg);
--

1.7.1

Quoted 5 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#4 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

Hi Shubhrajyoti,

Quoted 8 lines · Shubhrajyoti Datta

Hi Vaibhav,

Quoted 5 lines · Vaibhav
Quoted 3 lines · Shubhrajyoti

This patch intends to implement the WDIOC_GETBOOTSTATUS ioctl for the omap3 and omap4.

Quoted 7 lines
Quoted 3 lines

Instead of just returning the register content why not parse the RSTST register value and check if it's really a watchdog reset or not?

That is what is done for 24xx and below cpus. So I thought of extending it.

IMO they also need to be fixed then :)

Just returning the register content does not help much and looking at other implementations, like Blackfin, I am guessing this IOCTL is supposed to give a yes/no sort of result.

Regards,
Vaibhav B.

#5 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

Quoted 3 lines

Just returning the register content does not help much and looking at other implementations, like Blackfin, I am guessing this IOCTL is supposed to give a yes/no sort of result.

It needs to return WDIOF_* flags as defined in include/linux/watchdog.h. Check also Documentation/watchdog/watchdog-api.txt for further info. Yes, not all drivers follow this style, sadly.

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120124/f1918c62/attachment.sig>
#6 lore raw

RFC PATCH 1/2 watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

Quoted 6 lines · Wolfram Sang
Quoted 3 lines

Just returning the register content does not help much and looking at other implementations, like Blackfin, I am guessing this IOCTL is supposed to give a yes/no sort of result.

It needs to return WDIOF_* flags as defined in include/linux/watchdog.h. Check also Documentation/watchdog/watchdog-api.txt for further info. Yes, not all drivers follow this style, sadly.

Yes I agree.

Quoted 4 lines

Regards,

Wolfram

#7 lore raw

PATCH 2/2 ARM: omap: Fix omap_prcm_get_reset_sources() for omap3/4

In reply to Shubhrajyoti D

From: Rajendra Nayak <[email protected]>

Fix omap_prcm_get_reset_sources() for omap3 to look into the right register, and for omap4 to use the right api (and hence look into the right register).

With this, get rid of some of the unused and also wrongly defined macros for OMAP4.

Thanks to Gina Glaser for identifying the issue with the offset macros for OMAP4_RM_RSTST and OMAP4_RM_RSTTIME being swapped, which resulted in this patch.

---
 arch/arm/mach-omap2/prcm.c    |   13 ++++++++-----
 arch/arm/mach-omap2/prm44xx.h |    3 ---
 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/prcm.c +8 -5
index 626acfa..d855f40 100644
@@ -36,7 +36,7 @@
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "prm-regbits-24xx.h"
-#include "prm-regbits-44xx.h"
+#include "prcm44xx.h"
 #include "control.h"
 
 void __iomem *prm_base;
@@ -47,12 +47,15 @@ void __iomem *cm2_base;
 
 u32 omap_prcm_get_reset_sources(void)
 {
-	/* XXX This presumably needs modification for 34XX */
-	if (cpu_is_omap24xx() || cpu_is_omap34xx())
+	if (cpu_is_omap24xx())
 		return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
+	if (cpu_is_omap34xx())
+		return omap2_prm_read_mod_reg(OMAP3430_GR_MOD,
+				OMAP3_PRM_RSTST_OFFSET) & 0x7ff;
 	if (cpu_is_omap44xx())
-		return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
-
+		return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
+				OMAP4430_PRM_DEVICE_INST,
+				OMAP4_PRM_RSTST_OFFSET) & 0x7ff;
 	return 0;
 }
 EXPORT_SYMBOL(omap_prcm_get_reset_sources);
arch/arm/mach-omap2/prm44xx.h +0 -3
index 7978092..41353e4 100644
@@ -61,9 +61,6 @@
 #define OMAP4430_PRM_EMU_CM_EMU_CDOFFS		0x0000
 
 /* OMAP4 specific register offsets */
-#define OMAP4_RM_RSTCTRL				0x0000
-#define OMAP4_RM_RSTTIME				0x0004
-#define OMAP4_RM_RSTST					0x0008
 #define OMAP4_PM_PWSTCTRL				0x0000
 #define OMAP4_PM_PWSTST					0x0004
 
Signature · 1 line
1.7.1
#8 lore raw

cover watchdog boot status

In reply to Shubhrajyoti D
Quoted 21 lines · Shubhrajyoti D <shubhrajyoti <at> ti.com> writes:

This patch series does the following
Patch 1:
Fixes the omap_prcm_get_reset_sources() for omap3/4

Patch 2:
Extends the WDIOC_GETBOOTSTATUS to support omap3/4.

Tested on omap3sdp and omap4sdp.

Rajendra Nayak (1):
ARM: omap: Fix omap_prcm_get_reset_sources() for omap3/4

Shubhrajyoti D (1):
watchdog : omap_wdt : Implement WDIOC_GETBOOTSTATUS for omap3+

 arch/arm/mach-omap2/prcm.c    |   13 ++++++++-----
 arch/arm/mach-omap2/prm44xx.h |    3 ---
 drivers/watchdog/omap_wdt.c   |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo <at> vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Hi ,

I am trying to get a last reboot reason using WDIOC_GETBOOTSTATUS ioctl
call from application. Previously before applying this patch it was always returning me non-zero value no matter reboot is caused by watchdog or power on reset, so i applied this patch and added some prink statements to omap_wdt.c file and now after applying patch :
if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) this condition is successfull and omap_prcm_get_reset_sources() function is getting called and everytime i am getting 0 for ioctl call thus even if reboot is caused by watchdog it will return me 0 (Power-On-Reset). What may be the reasons behind this kind of behaviour?

This is the omap_prcm_get_reset_sources() function from arch/arm/mach-omap2/prcm.c file in my kernel source :

u32 omap_prcm_get_reset_sources(void)

{
        /* XXX This presumably needs modification for 34XX */
        if (cpu_is_omap24xx() || cpu_is_omap34xx())
                return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
        if (cpu_is_omap44xx())
                return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;

        return 0;
}