Skip to contentSkip to conversation

wdt: Add support for PowerQUICC watchdog

PATCH/RFCv2 Jochen Friedrich 2 participants 4 messages Jan 17, 2008

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

The PowerQUICC series has a watchdog which can be activated by the boot loader and then needs to be reset in regular intervals. Once the watchdog is enabled, it can't be disabled anymore. This patch adds support for this kind of watchdog. An early init function is provided to manually reset the watchdog in early board setup. Later, a kernel timer is used to reset the watchdog until the watchdog driver is opened from user space. This replaces mpc8xx_wdt.c (only usable for ARCH=ppc) and mpc83xx_wdt.c (untested on this platform).

---

arch/powerpc/platforms/8xx/mpc86xads_setup.c |    5 +
arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 +
arch/powerpc/sysdev/Makefile                 |    3 +
arch/powerpc/sysdev/pq_wdt.c                 |  203 +++++++++++++++++++++++
arch/powerpc/sysdev/pq_wdt.h                 |   28 ++++
drivers/watchdog/Kconfig                     |   13 ++-
drivers/watchdog/Makefile                    |    1 +
drivers/watchdog/pq_wdt.c                    |  225 ++++++++++++++++++++++++++
8 files changed, 482 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/sysdev/pq_wdt.c
create mode 100644 arch/powerpc/sysdev/pq_wdt.h
create mode 100644 drivers/watchdog/pq_wdt.c

arch/powerpc/platforms/8xx/mpc86xads_setup.c +0 -0
index d2927a4..b65d28d 100644
@@ -28,6 +28,7 @@

#include <asm/udbg.h>

#include <sysdev/commproc.h>
+#include <sysdev/pq_wdt.h>

#include "mpc86xads.h"

@@ -111,6 +112,10 @@ static void __init mpc86xads_setup_arch(void)

	clrbits32(bcsr_io, BCSR1_RS232EN_1 | BCSR1_RS232EN_2 | BCSR1_ETHEN);
	iounmap(bcsr_io);

+
+#if defined(CONFIG_PQ_WDT) || defined(CONFIG_PQ_WDT_MODULE)
+ pq_wdt_early_init();
+#endif
}

static int __init mpc86xads_probe(void)

arch/powerpc/platforms/8xx/mpc885ads_setup.c +0 -0
index 2cf1b6a..f076b67 100644
@@ -41,6 +41,7 @@

#include <asm/udbg.h>

#include <sysdev/commproc.h>
+#include <sysdev/pq_wdt.h>

static u32 __iomem *bcsr, *bcsr5;

@@ -246,6 +247,10 @@ static void __init mpc885ads_setup_arch(void)

	m8xx_pcmcia_ops.hw_ctrl = pcmcia_hw_setup;
	m8xx_pcmcia_ops.voltage_set = pcmcia_set_voltage;

#endif
+
+#if defined(CONFIG_PQ_WDT) || defined(CONFIG_PQ_WDT_MODULE)
+ pq_wdt_early_init();
+#endif
}

static int __init mpc885ads_probe(void)

arch/powerpc/sysdev/Makefile +0 -0
index 9a20ef4..e5ae1c3 100644
@@ -38,5 +38,8 @@ obj-$(CONFIG_CPM)		+= cpm_common.o

obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o
obj-$(CONFIG_PPC_DCR) += dcr.o
obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o
+ifneq ($(CONFIG_PQ_WDT),)
+obj-y += pq_wdt.o
+endif
obj-$(CONFIG_UCODE_PATCH) += micropatch.o
endif

arch/powerpc/sysdev/pq_wdt.c new file +203 -0

203 lines not on this page · raw message

arch/powerpc/sysdev/pq_wdt.h new file +28 -0
new file mode 100644
index 0000000..6a370da
@@ -0,0 +1,28 @@
+/*
+ * Author: Florian Schirmer <[email protected]>
+ *
+ * 2002 (c) Florian Schirmer <[email protected]> This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ *
+ * 2007,2008 (c) Jochen Friedrich <[email protected]> ported to ARCH=powerpc and
+ * extended to be useful on any Power QUICC 1/2/2pro which have the same
+ * style of watchdog.
+ */
+#ifndef _POWERPC_SYSDEV_PQ_WDT_H
+#define _POWERPC_SYSDEV_PQ_WDT_H
+
+#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
+#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
+#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
+
+extern int pq_wdt_get_timeout(void);
+extern void pq_wdt_reset(void);
+extern void pq_wdt_install_timer(void);
+extern void pq_wdt_stop_timer(void);
+extern int pq_wdt_setup(int);
+extern int pq_wdt_present(void);
+extern int pq_wdt_early_init(void);
+
+#endif				/* _POWERPC_SYSDEV_PQ_WDT_H */
drivers/watchdog/Kconfig +0 -0
index 52dff40..bc1c513 100644
@@ -649,7 +649,18 @@ config MPC5200_WDT
 

config 8xx_WDT
tristate "MPC8xx Watchdog Timer"
- depends on 8xx
+ depends on 8xx && ! OF
+
+config PQ_WDT
+ tristate "Power QUICC Watchdog Timer"
+ depends on (8xx || PPC_82xx || PPC_83xx) && OF
+ default y
+ help

+	  Watchdog driver for Power QUICC 1/2/2pro style watchdog drivers.
+	  You should really select this unless your boot loader turns
+	  off the watchdog. As the watchdog is turned on by default and
+	  can be turned on/off only once after reboot, your board won't
+	  run otherwise. Say 'M' if unsure.

config 83xx_WDT
tristate "MPC83xx Watchdog Timer"

drivers/watchdog/Makefile +0 -0
index 87483cc..8005cc8 100644
@@ -98,6 +98,7 @@ obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
 

# POWERPC Architecture
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
+obj-$(CONFIG_PQ_WDT) += pq_wdt.o
obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o

drivers/watchdog/pq_wdt.c new file +225 -0

225 lines not on this page · raw message

Signature · 1 line
1.5.3.8
#1 lore raw
Quoted 8 lines · Jochen Friedrich

The PowerQUICC series has a watchdog which can be activated by the boot loader and then needs to be reset in regular intervals. Once the watchdog is enabled, it can't be disabled anymore. This patch adds support for this kind of watchdog. An early init function is provided to manually reset the watchdog in early board setup. Later, a kernel timer is used to reset the watchdog until the watchdog driver is opened from user space. This replaces mpc8xx_wdt.c (only usable for ARCH=ppc) and mpc83xx_wdt.c (untested on this platform).

Why are you commenting on mpc83xx_wdt with respect to pq1_wdt?

Also, is this driver just for PQ1 platforms or PQ1 & PQ2? If its just pq1 we should probably call it pq1_wdt*

Quoted 13 lines

---

arch/powerpc/platforms/8xx/mpc86xads_setup.c |    5 +
arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 +
arch/powerpc/sysdev/Makefile                 |    3 +
arch/powerpc/sysdev/pq_wdt.c                 |  203 +++++++++++++++++ 
++++++
arch/powerpc/sysdev/pq_wdt.h                 |   28 ++++
drivers/watchdog/Kconfig                     |   13 ++-
drivers/watchdog/Makefile                    |    1 +
drivers/watchdog/pq_wdt.c                    |  225 +++++++++++++++++ 
+++++++++
8 files changed, 482 insertions(+), 1 deletions(-)
Quoted 3 lines

create mode 100644 arch/powerpc/sysdev/pq_wdt.c
create mode 100644 arch/powerpc/sysdev/pq_wdt.h
create mode 100644 drivers/watchdog/pq_wdt.c

What are the bits in sysdev/pq_wdt.{c,h}. Why aren't these just in drivers/watchdog?

- k

#2 lore raw

Hi Kumar,

Quoted 3 lines

Why are you commenting on mpc83xx_wdt with respect to pq1_wdt?

Also, is this driver just for PQ1 platforms or PQ1 & PQ2? If its just pq1 we should probably call it pq1_wdt*

It should be for pq1, pq2 and pq2pro. However, i only have the possibility to test this on pq1.

Quoted 15 lines
Quoted 11 lines
arch/powerpc/platforms/8xx/mpc86xads_setup.c |    5 +
arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 +
arch/powerpc/sysdev/Makefile                 |    3 +
arch/powerpc/sysdev/pq_wdt.c                 |  203 
+++++++++++++++++++++++
arch/powerpc/sysdev/pq_wdt.h                 |   28 ++++
drivers/watchdog/Kconfig                     |   13 ++-
drivers/watchdog/Makefile                    |    1 +
drivers/watchdog/pq_wdt.c                    |  225 
++++++++++++++++++++++++++
8 files changed, 482 insertions(+), 1 deletions(-)
Quoted 3 lines

create mode 100644 arch/powerpc/sysdev/pq_wdt.c create mode 100644 arch/powerpc/sysdev/pq_wdt.h create mode 100644 drivers/watchdog/pq_wdt.c

Quoted 1 line

What are the bits in sysdev/pq_wdt.{c,h}. Why aren't these just in drivers/watchdog?

These are the parts needed to boot a device with activated watchdog. If a bootloader like u-boot activates the watchdog, it can't be deactivated again and needs to be reset at regular intervals. This is done using a kernel timer.
The driver in drivers/watchdog disables the timer as soon as the wdt device
is opened.

Thanks,
Jochen

#3 lore raw
Quoted 22 lines · Jochen Friedrich

Hi Kumar,

Quoted 2 lines

Why are you commenting on mpc83xx_wdt with respect to pq1_wdt?
Also, is this driver just for PQ1 platforms or PQ1 & PQ2? If its just pq1 we should probably call it pq1_wdt*

It should be for pq1, pq2 and pq2pro. However, i only have the possibility to test this on pq1.

Quoted 14 lines
Quoted 14 lines
arch/powerpc/platforms/8xx/mpc86xads_setup.c |    5 +
arch/powerpc/platforms/8xx/mpc885ads_setup.c |    5 +
arch/powerpc/sysdev/Makefile                 |    3 +
arch/powerpc/sysdev/pq_wdt.c                 |  203 +++++++++++++++ 
++++++++
arch/powerpc/sysdev/pq_wdt.h                 |   28 ++++
drivers/watchdog/Kconfig                     |   13 ++-
drivers/watchdog/Makefile                    |    1 +
drivers/watchdog/pq_wdt.c                    |  225 +++++++++++++++ 
+++++++++++
8 files changed, 482 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/sysdev/pq_wdt.c create mode 100644 arch/powerpc/sysdev/pq_wdt.h create mode 100644 drivers/watchdog/pq_wdt.c

Quoted 6 lines
Quoted 1 line

What are the bits in sysdev/pq_wdt.{c,h}. Why aren't these just in drivers/watchdog?

These are the parts needed to boot a device with activated watchdog. If a bootloader like u-boot activates the watchdog, it can't be deactivated again and needs to be reset at regular intervals. This is done using a kernel timer.
The driver in drivers/watchdog disables the timer as soon as the wdt device
is opened.

Ok, but is there a need for these bits to be in sysdev vs just being in the driver and calling into it.

- k