Merge branch '2020-01-27-master-imports'
[oweals/u-boot.git] / drivers / rtc / mk48t59.c
index bacdb5b70bad7516d5cb41f5759b8bc6f317557b..8c90a7040767571605dad911468a930dbfd0fa70 100644 (file)
@@ -1,24 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  * Andreas Heppel <aheppel@sysgo.de>
- *
- * 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,6 @@
 #include <rtc.h>
 #include <mk48t59.h>
 
-#if defined(CONFIG_RTC_MK48T59)
-
 #if defined(CONFIG_BAB7xx)
 
 static uchar rtc_read (short reg)
@@ -51,38 +32,6 @@ static void rtc_write (short reg, uchar val)
        out8(RTC_PORT_DATA, val);
 }
 
-#elif defined(CONFIG_PCIPPC2)
-
-#include "../board/pcippc2/pcippc2.h"
-
-static uchar rtc_read (short reg)
-{
-       return in8(RTC(reg));
-}
-
-static void rtc_write (short reg, uchar val)
-{
-       out8(RTC(reg),val);
-}
-
-#elif defined(CONFIG_AMIGAONEG3SE)
-
-#include "../board/MAI/AmigaOneG3SE/via686.h"
-#include "../board/MAI/AmigaOneG3SE/memio.h"
-
-
-static uchar rtc_read (short reg)
-{
-    out_byte(CMOS_ADDR, (uint8)reg);
-    return in_byte(CMOS_DATA);
-}
-
-static void rtc_write (short reg, uchar val)
-{
-    out_byte(CMOS_ADDR, (uint8)reg);
-    out_byte(CMOS_DATA, (uint8)val);
-}
-
 #elif defined(CONFIG_EVAL5200)
 
 static uchar rtc_read (short reg)
@@ -99,16 +48,6 @@ static void rtc_write (short 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 *nvram_read(void *dest, const short src, size_t count)
@@ -131,11 +70,9 @@ void nvram_write(short dest, const void *src, size_t count)
                rtc_write(d++, *s++);
 }
 
-#if defined(CONFIG_CMD_DATE)
-
 /* ------------------------------------------------------------------------- */
 
-void rtc_get (struct rtc_time *tmp)
+int rtc_get (struct rtc_time *tmp)
 {
        uchar save_ctrl_a;
        uchar sec, min, hour, mday, wday, mon, year;
@@ -183,9 +120,11 @@ void rtc_get (struct rtc_time *tmp)
                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_a;
 
@@ -210,6 +149,8 @@ void rtc_set (struct rtc_time *tmp)
 
        save_ctrl_a &= ~RTC_CA_WRITE;
        rtc_write(RTC_CONTROLA, save_ctrl_a); /* enables the RTC to update the regs */
+
+       return 0;
 }
 
 void rtc_reset (void)
@@ -232,6 +173,3 @@ void rtc_set_watchdog(short multi, short res)
        wd_value = RTC_WDS | ((multi & 0x1F) << 2) | (res & 0x3);
        rtc_write(RTC_WATCHDOG, wd_value);
 }
-
-#endif
-#endif /* CONFIG_RTC_MK48T59 */