X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=rtc%2Fds1306.c;h=89e433dabd8894cddece689ebb84c0cd31e33a6d;hb=1a0ce20aa4cb4e3068da04e7290ee9986fd0b834;hp=20f1a50856de2a574c5d0bac15bcd92855ae2d73;hpb=ec4c544bed9b026cdf93084fb0daa73ec53a9cda;p=karo-tx-uboot.git diff --git a/rtc/ds1306.c b/rtc/ds1306.c index 20f1a50856..89e433dabd 100644 --- a/rtc/ds1306.c +++ b/rtc/ds1306.c @@ -36,7 +36,7 @@ #include #include -#if defined(CONFIG_RTC_DS1306) && (CONFIG_COMMANDS & CFG_CMD_DATE) +#if defined(CONFIG_RTC_DS1306) && defined(CONFIG_CMD_DATE) #define RTC_SECONDS 0x00 #define RTC_MINUTES 0x01 @@ -71,12 +71,6 @@ extern int spi_chipsel_cnt; static unsigned int bin2bcd (unsigned int n); static unsigned char bcd2bin (unsigned char c); -static unsigned char rtc_read (unsigned char reg); -static void rtc_write (unsigned char reg, unsigned char val); - - - - /* ************************************************************************* */ #ifdef CONFIG_SXNI855T /* !!! SHOULD BE CHANGED TO NEW CODE !!! */ @@ -306,9 +300,8 @@ void rtc_reset (void) #else /* not CONFIG_SXNI855T */ /* ************************************************************************* */ - - - +static unsigned char rtc_read (unsigned char reg); +static void rtc_write (unsigned char reg, unsigned char val); /* read clock time from DS1306 and return it in *tmp */ void rtc_get (struct rtc_time *tmp) @@ -367,13 +360,13 @@ void rtc_set (struct rtc_time *tmp) tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); - rtc_write (RTC_YEAR, bin2bcd (tmp->tm_year - 2000)); - rtc_write (RTC_MONTH, bin2bcd (tmp->tm_mon)); - rtc_write (RTC_DATE_OF_MONTH, bin2bcd (tmp->tm_mday)); - rtc_write (RTC_DAY_OF_WEEK, bin2bcd (tmp->tm_wday + 1)); - rtc_write (RTC_HOURS, bin2bcd (tmp->tm_hour)); - rtc_write (RTC_MINUTES, bin2bcd (tmp->tm_min)); rtc_write (RTC_SECONDS, bin2bcd (tmp->tm_sec)); + rtc_write (RTC_MINUTES, bin2bcd (tmp->tm_min)); + rtc_write (RTC_HOURS, bin2bcd (tmp->tm_hour)); + rtc_write (RTC_DAY_OF_WEEK, bin2bcd (tmp->tm_wday + 1)); + rtc_write (RTC_DATE_OF_MONTH, bin2bcd (tmp->tm_mday)); + rtc_write (RTC_MONTH, bin2bcd (tmp->tm_mon)); + rtc_write (RTC_YEAR, bin2bcd (tmp->tm_year - 2000)); } /* ------------------------------------------------------------------------- */