]> git.sur5r.net Git - u-boot/blobdiff - drivers/rtc/ftrtc010.c
dm: pci: Move common PCI functions into their own file
[u-boot] / drivers / rtc / ftrtc010.c
index 7738a7acaa0c79054d67a835945fdf30a5810cef..713dad274f1cb5e938e613d72b5118864b2a66f3 100644 (file)
@@ -4,19 +4,7 @@
  * (C) Copyright 2009 Faraday Technology
  * Po-Yu Chuang <ratbert@faraday-tech.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
@@ -34,6 +22,13 @@ struct ftrtc010 {
        unsigned int alarm_hour;        /* 0x18 */
        unsigned int record;            /* 0x1c */
        unsigned int cr;                /* 0x20 */
+       unsigned int wsec;              /* 0x24 */
+       unsigned int wmin;              /* 0x28 */
+       unsigned int whour;             /* 0x2c */
+       unsigned int wday;              /* 0x30 */
+       unsigned int intr;              /* 0x34 */
+       unsigned int div;               /* 0x38 */
+       unsigned int rev;               /* 0x3c */
 };
 
 /*
@@ -85,7 +80,11 @@ int rtc_get(struct rtc_time *tmp)
        debug("%s(): record register: %x\n",
              __func__, readl(&rtc->record));
 
+#ifdef CONFIG_FTRTC010_PCLK
+       now = (ftrtc010_time() + readl(&rtc->record)) / RTC_DIV_COUNT;
+#else /* CONFIG_FTRTC010_EXTCLK */
        now = ftrtc010_time() + readl(&rtc->record);
+#endif
 
        to_tm(now, tmp);