rtc, rx8025: fix Coding Style
[oweals/u-boot.git] / drivers / rtc / ds1306.c
index 75f88a9a529dd7fe80435381df8bac77afaa22f5..02d617e09c92df3f678bc21e7f5f553b7056b4ed 100644 (file)
@@ -1,26 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2002 SIXNET, dge@sixnetio.com.
  *
  * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
  * Stephan Linz <linz@li-pro.net>
- *
- * 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
  */
 
 /*
@@ -36,8 +19,6 @@
 #include <rtc.h>
 #include <spi.h>
 
-#if defined(CONFIG_CMD_DATE)
-
 #define        RTC_SECONDS             0x00
 #define        RTC_MINUTES             0x01
 #define        RTC_HOURS               0x02
@@ -62,9 +43,6 @@
 
 #define        RTC_USER_RAM_BASE       0x20
 
-static unsigned int bin2bcd (unsigned int n);
-static unsigned char bcd2bin (unsigned char c);
-
 /* ************************************************************************* */
 #ifdef CONFIG_SXNI855T         /* !!! SHOULD BE CHANGED TO NEW CODE !!! */
 
@@ -129,7 +107,7 @@ int rtc_get (struct rtc_time *tmp)
        immap->im_cpm.cp_pbdat &= ~PB_SPI_CE;   /* Disable DS1306 Chip */
        udelay (10);
 
-       GregorianDay (tmp);     /* Determine the day of week */
+       rtc_calc_weekday(tmp);  /* Determine the day of week */
 
        debug ("Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
               tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
@@ -199,8 +177,7 @@ int rtc_set (struct rtc_time *tmp)
        {
                ulong tim;
 
-               tim = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday,
-                             tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+               tim = rtc_mktime(tmp);
 
                immap->im_sitk.sitk_rtck = KAPWR_KEY;
                immap->im_sit.sit_rtc = tim;
@@ -458,20 +435,3 @@ static void rtc_write (unsigned char reg, unsigned char val)
 }
 
 #endif /* end of code exclusion (see #ifdef CONFIG_SXNI855T above) */
-
-/* ------------------------------------------------------------------------- */
-
-static unsigned char bcd2bin (unsigned char n)
-{
-       return ((((n >> 4) & 0x0F) * 10) + (n & 0x0F));
-}
-
-/* ------------------------------------------------------------------------- */
-
-static unsigned int bin2bcd (unsigned int n)
-{
-       return (((n / 10) << 4) | (n % 10));
-}
-/* ------------------------------------------------------------------------- */
-
-#endif