iop: combined watchdog timer driver for iop3xx and iop13xx
Subsystems (3)
PATCH 1/1 iop: combined watchdog timer driver for iop3xx and iop13xx
Greetings Wim,
Here is a new watchdog driver for your review. It supports two flavors of the iop watchdog timer. The iop13xx watchdog can be stopped while the iop3xx version cannot.
Thanks,
Dan
---
iop: combined watchdog timer driver for iop3xx and iop13xx
From: Dan Williams <[email protected]>
Heartbeat derived from the tick rate supplied to arch/arm/plat-iop/time.c
---
arch/arm/plat-iop/time.c | 8 + drivers/char/watchdog/Kconfig | 16 ++ drivers/char/watchdog/Makefile | 1 drivers/char/watchdog/iop_wdt.c | 251 ++++++++++++++++++++++++++++++++ include/asm-arm/arch-iop13xx/iop13xx.h | 44 ++++++ include/asm-arm/arch-iop13xx/system.h | 34 ---- include/asm-arm/hardware/iop3xx.h | 15 ++ 7 files changed, 337 insertions(+), 32 deletions(-)
arch/arm/plat-iop/time.c +8 -0
@@ -78,6 +78,13 @@ static struct irqaction iop_timer_irq = { .flags = IRQF_DISABLED | IRQF_TIMER, }; +static unsigned long iop_tick_rate; +unsigned long get_iop_tick_rate (void ) +{ +return iop_tick_rate; +} +EXPORT_SYMBOL (get_iop_tick_rate); +void __init iop_init_time (unsigned long tick_rate) {u32 timer_ctl;
@@ -85,6 +92,7 @@ void __init iop_init_time(unsigned long tick_rate) ticks_per_jiffy = (tick_rate +HZ /2 ) /HZ ; ticks_per_usec = tick_rate /1000000 ; next_jiffy_time =0xffffffff ; + iop_tick_rate = tick_rate; timer_ctl =IOP_TMR_EN |IOP_TMR_PRIVILEGED |IOP_TMR_RELOAD |IOP_TMR_RATIO_1_1 ;
drivers/char/watchdog/Kconfig +16 -0
@@ -183,6 +183,22 @@ config PNX4008_WATCHDOG Say N if you are unsure. +config IOP_WATCHDOG + tristate "IOP Watchdog" + depends on WATCHDOG && PLAT_IOP + select WATCHDOG_NOWAYOUT if (ARCH_IOP32X || ARCH_IOP33X) + help + Say Y here if to include support for the watchdog timer + in the Intel IOP3XX & IOP13XX I/O Processors. This driver can + be built as a module by choosing M. The module will + be called iop_wdt. + + Note: The IOP13XX watchdog does an Internal Bus Reset which will + affect both cores and the peripherals of the IOP. The ATU-X + and/or ATUe configuration registers will remain intact, but if + operating as an Root Complex and/or Central Resource, the PCI-X + and/or PCIe busses will also be reset. THIS IS A VERY BIG HAMMER. + # X86 (i386 + ia64 + x86_64) Architecture config ACQUIRE_WDT
drivers/char/watchdog/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o +obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o # X86 (i386 + ia64 + x86_64) Architecture obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
drivers/char/watchdog/iop_wdt.c new file +251 -0
251 lines not on this page · raw message
include/asm-arm/arch-iop13xx/iop13xx.h +44 -0
54 lines not on this page · raw message
include/asm-arm/arch-iop13xx/system.h +2 -32
@@ -13,43 +13,13 @@ static inline void arch_idle(void)cpu_do_idle (); } -/* WDTCR CP6 R7 Page 9 */ -static inline u32 read_wdtcr (void ) -{ -u32 val; - asmvolatile ("mrc p6, 0, %0, c7, c9, 0" :"=r" (val)); -return val; -} -static inline void write_wdtcr (u32 val) -{ - asmvolatile ("mcr p6, 0, %0, c7, c9, 0" ::"r" (val)); -} - -/* WDTSR CP6 R8 Page 9 */ -static inline u32 read_wdtsr (void ) -{ -u32 val; - asmvolatile ("mrc p6, 0, %0, c8, c9, 0" :"=r" (val)); -return val; -} -static inline void write_wdtsr (u32 val) -{ - asmvolatile ("mcr p6, 0, %0, c8, c9, 0" ::"r" (val)); -} - -#define IOP13XX_WDTCR_EN_ARM 0x1e1e1e1e -#define IOP13XX_WDTCR_EN 0xe1e1e1e1 -#define IOP13XX_WDTCR_DIS_ARM 0x1f1f1f1f -#define IOP13XX_WDTCR_DIS 0xf1f1f1f1 -#define IOP13XX_WDTSR_WRITE_EN (1 << 31) -#define IOP13XX_WDTCR_IB_RESET (1 << 0)static inline void arch_reset (char mode) {/* * Reset the internal bus (warning both cores are reset) */ -write_wdtcr (IOP13XX_WDTCR_EN_ARM ); -write_wdtcr (IOP13XX_WDTCR_EN ); +write_wdtcr (IOP_WDTCR_EN_ARM ); +write_wdtcr (IOP_WDTCR_EN );write_wdtsr (IOP13XX_WDTSR_WRITE_EN |IOP13XX_WDTCR_IB_RESET );write_wdtcr (0x1000 );
include/asm-arm/hardware/iop3xx.h +15 -0
@@ -193,6 +193,10 @@ extern void gpio_line_set(int line, int value);#define IOP_TMR_PRIVILEGED 0x08#define IOP_TMR_RATIO_1_1 0x00 +/* Watchdog timer definitions */ +#define IOP_WDTCR_EN_ARM 0x1e1e1e1e +#define IOP_WDTCR_EN 0xe1e1e1e1 +/* Application accelerator unit */ #define IOP3XX_AAU_ACR (volatile u32 *)IOP3XX_REG_ADDR(0x0800)#define IOP3XX_AAU_ASR (volatile u32 *)IOP3XX_REG_ADDR(0x0804)
@@ -315,6 +319,17 @@ static inline void write_tisr(u32 val) asmvolatile ("mcr p6, 0, %0, c6, c1, 0" : :"r" (val)); } +static inline u32 read_wdtcr (void ) +{ +u32 val; + asmvolatile ("mrc p6, 0, %0, c7, c1, 0" :"=r" (val)); +return val; +} +static inline void write_wdtcr (u32 val) +{ + asmvolatile ("mcr p6, 0, %0, c7, c1, 0" ::"r" (val)); +} +extern struct platform_device iop3xx_i2c0_device;extern struct platform_device iop3xx_i2c1_device;
Hi Dan,
Quoted 3 lines
Here is a new watchdog driver for your review. It supports two flavors of the iop watchdog timer. The iop13xx watchdog can be stopped while the iop3xx version cannot.
I started reviewing this patch yesterday. First thing I noticed was that you seem to be moving some code from include/asm-arm/arch-iop13xx/system.h to include/asm-arm/arch-iop13xx/iop13xx.h .
This should not be part of this patch since it is touching architecture dependant code for which I do not have enough knowledge about this specific architecture to tell if this is indeed the correct way to do this. The maintainers of this architecture should imho comment on this. Could you split this patch into 2 patches: one that deals with the moving of the architecture dependant code (and explaining why) and one with the new watchdog drivers? I will continue my review today.
Thanks,
Wim.
Quoted 6 lines · Wim Van Sebroeck
Hi Dan,
Quoted 3 lines
Here is a new watchdog driver for your review. It supports two flavors of the iop watchdog timer. The iop13xx watchdog can be stopped while the iop3xx version cannot.
Quoted 11 lines
I started reviewing this patch yesterday. First thing I noticed was that you seem to be moving some code from
include/asm-arm/arch-iop13xx/system.htoinclude/asm-arm/arch-iop13xx/iop13xx.h.
This should not be part of this patch since it is touching architecture dependant code for which I do not have enough knowledge about this specific architecture to tell if this is indeed the correct way to do this. The maintainers of this architecture should imho comment on this. Could you split this patch into 2 patches: one that deals with the moving of the architecture dependant code (and explaining why) and one with the new watchdog drivers? I will continue my review today.
I am one of the maintainers of this architecture, (Lennert Buytenhek is the other). I will go ahead and split this up so you can sign-off on the watchdog specific bits. The intent is to move all hardware definitions under #include <asm/hardware.h>. You are right this should have been a separate patch.
Quoted 3 lines
Thanks,
Wim.
Thanks for your help,
Dan
Quoted 16 lines · Dan Williams
Quoted 4 lines
Quoted 3 lines
Here is a new watchdog driver for your review. It supports two flavors of the iop watchdog timer. The iop13xx watchdog can be stopped while the iop3xx version cannot.
Quoted 11 lines
I started reviewing this patch yesterday. First thing I noticed was that you seem to be moving some code from
include/asm-arm/arch-iop13xx/system.htoinclude/asm-arm/arch-iop13xx/iop13xx.h.
This should not be part of this patch since it is touching architecture dependant code for which I do not have enough knowledge about this specific architecture to tell if this is indeed the correct way to do this. The maintainers of this architecture should imho comment on this. Could you split this patch into 2 patches: one that deals with the moving of
the architecture dependant code (and explaining why) and one with the new watchdog drivers? I will continue my review today.
Quoted 2 lines
I am one of the maintainers of this architecture, (Lennert Buytenhek is the other).
Dan has done more work on iop13xx than I have, and I'm OK with his changes.
It's true that ARM-specific changes generally should go through the ARM tree, but IMHO sometimes it makes sense to have one patch touch both stuff under drivers/ and stuff under arch/arm/mach-foo, especially if the changes are dependent and cause compile breakage if applied separately. Not sure whether that's the case here.
Hi Dan,
Quoted 11 lines
Quoted 5 lines
Could you split this patch into 2 patches: one that deals with the moving of
the architecture dependant code (and explaining why) and one with the new watchdog drivers? I will continue my review today.I am one of the maintainers of this architecture, (Lennert Buytenhek is the other). I will go ahead and split this up so you can sign-off on the watchdog specific bits. The intent is to move all hardware definitions under #include <
asm/hardware.h>. You are right this should have been a separate patch.
I reviewed the rest of the code. Looks OK to me. One small remark though:
Can we change the ifdef's in the code as described in section 2 point 2 of the Documentation/SubmittingPatches document?
Thanks,
Wim.
Quoted 14 lines · Wim Van Sebroeck
Hi Dan,
Quoted 11 lines
Quoted 5 lines
Could you split this patch into 2 patches: one that deals with the moving of
the architecture dependant code (and explaining why) and one with the new watchdog drivers? I will continue my review today.I am one of the maintainers of this architecture, (Lennert Buytenhek is the other). I will go ahead and split this up so you can sign-off on the watchdog specific bits. The intent is to move all hardware definitions under #include <
asm/hardware.h>. You are right this should have been a separate patch.
Quoted 4 lines
I reviewed the rest of the code. Looks OK to me. One small remark though:
Can we change the ifdef's in the code as described in section 2 point 2 of theDocumentation/SubmittingPatchesdocument?
Ok, I can add this cleanup.
Barring any objections I'll go ahead and submit the revised patch with an "Acked-by: Wim Van Sebroeck <wim at iguana dot be>" to Russell's ARM patch tracker.
Quoted 3 lines
Thanks,
Wim.
Dan
Hi Dan,
Quoted 3 lines
Barring any objections I'll go ahead and submit the revised patch with an "Acked-by: Wim Van Sebroeck <wim at iguana dot be>" to Russell's ARM patch tracker.
Fine by me.
Greetings,
Wim.