Skip to contentSkip to conversation

msm: watchdog: support watchdog on 8x60 and 8960

PATCH In review Jeff Ohlstein 4 participants 6 messages Mar 26, 2011 – Apr 28, 2011

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

PATCH 1/1 msm: watchdog: support watchdog on 8x60 and 8960

The msm watchdog driver is present in kernel only. It does not use the built-in Linux watchdog api. This is because the primary function of our watchdog is detecting bus lockups and interrupts being turned off for long periods of time. We wanted this functionality to be present regardless of the userspace the kernel is running beneath. Userspace is free to have its own watchdog implemented in software.

---
 arch/arm/mach-msm/Kconfig                       |    9 +
 arch/arm/mach-msm/Makefile                      |    1 +
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |    5 +-
 arch/arm/mach-msm/include/mach/msm_iomap-8960.h |    3 +
 arch/arm/mach-msm/include/mach/msm_iomap-8x60.h |    3 +
 arch/arm/mach-msm/include/mach/msm_iomap.h      |    1 +
 arch/arm/mach-msm/io.c                          |    4 +-
 arch/arm/mach-msm/msm_watchdog.c                |  317 +++++++++++++++++++++++
 arch/arm/mach-msm/scm.h                         |    3 +-
 9 files changed, 341 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-msm/msm_watchdog.c
arch/arm/mach-msm/Kconfig +9 -0
index 1516896..e30bab5 100644
@@ -164,6 +164,15 @@ config IOMMU_PGTABLES_L2
 	def_bool y
 	depends on MSM_IOMMU && MMU && SMP && CPU_DCACHE_DISABLE=n
 
+config MSM_WATCHDOG
+	bool "MSM Watchdog Support"
+	depends on ARCH_MSM8X60 || ARCH_MSM8960
+	help
+	  This enables the watchdog as is present on 8x60. Currently we use
+	  core 0's watchdog, and reset the entire SoC if it times out. It does
+	  not run during the bootup process, so it will not catch any early
+	  lockups.
+
 config MSM_DEBUG_UART
 	int
 	default 1 if MSM_DEBUG_UART1
arch/arm/mach-msm/Makefile +1 -0
index 5ab09a1..8b3b7c2 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o
 obj-$(CONFIG_ARCH_MSM7X30) += dma.o
 obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
 obj-$(CONFIG_ARCH_MSM8960) += clock-dummy.o
+obj-$(CONFIG_MSM_WATCHDOG) += msm_watchdog.o
 
 obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
 
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +2 -3
index 4d84be1..dfcfc38 100644
@@ -74,9 +74,8 @@
 #define MSM_GCC_PHYS	      0xC0182000
 #define MSM_GCC_SIZE	      SZ_4K
 
-#define MSM_TCSR_BASE	      IOMEM(0xE000A000)
-#define MSM_TCSR_PHYS	      0xAB600000
-#define MSM_TCSR_SIZE	      SZ_4K
+#define MSM7X30_TCSR_PHYS     0xAB600000
+#define MSM7X30_TCSR_SIZE     SZ_4K
 
 #define MSM_SHARED_RAM_BASE   IOMEM(0xE0100000)
 #define MSM_SHARED_RAM_PHYS   0x00100000
arch/arm/mach-msm/include/mach/msm_iomap-8960.h +3 -0
index 3c9d960..22ebcb9 100644
@@ -45,4 +45,7 @@
 #define MSM8960_TMR0_PHYS	0x0208A000
 #define MSM8960_TMR0_SIZE	SZ_4K
 
+#define MSM8960_TCSR_PHYS	0x1A400000
+#define MSM8960_TCSR_SIZE	SZ_4K
+
 #endif
arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +3 -0
index 3b19b8f..5a35bfe 100644
@@ -62,4 +62,7 @@
 #define MSM8X60_TMR0_PHYS	0x02040000
 #define MSM8X60_TMR0_SIZE	SZ_4K
 
+#define MSM8X60_TCSR_PHYS	0x16B00000
+#define MSM8X60_TCSR_SIZE	SZ_4K
+
 #endif
arch/arm/mach-msm/include/mach/msm_iomap.h +1 -0
index c98c759..cdb9793 100644
@@ -61,5 +61,6 @@
 #define MSM_QGIC_CPU_BASE	IOMEM(0xF0001000)
 #define MSM_TMR_BASE		IOMEM(0xF0200000)
 #define MSM_TMR0_BASE		IOMEM(0xF0201000)
+#define MSM_TCSR_BASE		IOMEM(0xF0202000)
 
 #endif
arch/arm/mach-msm/io.c +3 -1
index cec6ed1..ad25d33 100644
@@ -106,6 +106,7 @@ static struct map_desc msm8x60_io_desc[] __initdata = {
 	MSM_CHIP_DEVICE(QGIC_CPU, MSM8X60),
 	MSM_CHIP_DEVICE(TMR, MSM8X60),
 	MSM_CHIP_DEVICE(TMR0, MSM8X60),
+	MSM_CHIP_DEVICE(TCSR, MSM8X60),
 	MSM_DEVICE(ACC),
 	MSM_DEVICE(GCC),
 };
@@ -122,6 +123,7 @@ static struct map_desc msm8960_io_desc[] __initdata = {
 	MSM_CHIP_DEVICE(QGIC_CPU, MSM8960),
 	MSM_CHIP_DEVICE(TMR, MSM8960),
 	MSM_CHIP_DEVICE(TMR0, MSM8960),
+	MSM_CHIP_DEVICE(TCSR, MSM8960),
 };
 
 void __init msm_map_msm8960_io(void)
@@ -144,7 +146,7 @@ static struct map_desc msm7x30_io_desc[] __initdata = {
 	MSM_DEVICE(ACC),
 	MSM_DEVICE(SAW),
 	MSM_DEVICE(GCC),
-	MSM_DEVICE(TCSR),
+	MSM_CHIP_DEVICE(TCSR, MSM7X30),
 #ifdef CONFIG_MSM_DEBUG_UART
 	MSM_DEVICE(DEBUG_UART),
 #endif
arch/arm/mach-msm/msm_watchdog.c new file +317 -0

317 lines not on this page · raw message

arch/arm/mach-msm/scm.h +2 -1
index 00b31ea..08d393e 100644
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -14,6 +14,7 @@
 
 #define SCM_SVC_BOOT			0x1
 #define SCM_SVC_PIL			0x2
+#define SCM_SVC_UTIL			0x3
 
 extern int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
 		void *resp_buf, size_t resp_len);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw
Quoted 7 lines · Jeff Ohlstein

The msm watchdog driver is present in kernel only. It does not use the built-in Linux watchdog api. This is because the primary function of our watchdog is detecting bus lockups and interrupts being turned off for long periods of time. We wanted this functionality to be present regardless of the userspace the kernel is running beneath. Userspace is
free to have its own watchdog implemented in software.

Are you saying this is mostly a debugging facility ? The interrupts off thing I can see as just debugging, but I don't understand the bus lockups part.

Daniel

#2 lore raw
Quoted 4 lines · Daniel Walker

Are you saying this is mostly a debugging facility ? The interrupts off thing I can see as just debugging, but I don't understand the bus lockups part.

It isn't just a debugging facility. It is still beneficial to the end user in that it restarts the system if there is a bus lockup or a faulty interrupt
handler in a rarely used codepath. This is better than the alternative of draining
the battery and turning off. We want this to be turned on independent of what userspace
one is using, unless they explicitly turn it off themselves.

Jeff

---
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

#3 lore raw
Quoted 6 lines · Jeff Ohlstein
Quoted 4 lines · Daniel Walker

Are you saying this is mostly a debugging facility ? The interrupts off thing I can see as just debugging, but I don't understand the bus lockups part.

Quoted 8 lines

It isn't just a debugging facility. It is still beneficial to the end user in that it restarts the system if there is a bus lockup or a faulty interrupt
handler in a rarely used codepath. This is better than the alternative of draining
the battery and turning off. We want this to be turned on independent of what userspace
one is using, unless they explicitly turn it off themselves.

It doesn't sound too different that all the other watchdogs in drivers/watchdog/ .. Your just detecting lockups right?

Daniel

#4 lore raw
Quoted 16 lines · Daniel Walker
Quoted 6 lines · Jeff Ohlstein
Quoted 4 lines · Daniel Walker

Are you saying this is mostly a debugging facility ? The interrupts off thing I can see as just debugging, but I don't understand the bus lockups part.

Quoted 8 lines

It isn't just a debugging facility. It is still beneficial to the end user in that it restarts the system if there is a bus lockup or a faulty interrupt
handler in a rarely used codepath. This is better than the alternative of draining
the battery and turning off. We want this to be turned on independent of what userspace
one is using, unless they explicitly turn it off themselves.

Quoted 2 lines

It doesn't sound too different that all the other watchdogs in drivers/watchdog/ .. Your just detecting lockups right?

There are some watchdogs in there such as drivers/watchdog/at91sam9_wdt.c that can't be stopped once enabled so the driver sets up a soft timer in the kernel that kicks the watchdog to prevent the system rebooting.

With this approach you could have the watchdog always enabled and being kicked even if the userspace daemon wasn't running, but with the flexibility of kicking it from userspace if you wanted.

Jamie

#5 lore raw
Quoted 11 lines
Quoted 2 lines

It doesn't sound too different that all the other watchdogs in drivers/watchdog/ .. Your just detecting lockups right?

There are some watchdogs in there such as drivers/watchdog/at91sam9_wdt.c that can't be stopped once enabled so the driver sets up a soft timer in the kernel that kicks the watchdog to prevent the system rebooting.

With this approach you could have the watchdog always enabled and being kicked even if the userspace daemon wasn't running, but with the flexibility of kicking it from userspace if you wanted.

sounds like a way to do it.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html