• Sergey Yanovich's avatar
    drivers/rtc/rtc-ds1302.c: handle write protection · dfc657b1
    Sergey Yanovich authored
    This chip has a control register and can prevent altering saved clock.
    Without this patch we could have:
    
    (arm)root@pac14:~# date
    Tue May 21 03:08:27 MSK 2013
    (arm)root@pac14:~# /etc/init.d/hwclock.sh show
    Tue May 21 11:13:58 2013  -0.067322 seconds
    (arm)root@pac14:~# /etc/init.d/hwclock.sh stop
    [info] Saving the system clock.
    [info] Hardware Clock updated to Tue May 21 03:09:01 MSK 2013.
    (arm)root@pac14:~# /etc/init.d/hwclock.sh show
    Tue May 21 11:14:15 2013  -0.624272 seconds
    
    The patch enables write access to rtc before the driver tries to write
    time and re-disables when time data is written.
    Signed-off-by: default avatarSergey Yanovich <ynvich@gmail.com>
    Acked-by: default avatarMarc Zyngier <maz@misterjones.org>
    Cc: Alessandro Zummo <a.zummo@towertech.it>
    Cc: Sachin Kamat <sachin.kamat@linaro.org>
    Cc: Jingoo Han <jg1.han@samsung.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    dfc657b1
rtc-ds1302.c 6.01 KB