source: trunk/target/linux/generic/patches-3.3/992-mpcore_wdt_fix_watchdog_counter_loading.patch @ 31645

Last change on this file since 31645 was 31645, checked in by juhosg, 4 years ago

kernel: update linux 3.3 to 3.3.5

File size: 2.3 KB
  • arch/arm/include/asm/smp_twd.h

    Although the commit "98af057092f8f0dabe63c5df08adc2bbfbddb1d2
     ARM: 6126/1: ARM mpcore_wdt: fix build failure and other fixes"
    resolved long standing mpcore_wdt driver build problems, it
    introduced an error in the relationship between the MPcore watchdog
    timer clock rate and mpcore_margin, "MPcore timer margin in seconds",
    such that watchdog timeouts are now arbitrary rather than the number
    of seconds specified by mpcore_margin.
    
    This change restores mpcore_wdt_keepalive() to its equivalent
    implementation prior to commit 98af057 such that watchdog timeouts now
    occur as specified by mpcore_margin.
    
    The variable 'mpcore_timer_rate' which caused that build failure was
    replaced by 'twd_timer_rate'. Adding exported function to obtain
    'twd_timer_rate' value in mpcore_wdt driver.
    
    MPCORE_WATCHDOG needed to build 'mpcore_wdt' already depends on
    HAVE_ARM_TWD needed to build 'smp_twd', so from the point of view of
    'mpcore_wdt' driver the exported function will always exist.
    
    Signed-off-by: Valentine Barshak <vbarshak@mvista.com>
    Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
    ---
    
     arch/arm/include/asm/smp_twd.h |    1 +
     arch/arm/kernel/smp_twd.c      |    7 +++++++
     drivers/watchdog/mpcore_wdt.c  |    4 +---
     3 files changed, 9 insertions(+), 3 deletions(-)
    
    a b extern void __iomem *twd_base; 
    2424 
    2525void twd_timer_setup(struct clock_event_device *); 
    2626void twd_timer_stop(struct clock_event_device *); 
     27unsigned long twd_timer_get_rate(void); 
    2728 
    2829#endif 
  • arch/arm/kernel/smp_twd.c

    a b void __cpuinit twd_timer_setup(struct cl 
    268268                                        0xf, 0xffffffff); 
    269269        enable_percpu_irq(clk->irq, 0); 
    270270} 
     271 
     272/* Needed by mpcore_wdt */ 
     273unsigned long twd_timer_get_rate(void) 
     274{ 
     275        return twd_timer_rate; 
     276} 
     277EXPORT_SYMBOL_GPL(twd_timer_get_rate); 
  • drivers/watchdog/mpcore_wdt.c

    a b static void mpcore_wdt_keepalive(struct 
    9999 
    100100        spin_lock(&wdt_lock); 
    101101        /* Assume prescale is set to 256 */ 
    102         count =  __raw_readl(wdt->base + TWD_WDOG_COUNTER); 
    103         count = (0xFFFFFFFFU - count) * (HZ / 5); 
    104         count = (count / 256) * mpcore_margin; 
     102        count = (twd_timer_get_rate() / 256) * mpcore_margin; 
    105103 
    106104        /* Reload the counter */ 
    107105        writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD); 
Note: See TracBrowser for help on using the repository browser.