]> 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 990ebba2633f59076b1e2c9ae1aacf23e80cf368..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+
  */
 
 /*
@@ -28,7 +15,7 @@
 #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
@@ -76,18 +63,6 @@ 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));
-}
-
-/* ------------------------------------------------------------------------- */
-
 int rtc_get (struct rtc_time *tmp)
 {
        uchar sec, min, hour, mday, wday, mon, year;
@@ -154,7 +129,7 @@ else
        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;
@@ -202,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)