From ef7574d6c17218f2e3125c2433b9545d0297333f Mon Sep 17 00:00:00 2001 From: Olivier Dufour Date: Wed, 19 Sep 2012 10:46:21 +0200 Subject: {cleo,polux}/linux/arm/wdt: move some functions to header, refs #3272 In order to be able to add support for watchdog functions in boot sequence, functions to start and refresh it need to be defined directly in header files. --- .../arch/arm/mach-spc300/spc300-device-wdt.c | 80 ---------------------- 1 file changed, 80 deletions(-) (limited to 'cleopatre/linux-2.6.25.10-spc300') diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-device-wdt.c b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-device-wdt.c index 23f7322610..d262da2b69 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-device-wdt.c +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-device-wdt.c @@ -29,76 +29,6 @@ uint32_t spc300_wdt_user_mode = 0; EXPORT_SYMBOL(spc300_wdt_user_mode); -/** - * Refresh watchdog timer. - * - * \param va true if need to use virtual address to access register, false - * for physical address. - */ -static void spc300_wdt_refresh_(bool va) -{ - uint32_t reg = WDT_BF(CR, WDT_CR_VAL); - if (va) - WDT_CRR_VA = reg; - else - WDT_CRR_PA = reg; -} - -/** - * Start watchdog timer countdown. - * - * \param timeout_s timeout of the watchdog (in second). - * \param va true if need to use virtual address to access register, false - * for physical address. - * \return 0 if no error, error value otherwise (-EINVAL if timeout_s is too - * big). - */ -static int spc300_wdt_start_(uint timeout_s, bool va) -{ - uint32_t cnt_value, top, reg; - - //Timeout period = (2^(16+ TOP_reg)) / PCLK - - // Configure timeout? - if(timeout_s) - { - if(timeout_s > WDT_MAX_TIME) - return -EINVAL; - - cnt_value = timeout_s * PCLK; - - for(top=15 ; top>0 ; top--) - { - if(cnt_value >= (1<<(top+16))) - { - if (va) - WDT_TORR_VA = WDT_BFINS(TOP, top, WDT_TORR_VA); - else - WDT_TORR_PA = WDT_BFINS(TOP, top, WDT_TORR_PA); - break; - } - } - } - //Enable WDT with reset pulse = 32pclk and without interrupt management - reg = WDT_BF(RPL, 4) | WDT_BF(RMOD, 0) | WDT_BF(EN, 1); - if (va) - WDT_CR_VA = reg; - else - WDT_CR_PA = reg; - spc300_wdt_refresh_(va); - return 0; -} - -int spc300_wdt_start(uint timeout_s) -{ - return spc300_wdt_start_(timeout_s, true); -} - -int spc300_wdt_start_pa(uint timeout_s) -{ - return spc300_wdt_start_(timeout_s, false); -} - void spc300_wdt_switch(int use_umode) { if(use_umode) @@ -107,16 +37,6 @@ void spc300_wdt_switch(int use_umode) spc300_wdt_user_mode = 0; } -void spc300_wdt_refresh(void) -{ - spc300_wdt_refresh_ (true); -} - -void spc300_wdt_refresh_pa(void) -{ - spc300_wdt_refresh_ (false); -} - int spc300_wdt_gettimeout(void) { uint32_t top; -- cgit v1.2.3