arm, davinci: add wdt support
cover arm, davinci: add wdt support
Cc Paulraj Sandeep <[email protected]>
Cc Albert ARIBAUD <[email protected]>
Heiko Schocher (3):
arm, davinci: move davinci_timer in header file arm, davinci: add missing timer baseaddresses for !DA8xx cpu arm, davinci: add internal WDT support for AM1808 cpus
arch/arm/cpu/arm926ejs/davinci/timer.c | 46 ++++++++++++++++------- arch/arm/include/asm/arch-davinci/hardware.h | 2 + arch/arm/include/asm/arch-davinci/timer_defs.h | 44 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 arch/arm/include/asm/arch-davinci/timer_defs.h
Signature · 1 line
1.7.6
PATCH 1/3 arm, davinci: move davinci_timer in header file
Signed-off-by Heiko Schocher <[email protected]>
Cc Paulraj Sandeep <[email protected]>
Cc Albert ARIBAUD <[email protected]>
--- arch/arm/cpu/arm926ejs/davinci/timer.c | 15 +-------- arch/arm/include/asm/arch-davinci/timer_defs.h | 40 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 arch/arm/include/asm/arch-davinci/timer_defs.h
arch/arm/cpu/arm926ejs/davinci/timer.c +1 -14
@@ -39,23 +39,10 @@#include <common.h> #include <asm/io.h> +#include <asm/arch/timer_defs.h> DECLARE_GLOBAL_DATA_PTR ; -struct davinci_timer { -u_int32_t pid12; -u_int32_t emumgt; -u_int32_t na1; -u_int32_t na2; -u_int32_t tim12; -u_int32_t tim34; -u_int32_t prd12; -u_int32_t prd34; -u_int32_t tcr; -u_int32_t tgcr; -u_int32_t wdtcr; -}; -static struct davinci_timer *const timer = (struct davinci_timer *)CONFIG_SYS_TIMERBASE ;
arch/arm/include/asm/arch-davinci/timer_defs.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copyright (C) 2011 DENX Software Engineering GmbH +* Heiko Schocher <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#ifndef _TIMER_DEFS_H_ +#define _TIMER_DEFS_H_ + +struct davinci_timer { +u_int32_t pid12; +u_int32_t emumgt; +u_int32_t na1; +u_int32_t na2; +u_int32_t tim12; +u_int32_t tim34; +u_int32_t prd12; +u_int32_t prd34; +u_int32_t tcr; +u_int32_t tgcr; +u_int32_t wdtcr; +}; + +#endif /* _TIMER_DEFS_H_ */
Signature · 1 line
1.7.6
PATCH 2/3 arm, davinci: add missing timer baseaddresses for !DA8xx cpu
In reply to Heiko SchocherSigned-off-by Heiko Schocher <[email protected]>
Cc Paulraj Sandeep <[email protected]>
Cc Albert ARIBAUD <[email protected]>
--- arch/arm/include/asm/arch-davinci/hardware.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +2 -0
@@ -143,6 +143,8 @@ typedef volatile unsigned int * dv_reg_p;#define DAVINCI_MDIO_CNTRL_REGS_BASE 0x01e24000#define DAVINCI_MMC_SD0_BASE 0x01c40000#define DAVINCI_MMC_SD1_BASE 0x01e1b000 +#define DAVINCI_TIMER2_BASE 0x01f0c000 +#define DAVINCI_TIMER3_BASE 0x01f0d000#define DAVINCI_ASYNC_EMIF_CNTRL_BASE 0x68000000#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x40000000#define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE 0x60000000
Signature · 1 line
1.7.6
PATCH 3/3 arm, davinci: add internal WDT support for AM1808 cpus
In reply to Heiko SchocherSigned-off-by Heiko Schocher <[email protected]>
Cc Paulraj Sandeep <[email protected]>
Cc Albert ARIBAUD <[email protected]>
--- arch/arm/cpu/arm926ejs/davinci/timer.c | 31 ++++++++++++++++++++++++ arch/arm/include/asm/arch-davinci/timer_defs.h | 4 +++ 2 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/davinci/timer.c +31 -0
@@ -108,3 +108,34 @@ ulong get_tbclk(void) {return CONFIG_SYS_HZ ; } + +#ifdef CONFIG_HW_WATCHDOG +static struct davinci_timer *const wdttimer = + (struct davinci_timer *)CONFIG_SYS_WDTTIMERBASE ; + +/* +* See prufw2.pdf for using Timer as a WDT +*/ +void davinci_hw_watchdog_enable (void ) +{ +writel (0x0 , &wdttimer->tcr); +writel (0x0 , &wdttimer->tgcr); +/* TIMMODE = 2h */ +writel (0x08 |0x03 | ((TIM_CLK_DIV -1 ) <<8 ), &wdttimer->tgcr); +writel (CONFIG_SYS_WDT_PERIOD_LOW , &wdttimer->prd12); +writel (CONFIG_SYS_WDT_PERIOD_HIGH , &wdttimer->prd34); +writel (2 <<22 , &wdttimer->tcr); +writel (0x0 , &wdttimer->tim12); +writel (0x0 , &wdttimer->tim34); +/* set WDEN bit, WDKEY 0xa5c6 */ +writel (0xa5c64000 , &wdttimer->wdtcr); +/* clear counter register */ +writel (0xda7e4000 , &wdttimer->wdtcr); +} + +void davinci_hw_watchdog_reset (void ) +{ +writel (0xa5c64000 , &wdttimer->wdtcr); +writel (0xda7e4000 , &wdttimer->wdtcr); +} +#endif
arch/arm/include/asm/arch-davinci/timer_defs.h +4 -0
@@ -37,4 +37,8 @@ struct davinci_timer { u_int32_t wdtcr; }; +#ifdef CONFIG_HW_WATCHDOG +void davinci_hw_watchdog_enable (void ); +void davinci_hw_watchdog_reset (void ); +#endif #endif /* _TIMER_DEFS_H_ */
Signature · 1 line
1.7.6