mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

mc146818_get_cmos_time() is now mostly equivalent to mc146818_get_time() from drivers/rtc/rtc-mc146818-lib.c, with the latter using a more advanced algorithm (which checks the UIP bit in the CMOS). The Malta and Loongson2ef platforms, the only users of mc146818_get_cmos_time() have RTC devices that should be MC146818 compatible. So, rewrite mc146818_get_cmos_time() in a way that uses mc146818_get_time() and add CONFIG_RTC_MC146818_LIB as a dependency of CONFIG_MIPS_MALTA and CONFIG_CPU_LOONGSON2EF. The should be safe as: - malta_defconfig already uses a standard RTC CMOS driver (CONFIG_RTC_DRV_CMOS=y). The Malta board has an Intel 82371EB (PIIX4E) south bridge with the CMOS RTC, so should work correctly with the modification, - Loongson2e and 2f apparently use the VIA686B south bridge and the AMD CS5536 south bridge respectively (at least according to Kconfig). I have checked datasheets of both and these appear to be MC146818 software compatible. Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
28 lines
675 B
C
28 lines
675 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Machine dependent access functions for RTC registers.
|
|
*/
|
|
#ifndef __ASM_MC146818_TIME_H
|
|
#define __ASM_MC146818_TIME_H
|
|
|
|
#include <linux/mc146818rtc.h>
|
|
#include <linux/time.h>
|
|
|
|
#ifdef CONFIG_RTC_MC146818_LIB
|
|
static inline time64_t mc146818_get_cmos_time(void)
|
|
{
|
|
struct rtc_time tm;
|
|
|
|
if (mc146818_get_time(&tm, 1000)) {
|
|
pr_err("Unable to read current time from RTC\n");
|
|
return 0;
|
|
}
|
|
|
|
return rtc_tm_to_time64(&tm);
|
|
}
|
|
#endif /* CONFIG_RTC_MC146818_LIB */
|
|
|
|
#endif /* __ASM_MC146818_TIME_H */
|