Merge tag 'efi-2020-07-rc6' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / drivers / rtc / imxdi.c
index 985ce93acf71ed803844c43c86c14baee201fc44..e3a1393266c3f4f4129cf8ca25a60b8c4ad05604 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2009-2012 ADVANSEE
  * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
@@ -5,24 +6,6 @@
  * Based on the Linux rtc-imxdi.c driver, which is:
  * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2010 Orex Computed Radiography
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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
  */
 
 /*
@@ -33,8 +16,7 @@
 #include <command.h>
 #include <linux/compat.h>
 #include <rtc.h>
-
-#if defined(CONFIG_CMD_DATE)
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
@@ -208,7 +190,7 @@ int rtc_get(struct rtc_time *tmp)
        }
 
        now = __raw_readl(&data.regs->dtcmr);
-       to_tm(now, tmp);
+       rtc_to_tm(now, tmp);
 
 err:
        return rc;
@@ -225,8 +207,7 @@ int rtc_set(struct rtc_time *tmp)
                        goto err;
        }
 
-       now = mktime(tmp->tm_year, tmp->tm_mon, tmp->tm_mday,
-                    tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+       now = rtc_mktime(tmp);
        /* zero the fractional part first */
        rc = DI_WRITE_WAIT(0, dtclr);
        if (rc == 0)
@@ -240,5 +221,3 @@ void rtc_reset(void)
 {
        di_init();
 }
-
-#endif