diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2010-01-31 12:09:52 +0000 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2010-01-31 12:09:52 +0000 |
commit | 565a84fabaf737223be3b524d238dda3d04a8df0 (patch) | |
tree | 1c6b0364a2c8126e6d2e2a474a24dcc81acdaed5 /target/linux/xburst/files-2.6.32/drivers | |
parent | f12ce1ef3e8a4191b4522d57c922326f75a91043 (diff) | |
download | master-31e0f0ae-565a84fabaf737223be3b524d238dda3d04a8df0.tar.gz master-31e0f0ae-565a84fabaf737223be3b524d238dda3d04a8df0.tar.bz2 master-31e0f0ae-565a84fabaf737223be3b524d238dda3d04a8df0.zip |
rtc-jz4740: reset rtc clock if it has lost its state
SVN-Revision: 19437
Diffstat (limited to 'target/linux/xburst/files-2.6.32/drivers')
-rw-r--r-- | target/linux/xburst/files-2.6.32/drivers/rtc/rtc-jz4740.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/target/linux/xburst/files-2.6.32/drivers/rtc/rtc-jz4740.c b/target/linux/xburst/files-2.6.32/drivers/rtc/rtc-jz4740.c index 190b54afd8..2039eb3de8 100644 --- a/target/linux/xburst/files-2.6.32/drivers/rtc/rtc-jz4740.c +++ b/target/linux/xburst/files-2.6.32/drivers/rtc/rtc-jz4740.c @@ -22,7 +22,8 @@ #define JZ_REG_RTC_CTRL 0x00 #define JZ_REG_RTC_SEC 0x04 #define JZ_REG_RTC_SEC_ALARM 0x08 -#define JZ_REG_REGULATOR 0x0C +#define JZ_REG_RTC_REGULATOR 0x0C +#define JZ_REG_RTC_SCRATCHPAD 0x34 #define JZ_RTC_CTRL_WRDY BIT(7) #define JZ_RTC_CTRL_1HZ BIT(6) @@ -211,6 +212,7 @@ static int __devinit jz4740_rtc_probe(struct platform_device *pdev) { int ret; struct jz4740_rtc *rtc; + uint32_t scratchpad; rtc = kmalloc(sizeof(*rtc), GFP_KERNEL); @@ -264,7 +266,12 @@ static int __devinit jz4740_rtc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to request rtc irq: %d\n", ret); goto err_unregister_rtc; } - printk("rtc-ctrl: %d\n", jz4740_rtc_reg_read(rtc, JZ_REG_RTC_CTRL)); + + scratchpad = jz4740_rtc_reg_read(rtc, JZ_REG_RTC_SCRATCHPAD); + if (scratchpad != 0x12345678) { + jz4740_rtc_reg_write(rtc, JZ_REG_RTC_SCRATCHPAD, 0x12345678); + jz4740_rtc_reg_write(rtc, JZ_REG_RTC_SEC, 0); + } return 0; |