Skip to content
  • Jon Hunter's avatar
    ARM: OMAP3+: Implement timer workaround for errata i103 and i767 · bfd6d021
    Jon Hunter authored
    
    
    Errata Titles:
    i103: Delay needed to read some GP timer, WD timer and sync timer
          registers after wakeup (OMAP3/4)
    i767: Delay needed to read some GP timer registers after wakeup (OMAP5)
    
    Description (i103/i767):
    If a General Purpose Timer (GPTimer) is in posted mode
    (TSICR [2].POSTED=1), due to internal resynchronizations, values read in
    TCRR, TCAR1 and TCAR2 registers right after the timer interface clock
    (L4) goes from stopped to active may not return the expected values. The
    most common event leading to this situation occurs upon wake up from
    idle.
    
    GPTimer non-posted synchronization mode is not impacted by this
    limitation.
    
    Workarounds:
    1). Disable posted mode
    2). Use static dependency between timer clock domain and MPUSS clock
        domain
    3). Use no-idle mode when the timer is active
    
    Workarounds #2 and #3 are not pratical from a power standpoint and so
    workaround #1 has been implemented. Disabling posted mode adds some CPU
    overhead for configuring and reading the timers as the CPU has to wait
    for accesses to be re-synchronised within the timer. However, disabling
    posted mode guarantees correct operation.
    
    Please note that it is safe to use posted mode for timers if the counter
    (TCRR) and capture (TCARx) registers will never be read. An example of
    this is the clock-event system timer. This is used by the kernel to
    schedule events however, the timers counter is never read and capture
    registers are not used. Given that the kernel configures this timer
    often yet never reads the counter register it is safe to enable posted
    mode in this case. Hence, for the timer used for kernel clock-events,
    posted mode is enabled by overriding the errata for devices that are
    impacted by this defect.
    
    For drivers using the timers that do not read the counter or capture
    registers and wish to use posted mode, can override the errata and
    enable posted mode by making the following function calls.
    
    	__omap_dm_timer_override_errata(timer, OMAP_TIMER_ERRATA_I103_I767);
    	__omap_dm_timer_enable_posted(timer);
    
    Both dmtimers and watchdogs are impacted by this defect this patch only
    implements the workaround for the dmtimer. Currently the watchdog driver
    does not read the counter register and so no workaround is necessary.
    
    Posted mode will be disabled for all OMAP2+ devices (including AM33xx)
    using a GP timer as a clock-source timer to guarantee correct operation.
    This is not necessary for OMAP24xx devices but the default clock-source
    timer for OMAP24xx devices is the 32k-sync timer and not the GP timer
    and so should not have any impact. This should be re-visited for future
    devices if this errata is fixed.
    
    Confirmed with Vaibhav Hiremath that this bug also impacts AM33xx
    devices.
    
    Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
    Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
    bfd6d021