]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/rtc/mk48t59.c
karo: tx6: factor out PMIC initialization
[karo-tx-uboot.git] / drivers / rtc / mk48t59.c
index bacdb5b70bad7516d5cb41f5759b8bc6f317557b..2164580efc4a3d85d2db59c4c124a01598ce2a1b 100644 (file)
@@ -2,23 +2,7 @@
  * (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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -33,8 +17,6 @@
 #include <rtc.h>
 #include <mk48t59.h>
 
-#if defined(CONFIG_RTC_MK48T59)
-
 #if defined(CONFIG_BAB7xx)
 
 static uchar rtc_read (short reg)
@@ -51,38 +33,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 +49,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)
@@ -135,7 +75,7 @@ void nvram_write(short dest, const void *src, size_t count)
 
 /* ------------------------------------------------------------------------- */
 
-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 +123,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 +152,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)
@@ -234,4 +178,3 @@ void rtc_set_watchdog(short multi, short res)
 }
 
 #endif
-#endif /* CONFIG_RTC_MK48T59 */