Merge branch '2020-01-27-master-imports'
[oweals/u-boot.git] / drivers / rtc / m41t60.c
index e34a5f47831c85960b383f8105bcdd1e2ffe0a0f..532d2105e12c79c871ae654a09159c8639e83292 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2007
  * Larry Johnson, lrj@acm.org
@@ -6,21 +7,6 @@
  *
  * (C) Copyright 2002
  * Andrew May, Viasat Inc, amay@viasat.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
  */
 
 /*
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <rtc.h>
 #include <i2c.h>
 
-#if defined(CONFIG_SYS_I2C_RTC_ADDR) && defined(CONFIG_CMD_DATE)
-
-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));
-}
-
 /*
  * Convert between century and "century bits" (CB1 and CB0).  These routines
  * assume years are in the range 1900 - 2299.
@@ -223,7 +198,7 @@ int rtc_set(struct rtc_time *tmp)
 void rtc_reset(void)
 {
        uchar *const data = rtc_validate();
-       char const *const s = getenv("rtccal");
+       char const *const s = env_get("rtccal");
 
        if (!data)
                return;
@@ -261,4 +236,3 @@ void rtc_reset(void)
        }
        rtc_dump("end reset");
 }
-#endif /* CONFIG_RTC_M41T60 && CONFIG_SYS_I2C_RTC_ADDR && CONFIG_CMD_DATE */