]> git.sur5r.net Git - u-boot/commitdiff
rtc: ds1307: remove redundant code in rtc_reset
authorChris Packham <judge.packham@gmail.com>
Wed, 21 Mar 2018 02:40:33 +0000 (15:40 +1300)
committerTom Rini <trini@konsulko.com>
Sat, 7 Apr 2018 00:45:44 +0000 (20:45 -0400)
As of commit 1a1fa2406689 ("rtc: Set valid date after reset") the
command "date reset" will set the date/time to 2000-01-01 0:00:00 after
calling rtc_reset(). This means that the ds1307 implementation of
rtc_reset() doesn't need to call rtc_set().

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/rtc/ds1307.c

index 5df15c7fd6c6846dba9c1a10a567663734ca22fc..5e74b93b72bcd316ed24a0713a0513521b5c7ba0 100644 (file)
@@ -184,25 +184,8 @@ int rtc_set (struct rtc_time *tmp)
  */
 void rtc_reset (void)
 {
-       struct rtc_time tmp;
-
        rtc_write (RTC_SEC_REG_ADDR, 0x00);     /* clearing Clock Halt  */
        rtc_write (RTC_CTL_REG_ADDR, RTC_CTL_BIT_SQWE | RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS0);
-
-       tmp.tm_year = 1970;
-       tmp.tm_mon = 1;
-       tmp.tm_mday= 1;
-       tmp.tm_hour = 0;
-       tmp.tm_min = 0;
-       tmp.tm_sec = 0;
-
-       rtc_set(&tmp);
-
-       printf ( "RTC:   %4d-%02d-%02d %2d:%02d:%02d UTC\n",
-               tmp.tm_year, tmp.tm_mon, tmp.tm_mday,
-               tmp.tm_hour, tmp.tm_min, tmp.tm_sec);
-
-       return;
 }
 
 
@@ -321,14 +304,6 @@ read_rtc:
 static int ds1307_rtc_reset(struct udevice *dev)
 {
        int ret;
-       struct rtc_time tmp = {
-               .tm_year = 1970,
-               .tm_mon = 1,
-               .tm_mday = 1,
-               .tm_hour = 0,
-               .tm_min = 0,
-               .tm_sec = 0,
-       };
 
        /* clear Clock Halt */
        ret = dm_i2c_reg_write(dev, RTC_SEC_REG_ADDR, 0x00);
@@ -340,14 +315,6 @@ static int ds1307_rtc_reset(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       ret = ds1307_rtc_set(dev, &tmp);
-       if (ret < 0)
-               return ret;
-
-       debug("RTC:   %4d-%02d-%02d %2d:%02d:%02d UTC\n",
-             tmp.tm_year, tmp.tm_mon, tmp.tm_mday,
-             tmp.tm_hour, tmp.tm_min, tmp.tm_sec);
-
        return 0;
 }