X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=rtc%2Fds1306.c;h=89e433dabd8894cddece689ebb84c0cd31e33a6d;hb=1a0ce20aa4cb4e3068da04e7290ee9986fd0b834;hp=4d1115ee4bd5d1a281e50c2fc1ed5fecfe7b4543;hpb=198ea9e294e38cea49f9f2d9b911bdfdd20e48dc;p=karo-tx-uboot.git diff --git a/rtc/ds1306.c b/rtc/ds1306.c index 4d1115ee4b..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 @@ -75,8 +75,6 @@ static unsigned char bcd2bin (unsigned char c); /* ************************************************************************* */ #ifdef CONFIG_SXNI855T /* !!! SHOULD BE CHANGED TO NEW CODE !!! */ -static unsigned char rtc_read (unsigned char reg); -static void rtc_write (unsigned char reg, unsigned char val); static void soft_spi_send (unsigned char n); static unsigned char soft_spi_read (void); static void init_spi (void); @@ -302,6 +300,9 @@ 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) { @@ -359,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)); } /* ------------------------------------------------------------------------- */