]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/rtc/ds1337.c
Merge branch 'next' of ../next
[karo-tx-uboot.git] / drivers / rtc / ds1337.c
index 58e3966ec7b0937a436e862f3d417b2c13036bc2..7abf041aabd9bf91e759e358f95a0d3e8df561db 100644 (file)
@@ -56,6 +56,7 @@
 #define RTC_YR_REG_ADDR                0x6
 #define RTC_CTL_REG_ADDR       0x0e
 #define RTC_STAT_REG_ADDR      0x0f
+#define RTC_TC_REG_ADDR                0x10
 
 /*
  * RTC control register bits
@@ -77,9 +78,6 @@
 
 static uchar rtc_read (uchar reg);
 static void rtc_write (uchar reg, uchar val);
-static uchar bin2bcd (unsigned int n);
-static unsigned bcd2bin (uchar c);
-
 
 /*
  * Get the current time from the RTC
@@ -172,6 +170,9 @@ int rtc_set (struct rtc_time *tmp)
 void rtc_reset (void)
 {
        rtc_write (RTC_CTL_REG_ADDR, RTC_DS1337_RESET_VAL);
+#ifdef CONFIG_SYS_DS1339_TCR_VAL
+       rtc_write (RTC_TC_REG_ADDR, CONFIG_SYS_DS1339_TCR_VAL);
+#endif
 }
 
 
@@ -191,14 +192,4 @@ static void rtc_write (uchar reg, uchar val)
        i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, 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