diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-10-06 03:39:07 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-10-23 05:03:50 -0400 |
commit | 3c8798983403cb68a827d7a0d09b1134524a1b7d (patch) | |
tree | c1edbec9f935f8edfe78378ab1c238c99d4e3ede | |
parent | 621e579b812dd1a2e6777f7cbf6e55e736505823 (diff) | |
download | u-boot-imx-3c8798983403cb68a827d7a0d09b1134524a1b7d.zip u-boot-imx-3c8798983403cb68a827d7a0d09b1134524a1b7d.tar.gz u-boot-imx-3c8798983403cb68a827d7a0d09b1134524a1b7d.tar.bz2 |
Blackfin: only initialize the RTC when actually used
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | drivers/rtc/bfin_rtc.c | 19 | ||||
-rw-r--r-- | lib_blackfin/board.c | 4 |
2 files changed, 10 insertions, 13 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 */ diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c index ba57392..2679b43 100644 --- a/lib_blackfin/board.c +++ b/lib_blackfin/board.c @@ -250,7 +250,6 @@ void init_cplbtables(void) extern int exception_init(void); extern int irq_init(void); -extern int rtc_init(void); extern int timer_init(void); void board_init_f(ulong bootflag) @@ -313,9 +312,6 @@ void board_init_f(ulong bootflag) display_banner(); checkboard(); -#if defined(CONFIG_RTC_BFIN) && defined(CONFIG_CMD_DATE) - rtc_init(); -#endif timer_init(); printf("Clock: VCO: %lu MHz, Core: %lu MHz, System: %lu MHz\n", |