summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-11-01 15:59:35 +0100
committerWolfgang Denk <wd@denx.de>2008-11-01 15:59:35 +0100
commit4cc64742a89e8ce90c69c3c85e4e9f4706062f2f (patch)
tree38caa914ea08118a0613f3579790b2b76c217bb2 /drivers/rtc
parent7c84fe6a06dad9f793ed85b39b1e6c11a7882f5c (diff)
parentf177f4250c729727b1629fa8d8d6556c999e9b8c (diff)
downloadu-boot-imx-4cc64742a89e8ce90c69c3c85e4e9f4706062f2f.zip
u-boot-imx-4cc64742a89e8ce90c69c3c85e4e9f4706062f2f.tar.gz
u-boot-imx-4cc64742a89e8ce90c69c3c85e4e9f4706062f2f.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-blackfin
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/bfin_rtc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/rtc/bfin_rtc.c b/drivers/rtc/bfin_rtc.c
index 3f8c7ed..5de6953 100644
--- a/drivers/rtc/bfin_rtc.c
+++ b/drivers/rtc/bfin_rtc.c
@@ -26,10 +26,17 @@
#define NUM_SECS_IN_HR HRS_TO_SECS(1)
#define NUM_SECS_IN_DAY DAYS_TO_SECS(1)
+/* Enable the RTC prescaler enable register */
+static void rtc_init(void)
+{
+ if (!(bfin_read_RTC_PREN() & 0x1))
+ bfin_write_RTC_PREN(0x1);
+}
+
/* Our on-chip RTC has no notion of "reset" */
void rtc_reset(void)
{
- return;
+ rtc_init();
}
/* Wait for pending writes to complete */
@@ -42,14 +49,6 @@ static void wait_for_complete(void)
bfin_write_RTC_ISTAT(WRITE_COMPLETE);
}
-/* Enable the RTC prescaler enable register */
-int rtc_init(void)
-{
- pr_stamp();
- bfin_write_RTC_PREN(0x1);
- return 0;
-}
-
/* Set the time. Get the time_in_secs which is the number of seconds since Jan 1970 and set the RTC registers
* based on this value.
*/
@@ -64,6 +63,7 @@ int rtc_set(struct rtc_time *tmp)
return -1;
}
+ rtc_init();
wait_for_complete();
/* Calculate number of seconds this incoming time represents */
@@ -100,6 +100,7 @@ int rtc_get(struct rtc_time *tmp)
return -1;
}
+ rtc_init();
wait_for_complete();
/* Read the RTC_STAT register */