]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/rtc/ds174x.c
at91rm9200: enable USB support
[karo-tx-uboot.git] / drivers / rtc / ds174x.c
index eb3ca88fd65bf40ff562d6ce62a6677dc3d925e1..5a55dc8b7adb112657850d949b8a58a377efb656 100644 (file)
 #include <command.h>
 #include <rtc.h>
 
-#if defined(CONFIG_RTC_DS174x) && defined(CONFIG_CMD_DATE)
+#if defined(CONFIG_CMD_DATE)
 
 static uchar rtc_read( unsigned int addr );
 static void  rtc_write( unsigned int addr, uchar val);
-static uchar bin2bcd   (unsigned int n);
-static unsigned bcd2bin(uchar c);
 
-#define RTC_BASE               ( CFG_NVRAM_SIZE + CFG_NVRAM_BASE_ADDR )
+#define RTC_BASE               ( CONFIG_SYS_NVRAM_SIZE + CONFIG_SYS_NVRAM_BASE_ADDR )
 
 #define RTC_YEAR               ( RTC_BASE + 7 )
 #define RTC_MONTH              ( RTC_BASE + 6 )
@@ -117,7 +115,7 @@ int rtc_get( struct rtc_time *tmp )
        return 0;
 }
 
-void rtc_set( struct rtc_time *tmp )
+int rtc_set( struct rtc_time *tmp )
 {
        uchar reg_a;
 #ifdef RTC_DEBUG
@@ -143,6 +141,8 @@ void rtc_set( struct rtc_time *tmp )
 
        /* unlock clock registers after read */
        rtc_write( RTC_CONTROLA, ( reg_a  & ~RTC_CA_WRITE ));
+
+       return 0;
 }
 
 void rtc_reset (void)
@@ -190,14 +190,4 @@ static void rtc_write( unsigned int addr, uchar val )
        out8( addr, val );
 }
 
-static unsigned bcd2bin (uchar n)
-{
-       return ((((n >> 4) & 0x0F) * 10) + (n & 0x0F));
-}
-
-static unsigned char bin2bcd (unsigned int n)
-{
-       return (((n / 10) << 4) | (n % 10));
-}
-
 #endif