]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/rtc/ds12887.c
karo: tx53: add support for TX53-1232 (2GiB SDRAM)
[karo-tx-uboot.git] / drivers / rtc / ds12887.c
index 84fecf0194036e005584f715c35bba31df2b2595..d8a519b8fe4660625418a880b3d117e218907348 100644 (file)
@@ -1,20 +1,7 @@
 /*
  * (C) Copyright 2003
  *
- * 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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
 #include <config.h>
 #include <rtc.h>
 
-#if defined(CONFIG_RTC_DS12887) && defined(CONFIG_CMD_DATE)
+#if defined(CONFIG_CMD_DATE)
 
 #define RTC_SECONDS                    0x00
 #define RTC_SECONDS_ALARM              0x01
 #define RTC_MINUTES                    0x02
 #define RTC_MINUTES_ALARM              0x03
 #define RTC_HOURS                      0x04
-#define RTC_HOURS_ALARM                0x05
-#define RTC_DAY_OF_WEEK                0x06
+#define RTC_HOURS_ALARM                        0x05
+#define RTC_DAY_OF_WEEK                        0x06
 #define RTC_DATE_OF_MONTH              0x07
 #define RTC_MONTH                      0x08
 #define RTC_YEAR                       0x09
-#define RTC_CONTROL_A                  0x0A
-#define RTC_CONTROL_B                  0x0B
-#define RTC_CONTROL_C                  0x0C
+#define RTC_CONTROL_A                  0x0A
+#define RTC_CONTROL_B                  0x0B
+#define RTC_CONTROL_C                  0x0C
 #define RTC_CONTROL_D                  0x0D
 
 #define RTC_CA_UIP                     0x80
@@ -76,19 +63,7 @@ static void rtc_write (uchar reg, uchar val)
 # error Board specific rtc access functions should be supplied
 #endif
 
-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));
-}
-
-/* ------------------------------------------------------------------------- */
-
-void rtc_get (struct rtc_time *tmp)
+int rtc_get (struct rtc_time *tmp)
 {
        uchar sec, min, hour, mday, wday, mon, year;
 
@@ -150,9 +125,11 @@ else
                tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
                tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 #endif
+
+       return 0;
 }
 
-void rtc_set (struct rtc_time *tmp)
+int rtc_set (struct rtc_time *tmp)
 {
        uchar save_ctrl_b;
        uchar sec, min, hour, mday, wday, mon, year;
@@ -200,6 +177,8 @@ void rtc_set (struct rtc_time *tmp)
        /* enables the RTC to update the regs */
        save_ctrl_b &= ~RTC_CB_SET;
        rtc_write(RTC_CONTROL_B, save_ctrl_b);
+
+       return 0;
 }
 
 void rtc_reset (void)