drivers/rtc/rtc-twl.c: use static register while reading time
authorKonstantin Shlyakhovoy <x0155534@ti.com>
Thu, 12 Apr 2012 19:49:15 +0000 (12:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Apr 2012 20:12:12 +0000 (13:12 -0700)
commitf3ec434c69ac7f447ff6e6389c19727c9f002087
tree4b60b41bb31b52c979a8c5e5fd45aad913a8bf03
parentc3cba9281ba39f3aef377fe52890e2d8f1e6dae3
drivers/rtc/rtc-twl.c: use static register while reading time

RTC stores time and date in several registers.  Due to the fact that
these registers can't be read instantaneously, there is a chance that
reading from counting registers gives an error of one minute, one hour,
one day, etc.

To address this issue, the RTC has hardware support to copy the RTC
counting registers to static shadowed registers.  The current
implementation does not use this feature, and in a stress test, we can
reproduce this error at a rate of around two times per 300000 readings.

Fix the implementation to ensure that the right snapshot of time is
captured.

Signed-off-by: Konstantin Shlyakhovoy <x0155534@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>
Acked-by: Mykola Oleksiienko <x0174904@ti.com>
Acked-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-twl.c