X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Frtc%2Fm48t35ax.c;h=1cc24cccae730d9af18f92d2b25a495293de9e6c;hb=4411652aead3509ce497e4598f533e2b7e4f4ba0;hp=0a0ffa8aac12fd9844037c78e91f947ea790a853;hpb=4985ca5af3767ffe13ea96e1dc26f88c81084414;p=oweals%2Fu-boot.git diff --git a/drivers/rtc/m48t35ax.c b/drivers/rtc/m48t35ax.c index 0a0ffa8aac..1cc24cccae 100644 --- a/drivers/rtc/m48t35ax.c +++ b/drivers/rtc/m48t35ax.c @@ -1,24 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2001 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. - * - * 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,16 +16,12 @@ #include #include -#if defined(CONFIG_RTC_M48T35A) && defined(CONFIG_CMD_DATE) - static uchar rtc_read (uchar reg); static void rtc_write (uchar reg, uchar val); -static uchar bin2bcd (unsigned int n); -static unsigned bcd2bin(uchar c); /* ------------------------------------------------------------------------- */ -void rtc_get (struct rtc_time *tmp) +int rtc_get (struct rtc_time *tmp) { uchar sec, min, hour, cent_day, date, month, year; uchar ccr; /* Clock control register */ @@ -83,9 +62,11 @@ void rtc_get (struct rtc_time *tmp) 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, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + return 0; } -void rtc_set (struct rtc_time *tmp) +int rtc_set (struct rtc_time *tmp) { uchar ccr; /* Clock control register */ uchar century; @@ -114,6 +95,8 @@ void rtc_set (struct rtc_time *tmp) ccr = rtc_read(0); ccr = ccr & 0x7F; rtc_write(0, ccr); + + return 0; } void rtc_reset (void) @@ -141,26 +124,12 @@ void rtc_reset (void) static uchar rtc_read (uchar reg) { - uchar val; - val = *(unsigned char *) - ((CFG_NVRAM_BASE_ADDR + CFG_NVRAM_SIZE - 8) + reg); - return val; + return *(unsigned char *) + ((CONFIG_SYS_NVRAM_BASE_ADDR + CONFIG_SYS_NVRAM_SIZE - 8) + reg); } static void rtc_write (uchar reg, uchar val) { *(unsigned char *) - ((CFG_NVRAM_BASE_ADDR + CFG_NVRAM_SIZE - 8) + reg) = val; + ((CONFIG_SYS_NVRAM_BASE_ADDR + CONFIG_SYS_NVRAM_SIZE - 8) + reg) = val; } - -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)); -} - -#endif