diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/Makefile | 2 | ||||
-rw-r--r-- | drivers/rtc/ds1337.c | 16 | ||||
-rw-r--r-- | drivers/rtc/i2c_rtc_emul.c | 1 | ||||
-rw-r--r-- | drivers/rtc/mpc5xxx.c | 128 | ||||
-rw-r--r-- | drivers/rtc/mpc8xx.c | 60 |
5 files changed, 8 insertions, 199 deletions
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 438681da7a..003e31aeba 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -38,8 +38,6 @@ obj-$(CONFIG_RTC_MC146818) += mc146818.o obj-$(CONFIG_RTC_MCP79411) += ds1307.o obj-$(CONFIG_MCFRTC) += mcfrtc.o obj-$(CONFIG_RTC_MK48T59) += mk48t59.o -obj-$(CONFIG_RTC_MPC5200) += mpc5xxx.o -obj-$(CONFIG_RTC_MPC8xx) += mpc8xx.o obj-$(CONFIG_RTC_MV) += mvrtc.o obj-$(CONFIG_RTC_MX27) += mx27rtc.o obj-$(CONFIG_RTC_MXS) += mxsrtc.o diff --git a/drivers/rtc/ds1337.c b/drivers/rtc/ds1337.c index dae1b3c5cf..4b73d1718c 100644 --- a/drivers/rtc/ds1337.c +++ b/drivers/rtc/ds1337.c @@ -150,11 +150,11 @@ int rtc_set (struct rtc_time *tmp) * SQW/INTB* pin and program it for 32,768 Hz output. Note that * according to the datasheet, turning on the square wave output * increases the current drain on the backup battery from about - * 600 nA to 2uA. Define CONFIG_SYS_RTC_DS1337_NOOSC if you wish to turn + * 600 nA to 2uA. Define CONFIG_RTC_DS1337_NOOSC if you wish to turn * off the OSC output. */ -#ifdef CONFIG_SYS_RTC_DS1337_NOOSC +#ifdef CONFIG_RTC_DS1337_NOOSC #define RTC_DS1337_RESET_VAL \ (RTC_CTL_BIT_INTCN | RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS2) #else @@ -162,16 +162,16 @@ int rtc_set (struct rtc_time *tmp) #endif void rtc_reset (void) { -#ifdef CONFIG_SYS_RTC_DS1337 +#ifdef CONFIG_RTC_DS1337 rtc_write (RTC_CTL_REG_ADDR, RTC_DS1337_RESET_VAL); -#elif defined CONFIG_SYS_RTC_DS1388 +#elif defined CONFIG_RTC_DS1388 rtc_write(RTC_CTL_REG_ADDR, 0x0); /* hw default */ #endif -#ifdef CONFIG_SYS_DS1339_TCR_VAL - rtc_write (RTC_TC_REG_ADDR, CONFIG_SYS_DS1339_TCR_VAL); +#ifdef CONFIG_RTC_DS1339_TCR_VAL + rtc_write (RTC_TC_REG_ADDR, CONFIG_RTC_DS1339_TCR_VAL); #endif -#ifdef CONFIG_SYS_DS1388_TCR_VAL - rtc_write(RTC_TC_REG_ADDR, CONFIG_SYS_DS1388_TCR_VAL); +#ifdef CONFIG_RTC_DS1388_TCR_VAL + rtc_write(RTC_TC_REG_ADDR, CONFIG_RTC_DS1388_TCR_VAL); #endif } diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c index 20827fdff1..0e06c97367 100644 --- a/drivers/rtc/i2c_rtc_emul.c +++ b/drivers/rtc/i2c_rtc_emul.c @@ -16,7 +16,6 @@ #include <common.h> #include <dm.h> -#include <fdtdec.h> #include <i2c.h> #include <os.h> #include <rtc.h> diff --git a/drivers/rtc/mpc5xxx.c b/drivers/rtc/mpc5xxx.c deleted file mode 100644 index 929783e15f..0000000000 --- a/drivers/rtc/mpc5xxx.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (C) Copyright 2004 - * Reinhard Meyer, EMK Elektronik GmbH - * r.meyer@emk-elektronik.de - * www.emk-elektronik.de - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -/***************************************************************************** - * Date & Time support for internal RTC of MPC52xx - *****************************************************************************/ -/*#define DEBUG*/ - -#include <common.h> -#include <command.h> -#include <rtc.h> - -#if defined(CONFIG_CMD_DATE) - -/***************************************************************************** - * this structure should be defined in mpc5200.h ... - *****************************************************************************/ -typedef struct rtc5200 { - volatile ulong tsr; /* MBAR+0x800: time set register */ - volatile ulong dsr; /* MBAR+0x804: data set register */ - volatile ulong nysr; /* MBAR+0x808: new year and stopwatch register */ - volatile ulong aier; /* MBAR+0x80C: alarm and interrupt enable register */ - volatile ulong ctr; /* MBAR+0x810: current time register */ - volatile ulong cdr; /* MBAR+0x814: current data register */ - volatile ulong asir; /* MBAR+0x818: alarm and stopwatch interrupt register */ - volatile ulong piber; /* MBAR+0x81C: periodic interrupt and bus error register */ - volatile ulong trdr; /* MBAR+0x820: test register/divides register */ -} RTC5200; - -#define RTC_SET 0x02000000 -#define RTC_PAUSE 0x01000000 - -/***************************************************************************** - * get time - *****************************************************************************/ -int rtc_get (struct rtc_time *tmp) -{ - RTC5200 *rtc = (RTC5200 *) (CONFIG_SYS_MBAR+0x800); - ulong time, date, time2; - - /* read twice to avoid getting a funny time when the second is just changing */ - do { - time = rtc->ctr; - date = rtc->cdr; - time2 = rtc->ctr; - } while (time != time2); - - tmp->tm_year = date & 0xfff; - tmp->tm_mon = (date >> 24) & 0xf; - tmp->tm_mday = (date >> 16) & 0x1f; - tmp->tm_wday = (date >> 21) & 7; - /* sunday is 7 in 5200 but 0 in rtc_time */ - if (tmp->tm_wday == 7) - tmp->tm_wday = 0; - tmp->tm_hour = (time >> 16) & 0x1f; - tmp->tm_min = (time >> 8) & 0x3f; - tmp->tm_sec = time & 0x3f; - - 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; -} - -/***************************************************************************** - * set time - *****************************************************************************/ -int rtc_set (struct rtc_time *tmp) -{ - RTC5200 *rtc = (RTC5200 *) (CONFIG_SYS_MBAR+0x800); - ulong time, date, year; - - debug ( "Set 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); - - time = (tmp->tm_hour << 16) | (tmp->tm_min << 8) | tmp->tm_sec; - date = (tmp->tm_mon << 16) | tmp->tm_mday; - if (tmp->tm_wday == 0) - date |= (7 << 8); - else - date |= (tmp->tm_wday << 8); - year = tmp->tm_year; - - /* mask unwanted bits that might show up when rtc_time is corrupt */ - time &= 0x001f3f3f; - date &= 0x001f071f; - year &= 0x00000fff; - - /* pause and set the RTC */ - rtc->nysr = year; - rtc->dsr = date | RTC_PAUSE; - udelay (1000); - rtc->dsr = date | RTC_PAUSE | RTC_SET; - udelay (1000); - rtc->dsr = date | RTC_PAUSE; - udelay (1000); - rtc->dsr = date; - udelay (1000); - - rtc->tsr = time | RTC_PAUSE; - udelay (1000); - rtc->tsr = time | RTC_PAUSE | RTC_SET; - udelay (1000); - rtc->tsr = time | RTC_PAUSE; - udelay (1000); - rtc->tsr = time; - udelay (1000); - - return 0; -} - -/***************************************************************************** - * reset rtc circuit - *****************************************************************************/ -void rtc_reset (void) -{ - return; /* nothing to do */ -} - -#endif diff --git a/drivers/rtc/mpc8xx.c b/drivers/rtc/mpc8xx.c deleted file mode 100644 index 147a225c6b..0000000000 --- a/drivers/rtc/mpc8xx.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (C) Copyright 2001 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -/* - * Date & Time support for internal RTC of MPC8xx - */ - -/*#define DEBUG*/ - -#include <common.h> -#include <command.h> -#include <rtc.h> - -#if defined(CONFIG_CMD_DATE) - -/* ------------------------------------------------------------------------- */ - -int rtc_get (struct rtc_time *tmp) -{ - volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; - ulong tim; - - tim = immr->im_sit.sit_rtc; - - rtc_to_tm(tim, 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; -} - -int rtc_set (struct rtc_time *tmp) -{ - volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; - ulong tim; - - debug ( "Set 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); - - tim = rtc_mktime(tmp); - - immr->im_sitk.sitk_rtck = KAPWR_KEY; - immr->im_sit.sit_rtc = tim; - - return 0; -} - -void rtc_reset (void) -{ - return; /* nothing to do */ -} - -#endif |