I've had these patches in my tree for a while, after the first one
had a few issues that are fixed in this new version. The old-style
PC RTC driver is now also disabled on m68k (as pointed out by
Geert), ppc (it was also blacklisted), and m32r (I showed that
it did not build).
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
Arnd
The genrtc driver serves no purpose on Alpha because it drives the
same hardware as the original rtc.c driver, and the newer rtc-generic.c
or rtc-cmos.c drivers on architectures that use the asm-generic/rtc.h
header.
The defconfig uses CONFIG_RTC=y, so this driver is not used by default.
At one point it was used to abstract a quirk for the "Marvel" platform,
but it does not do this any more after the code was moved into yet
another driver in arch/alpha/kernel/rtc.c.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/char/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Every new architecture has to add itself to the growing list of those
that do not support the legacy PC RTC driver.
This replaces the long list of architectures that don't support it
with a shorter list of those that do.
The list is taken from those architectures that have a non-empty
asm/mc146818rtc.h header file and were not explicitly blacklisted.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/char/Kconfig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -279,8 +279,7 @@ if RTC_LIB=nconfigRTCtristate"Enhanced Real Time Clock Support (legacy PC RTC driver)"-depends on!PPC&&!PARISC&&!IA64&&!M68K&&!SPARC&&!FRV\-&&!ARM&&!SUPERH&&!S390&&!AVR32&&!BLACKFIN&&!UML+depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300||X86---help---IfyousayYhereandcreateacharacterspecialfile/dev/rtcwithmajornumber10andminornumber135usingmknod("man mknod"),you
Nothing on these architectures ever includes the asm/mc146818rtc.h
file, the drivers that used to do this have been fixed long ago,
and the remaining users are all PC-specific.
This removes the files for good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/frv/include/asm/mc146818rtc.h | 16 ----------------
arch/h8300/include/asm/mc146818rtc.h | 9 ---------
arch/ia64/include/asm/mc146818rtc.h | 10 ----------
arch/parisc/include/asm/mc146818rtc.h | 9 ---------
arch/sh/include/asm/mc146818rtc.h | 7 -------
5 files changed, 51 deletions(-)
delete mode 100644 arch/frv/include/asm/mc146818rtc.h
delete mode 100644 arch/h8300/include/asm/mc146818rtc.h
delete mode 100644 arch/ia64/include/asm/mc146818rtc.h
delete mode 100644 arch/parisc/include/asm/mc146818rtc.h
delete mode 100644 arch/sh/include/asm/mc146818rtc.h
@@ -1,16 +0,0 @@-/* mc146818rtc.h: RTC defs- *- * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.- * Written by David Howells (dhowells@redhat.com)- *- * 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.- */--#ifndef _ASM_MC146818RTC_H-#define _ASM_MC146818RTC_H---#endif /* _ASM_MC146818RTC_H */
@@ -1,9 +0,0 @@-/*- * Machine dependent access functions for RTC registers.- */-#ifndef _H8300_MC146818RTC_H-#define _H8300_MC146818RTC_H--/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */--#endif /* _H8300_MC146818RTC_H */
@@ -1,10 +0,0 @@-#ifndef _ASM_IA64_MC146818RTC_H-#define _ASM_IA64_MC146818RTC_H--/*- * Machine dependent access functions for RTC registers.- */--/* empty include file to satisfy the include in genrtc.c */--#endif /* _ASM_IA64_MC146818RTC_H */
@@ -1,9 +0,0 @@-/*- * Machine dependent access functions for RTC registers.- */-#ifndef _ASM_MC146818RTC_H-#define _ASM_MC146818RTC_H--/* empty include file to satisfy the include in genrtc.c */--#endif /* _ASM_MC146818RTC_H */
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/parisc/include/asm/rtc.h | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
The genrtc driver serves no purpose on mn10300 because it drives the
same hardware as the original rtc.c driver, and the newer rtc-generic.c
or rtc-cmos.c drivers on architectures that use the asm-generic/rtc.h
header.
I assume it was initially only added for completeness when the
mn10300 port was done, but the older rtc.c driver was always used
instead.
It would be nice to change the architecture to use the rtc-cmos driver
next, and remove support for the old rtc driver as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/char/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/powerpc/include/asm/rtc.h | 36 +++++-------------------------------
1 file changed, 5 insertions(+), 31 deletions(-)
@@ -26,23 +26,14 @@#ifdef __KERNEL__-#include<linux/rtc.h>+#define get_rtc_time powerpc_get_rtc_time+#define set_rtc_time powerpc_set_rtc_time+#include<asm-generic/rtc.h>#include<asm/machdep.h>#include<asm/time.h>-#define RTC_PIE 0x40 /* periodic interrupt enable */-#define RTC_AIE 0x20 /* alarm interrupt enable */-#define RTC_UIE 0x10 /* update-finished interrupt enable */--/* some dummy definitions */-#define RTC_BATT_BAD 0x100 /* battery bad */-#define RTC_SQWE 0x08 /* enable square-wave output */-#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */-#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */-#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */--staticinlineunsignedintget_rtc_time(structrtc_time*time)+staticinlineunsignedintpowerpc_get_rtc_time(structrtc_time*time){if(ppc_md.get_rtc_time)ppc_md.get_rtc_time(time);
@@ -50,29 +41,12 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)}/* Set the current date and time in the real time clock. */-staticinlineintset_rtc_time(structrtc_time*time)+staticinlineintpowerpc_set_rtc_time(structrtc_time*time){if(ppc_md.set_rtc_time)returnppc_md.set_rtc_time(time);return-EINVAL;}-staticinlineunsignedintget_rtc_ss(void)-{-structrtc_timeh;--get_rtc_time(&h);-returnh.tm_sec;-}--staticinlineintget_rtc_pll(structrtc_pll_info*pll)-{-return-EINVAL;-}-staticinlineintset_rtc_pll(structrtc_pll_info*pll)-{-return-EINVAL;-}-#endif /* __KERNEL__ */#endif /* __ASM_POWERPC_RTC_H__ */
Commit 3195ef59cb42 ("x86: Do full rtc synchronization with ntp") had
the side-effect of unconditionally enabling the RTC_LIB symbol on x86,
which in turn disables the selection of the CONFIG_RTC and
CONFIG_GEN_RTC drivers that contain a two older implementations of
the CONFIG_RTC_DRV_CMOS driver.
This removes x86 from the list.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/char/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -279,7 +279,7 @@ if RTC_LIB=nconfigRTCtristate"Enhanced Real Time Clock Support (legacy PC RTC driver)"-depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300||X86+depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300---help---IfyousayYhereandcreateacharacterspecialfile/dev/rtcwithmajornumber10andminornumber135usingmknod("man mknod"),you
Drivers should not really include stuff from asm-generic directly,
and the PC-style cmos rtc driver does this in order to reuse the
mc146818 implementation of get_rtc_time/set_rtc_time rather than
the architecture specific one for the architecture it gets built for.
To make it more obvious what is going on, this moves and renames the
two functions into include/linux/mc146818rtc.h, which holds the
other mc146818 specific code. Ideally it would be in a .c file,
but that would require extra infrastructure as the functions are
called by multiple drivers with conflicting dependencies.
With this change, the asm-generic/rtc.h header also becomes much
more generic, so it can be reused more easily across any architecture
that still relies on the genrtc driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/rtc-cmos.c | 12 +--
include/asm-generic/rtc.h | 206 ++------------------------------------------
include/linux/mc146818rtc.h | 194 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 205 insertions(+), 207 deletions(-)
@@ -43,7 +43,7 @@#include<linux/of_platform.h>/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */-#include<asm-generic/rtc.h>+#include<linux/mc146818rtc.h>structcmos_rtc{structrtc_device*rtc;
@@ -190,10 +190,10 @@ static inline void cmos_write_bank2(unsigned char val, unsigned char addr)staticintcmos_read_time(structdevice*dev,structrtc_time*t){/* REVISIT: if the clock has a "century" register, use-*thatinsteadoftheheuristicinget_rtc_time().+*thatinsteadoftheheuristicinmc146818_get_time().*That'llmakeY3Kcompatility(year>2070)easy!*/-get_rtc_time(t);+mc146818_get_time(t);return0;}
@@ -31,202 +31,6 @@#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */-/*-*Returnstrueifaclockupdateisinprogress-*/-staticinlineunsignedcharrtc_is_updating(void)-{-unsignedcharuip;-unsignedlongflags;--spin_lock_irqsave(&rtc_lock,flags);-uip=(CMOS_READ(RTC_FREQ_SELECT)&RTC_UIP);-spin_unlock_irqrestore(&rtc_lock,flags);-returnuip;-}--staticinlineunsignedint__get_rtc_time(structrtc_time*time)-{-unsignedcharctrl;-unsignedlongflags;-unsignedcharcentury=0;--#ifdef CONFIG_MACH_DECSTATION-unsignedintreal_year;-#endif--/*-*readRTConceanyupdateinprogressisdone.Theupdate-*cantakejustover2ms.Wewait20ms.Thereisnoneedto-*topoll-wait(upto1s-eeccch)forthefallingedgeofRTC_UIP.-*Ifyouneedtoknow*exactly*whenasecondhasstarted,enable-*periodicupdatecompleteinterrupts,(viaioctl)andthen-*immediatelyread/dev/rtcwhichwillblockuntilyougettheIRQ.-*Oncethereadclears,readtheRTCtime(againviaioctl).Easy.-*/-if(rtc_is_updating())-mdelay(20);--/*-*OnlythevaluesthatwereadfromtheRTCareset.Weleave-*tm_wday,tm_ydayandtm_isdstuntouched.Eventhoughthe-*RTChasRTC_DAY_OF_WEEK,weignoreit,asitisonlyupdated-*bytheRTCwheninitiallysettoanon-zerovalue.-*/-spin_lock_irqsave(&rtc_lock,flags);-time->tm_sec=CMOS_READ(RTC_SECONDS);-time->tm_min=CMOS_READ(RTC_MINUTES);-time->tm_hour=CMOS_READ(RTC_HOURS);-time->tm_mday=CMOS_READ(RTC_DAY_OF_MONTH);-time->tm_mon=CMOS_READ(RTC_MONTH);-time->tm_year=CMOS_READ(RTC_YEAR);-#ifdef CONFIG_MACH_DECSTATION-real_year=CMOS_READ(RTC_DEC_YEAR);-#endif-#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century)-century=CMOS_READ(acpi_gbl_FADT.century);-#endif-ctrl=CMOS_READ(RTC_CONTROL);-spin_unlock_irqrestore(&rtc_lock,flags);--if(!(ctrl&RTC_DM_BINARY)||RTC_ALWAYS_BCD)-{-time->tm_sec=bcd2bin(time->tm_sec);-time->tm_min=bcd2bin(time->tm_min);-time->tm_hour=bcd2bin(time->tm_hour);-time->tm_mday=bcd2bin(time->tm_mday);-time->tm_mon=bcd2bin(time->tm_mon);-time->tm_year=bcd2bin(time->tm_year);-century=bcd2bin(century);-}--#ifdef CONFIG_MACH_DECSTATION-time->tm_year+=real_year-72;-#endif--if(century)-time->tm_year+=(century-19)*100;--/*-*AccountfordifferencesbetweenhowtheRTCusesthevalues-*andhowtheyaredefinedinastructrtc_time;-*/-if(time->tm_year<=69)-time->tm_year+=100;--time->tm_mon--;--returnRTC_24H;-}--#ifndef get_rtc_time-#define get_rtc_time __get_rtc_time-#endif--/* Set the current date and time in the real time clock. */-staticinlineint__set_rtc_time(structrtc_time*time)-{-unsignedlongflags;-unsignedcharmon,day,hrs,min,sec;-unsignedcharsave_control,save_freq_select;-unsignedintyrs;-#ifdef CONFIG_MACH_DECSTATION-unsignedintreal_yrs,leap_yr;-#endif-unsignedcharcentury=0;--yrs=time->tm_year;-mon=time->tm_mon+1;/* tm_mon starts at zero */-day=time->tm_mday;-hrs=time->tm_hour;-min=time->tm_min;-sec=time->tm_sec;--if(yrs>255)/* They are unsigned */-return-EINVAL;--spin_lock_irqsave(&rtc_lock,flags);-#ifdef CONFIG_MACH_DECSTATION-real_yrs=yrs;-leap_yr=((!((yrs+1900)%4)&&((yrs+1900)%100))||-!((yrs+1900)%400));-yrs=72;--/*-*Wewanttokeeptheyearsetto73untilMarch-*fornon-leapyears,sothatFeb,29thishandled-*correctly.-*/-if(!leap_yr&&mon<3){-real_yrs--;-yrs=73;-}-#endif--#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century){-century=(yrs+1900)/100;-yrs%=100;-}-#endif--/* These limits and adjustments are independent of-*whetherthechipisinbinarymodeornot.-*/-if(yrs>169){-spin_unlock_irqrestore(&rtc_lock,flags);-return-EINVAL;-}--if(yrs>=100)-yrs-=100;--if(!(CMOS_READ(RTC_CONTROL)&RTC_DM_BINARY)-||RTC_ALWAYS_BCD){-sec=bin2bcd(sec);-min=bin2bcd(min);-hrs=bin2bcd(hrs);-day=bin2bcd(day);-mon=bin2bcd(mon);-yrs=bin2bcd(yrs);-century=bin2bcd(century);-}--save_control=CMOS_READ(RTC_CONTROL);-CMOS_WRITE((save_control|RTC_SET),RTC_CONTROL);-save_freq_select=CMOS_READ(RTC_FREQ_SELECT);-CMOS_WRITE((save_freq_select|RTC_DIV_RESET2),RTC_FREQ_SELECT);--#ifdef CONFIG_MACH_DECSTATION-CMOS_WRITE(real_yrs,RTC_DEC_YEAR);-#endif-CMOS_WRITE(yrs,RTC_YEAR);-CMOS_WRITE(mon,RTC_MONTH);-CMOS_WRITE(day,RTC_DAY_OF_MONTH);-CMOS_WRITE(hrs,RTC_HOURS);-CMOS_WRITE(min,RTC_MINUTES);-CMOS_WRITE(sec,RTC_SECONDS);-#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century)-CMOS_WRITE(century,acpi_gbl_FADT.century);-#endif--CMOS_WRITE(save_control,RTC_CONTROL);-CMOS_WRITE(save_freq_select,RTC_FREQ_SELECT);--spin_unlock_irqrestore(&rtc_lock,flags);--return0;-}--#ifndef set_rtc_time-#define set_rtc_time __set_rtc_time-#endif-staticinlineunsignedintget_rtc_ss(void){structrtc_timeh;
@@ -14,6 +14,12 @@#include<asm/io.h>#include<linux/rtc.h> /* get the user-level API */#include<asm/mc146818rtc.h> /* register access macros */+#include<linux/bcd.h>+#include<linux/delay.h>++#ifdef CONFIG_ACPI+#include<linux/acpi.h>+#endif#ifdef __KERNEL__#include<linux/spinlock.h> /* spinlock_t */
@@ -120,4 +126,192 @@ struct cmos_rtc_board_info {#define RTC_IO_EXTENT_USED RTC_IO_EXTENT#endif /* ARCH_RTC_LOCATION */+/*+*Returnstrueifaclockupdateisinprogress+*/+staticinlineunsignedcharmc146818_is_updating(void)+{+unsignedcharuip;+unsignedlongflags;++spin_lock_irqsave(&rtc_lock,flags);+uip=(CMOS_READ(RTC_FREQ_SELECT)&RTC_UIP);+spin_unlock_irqrestore(&rtc_lock,flags);+returnuip;+}++staticinlineunsignedintmc146818_get_time(structrtc_time*time)+{+unsignedcharctrl;+unsignedlongflags;+unsignedcharcentury=0;++#ifdef CONFIG_MACH_DECSTATION+unsignedintreal_year;+#endif++/*+*readRTConceanyupdateinprogressisdone.Theupdate+*cantakejustover2ms.Wewait20ms.Thereisnoneedto+*topoll-wait(upto1s-eeccch)forthefallingedgeofRTC_UIP.+*Ifyouneedtoknow*exactly*whenasecondhasstarted,enable+*periodicupdatecompleteinterrupts,(viaioctl)andthen+*immediatelyread/dev/rtcwhichwillblockuntilyougettheIRQ.+*Oncethereadclears,readtheRTCtime(againviaioctl).Easy.+*/+if(mc146818_is_updating())+mdelay(20);++/*+*OnlythevaluesthatwereadfromtheRTCareset.Weleave+*tm_wday,tm_ydayandtm_isdstuntouched.Eventhoughthe+*RTChasRTC_DAY_OF_WEEK,weignoreit,asitisonlyupdated+*bytheRTCwheninitiallysettoanon-zerovalue.+*/+spin_lock_irqsave(&rtc_lock,flags);+time->tm_sec=CMOS_READ(RTC_SECONDS);+time->tm_min=CMOS_READ(RTC_MINUTES);+time->tm_hour=CMOS_READ(RTC_HOURS);+time->tm_mday=CMOS_READ(RTC_DAY_OF_MONTH);+time->tm_mon=CMOS_READ(RTC_MONTH);+time->tm_year=CMOS_READ(RTC_YEAR);+#ifdef CONFIG_MACH_DECSTATION+real_year=CMOS_READ(RTC_DEC_YEAR);+#endif+#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century)+century=CMOS_READ(acpi_gbl_FADT.century);+#endif+ctrl=CMOS_READ(RTC_CONTROL);+spin_unlock_irqrestore(&rtc_lock,flags);++if(!(ctrl&RTC_DM_BINARY)||RTC_ALWAYS_BCD)+{+time->tm_sec=bcd2bin(time->tm_sec);+time->tm_min=bcd2bin(time->tm_min);+time->tm_hour=bcd2bin(time->tm_hour);+time->tm_mday=bcd2bin(time->tm_mday);+time->tm_mon=bcd2bin(time->tm_mon);+time->tm_year=bcd2bin(time->tm_year);+century=bcd2bin(century);+}++#ifdef CONFIG_MACH_DECSTATION+time->tm_year+=real_year-72;+#endif++if(century)+time->tm_year+=(century-19)*100;++/*+*AccountfordifferencesbetweenhowtheRTCusesthevalues+*andhowtheyaredefinedinastructrtc_time;+*/+if(time->tm_year<=69)+time->tm_year+=100;++time->tm_mon--;++returnRTC_24H;+}++/* Set the current date and time in the real time clock. */+staticinlineintmc146818_set_time(structrtc_time*time)+{+unsignedlongflags;+unsignedcharmon,day,hrs,min,sec;+unsignedcharsave_control,save_freq_select;+unsignedintyrs;+#ifdef CONFIG_MACH_DECSTATION+unsignedintreal_yrs,leap_yr;+#endif+unsignedcharcentury=0;++yrs=time->tm_year;+mon=time->tm_mon+1;/* tm_mon starts at zero */+day=time->tm_mday;+hrs=time->tm_hour;+min=time->tm_min;+sec=time->tm_sec;++if(yrs>255)/* They are unsigned */+return-EINVAL;++spin_lock_irqsave(&rtc_lock,flags);+#ifdef CONFIG_MACH_DECSTATION+real_yrs=yrs;+leap_yr=((!((yrs+1900)%4)&&((yrs+1900)%100))||+!((yrs+1900)%400));+yrs=72;++/*+*Wewanttokeeptheyearsetto73untilMarch+*fornon-leapyears,sothatFeb,29thishandled+*correctly.+*/+if(!leap_yr&&mon<3){+real_yrs--;+yrs=73;+}+#endif++#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century){+century=(yrs+1900)/100;+yrs%=100;+}+#endif++/* These limits and adjustments are independent of+*whetherthechipisinbinarymodeornot.+*/+if(yrs>169){+spin_unlock_irqrestore(&rtc_lock,flags);+return-EINVAL;+}++if(yrs>=100)+yrs-=100;++if(!(CMOS_READ(RTC_CONTROL)&RTC_DM_BINARY)+||RTC_ALWAYS_BCD){+sec=bin2bcd(sec);+min=bin2bcd(min);+hrs=bin2bcd(hrs);+day=bin2bcd(day);+mon=bin2bcd(mon);+yrs=bin2bcd(yrs);+century=bin2bcd(century);+}++save_control=CMOS_READ(RTC_CONTROL);+CMOS_WRITE((save_control|RTC_SET),RTC_CONTROL);+save_freq_select=CMOS_READ(RTC_FREQ_SELECT);+CMOS_WRITE((save_freq_select|RTC_DIV_RESET2),RTC_FREQ_SELECT);++#ifdef CONFIG_MACH_DECSTATION+CMOS_WRITE(real_yrs,RTC_DEC_YEAR);+#endif+CMOS_WRITE(yrs,RTC_YEAR);+CMOS_WRITE(mon,RTC_MONTH);+CMOS_WRITE(day,RTC_DAY_OF_MONTH);+CMOS_WRITE(hrs,RTC_HOURS);+CMOS_WRITE(min,RTC_MINUTES);+CMOS_WRITE(sec,RTC_SECONDS);+#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century)+CMOS_WRITE(century,acpi_gbl_FADT.century);+#endif++CMOS_WRITE(save_control,RTC_CONTROL);+CMOS_WRITE(save_freq_select,RTC_FREQ_SELECT);++spin_unlock_irqrestore(&rtc_lock,flags);++return0;+}+#endif /* _MC146818RTC_H */
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
Hi Arnd,
On Tue, Apr 26, 2016 at 11:44 PM, Arnd Bergmann [off-list ref] wrote:
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
CONFIG_GEN_RTC is not enabled in any of the m68k defconfigs, so I think genrtc
has been unused for a while.
All defconfigs either use CONFIG_RTC_DRV_GENERIC, or enable a more specific
RTC driver.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On 26/04/2016 at 23:44:05 +0200, Arnd Bergmann wrote :
Every new architecture has to add itself to the growing list of those
that do not support the legacy PC RTC driver.
This replaces the long list of architectures that don't support it
with a shorter list of those that do.
The list is taken from those architectures that have a non-empty
asm/mc146818rtc.h header file and were not explicitly blacklisted.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
@@ -279,8 +279,7 @@ if RTC_LIB=nconfigRTCtristate"Enhanced Real Time Clock Support (legacy PC RTC driver)"-depends on!PPC&&!PARISC&&!IA64&&!M68K&&!SPARC&&!FRV\-&&!ARM&&!SUPERH&&!S390&&!AVR32&&!BLACKFIN&&!UML+depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300||X86---help---IfyousayYhereandcreateacharacterspecialfile/dev/rtcwithmajornumber10andminornumber135usingmknod("man mknod"),you
On Wednesday 27 April 2016 09:54:41 Geert Uytterhoeven wrote:
Hi Arnd,
On Tue, Apr 26, 2016 at 11:44 PM, Arnd Bergmann [off-list ref] wrote:
quoted
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
CONFIG_GEN_RTC is not enabled in any of the m68k defconfigs, so I think genrtc
has been unused for a while.
All defconfigs either use CONFIG_RTC_DRV_GENERIC, or enable a more specific
RTC driver.
Ok, good to know. I'm guessing the same is true for parisc, but there are
also very few users.
Regarding the Q40 specific ioctls, what do you think this means, is it
a) nobody uses Q40 with modern kernels,
b) nobody calls RTC_PLL_GET/RTC_PLL_SET on q40, or
c) Q40 users have their own configurations and enable GEN_RTC?
On powerpc, a quarter of the defconfigs (mostly for really old hardware)
still use GEN_RTC, but I guess we can either bulk-convert them to RTC_GENERIC,
or convert the five implementations of .get_rtc_time/.set_rtc_time
(8xx, rtas, chrp, powermac, maple) into five regular RTC class drivers.
Arnd
On 26/04/2016 at 23:44:06 +0200, Arnd Bergmann wrote :
Commit 3195ef59cb42 ("x86: Do full rtc synchronization with ntp") had
the side-effect of unconditionally enabling the RTC_LIB symbol on x86,
which in turn disables the selection of the CONFIG_RTC and
CONFIG_GEN_RTC drivers that contain a two older implementations of
the CONFIG_RTC_DRV_CMOS driver.
This removes x86 from the list.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alexandre Belloni <redacted>
Two down, still four drivers for the x86 RTCs...
@@ -279,7 +279,7 @@ if RTC_LIB=nconfigRTCtristate"Enhanced Real Time Clock Support (legacy PC RTC driver)"-depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300||X86+depends onALPHA||(MIPS&&MACH_LOONGSON64)||MN10300---help---IfyousayYhereandcreateacharacterspecialfile/dev/rtcwithmajornumber10andminornumber135usingmknod("man mknod"),you
Hi Arnd,
On Wed, Apr 27, 2016 at 10:33 AM, Arnd Bergmann [off-list ref] wrote:
On Wednesday 27 April 2016 09:54:41 Geert Uytterhoeven wrote:
quoted
On Tue, Apr 26, 2016 at 11:44 PM, Arnd Bergmann [off-list ref] wrote:
quoted
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
CONFIG_GEN_RTC is not enabled in any of the m68k defconfigs, so I think genrtc
has been unused for a while.
All defconfigs either use CONFIG_RTC_DRV_GENERIC, or enable a more specific
RTC driver.
Ok, good to know. I'm guessing the same is true for parisc, but there are
also very few users.
Regarding the Q40 specific ioctls, what do you think this means, is it
a) nobody uses Q40 with modern kernels,
b) nobody calls RTC_PLL_GET/RTC_PLL_SET on q40, or
c) Q40 users have their own configurations and enable GEN_RTC?
To be honest, I have no idea. There have never been many Q40 users.
(old) http://www.linux-m68k.org/Registry/Statistics.html shows only 8.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On 26/04/2016 at 23:44:07 +0200, Arnd Bergmann wrote :
Nothing on these architectures ever includes the asm/mc146818rtc.h
file, the drivers that used to do this have been fixed long ago,
and the remaining users are all PC-specific.
This removes the files for good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
@@ -1,16 +0,0 @@-/* mc146818rtc.h: RTC defs- *- * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.- * Written by David Howells (dhowells@redhat.com)- *- * 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.- */--#ifndef _ASM_MC146818RTC_H-#define _ASM_MC146818RTC_H---#endif /* _ASM_MC146818RTC_H */
@@ -1,9 +0,0 @@-/*- * Machine dependent access functions for RTC registers.- */-#ifndef _H8300_MC146818RTC_H-#define _H8300_MC146818RTC_H--/* empty include file to satisfy the include in genrtc.c/ide-geometry.c */--#endif /* _H8300_MC146818RTC_H */
@@ -1,10 +0,0 @@-#ifndef _ASM_IA64_MC146818RTC_H-#define _ASM_IA64_MC146818RTC_H--/*- * Machine dependent access functions for RTC registers.- */--/* empty include file to satisfy the include in genrtc.c */--#endif /* _ASM_IA64_MC146818RTC_H */
@@ -1,9 +0,0 @@-/*- * Machine dependent access functions for RTC registers.- */-#ifndef _ASM_MC146818RTC_H-#define _ASM_MC146818RTC_H--/* empty include file to satisfy the include in genrtc.c */--#endif /* _ASM_MC146818RTC_H */
The subject should be:
rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h
Else, you can add:
Acked-by: Alexandre Belloni <redacted>
On 26/04/2016 at 23:44:08 +0200, Arnd Bergmann wrote :
quoted hunk
Drivers should not really include stuff from asm-generic directly,
and the PC-style cmos rtc driver does this in order to reuse the
mc146818 implementation of get_rtc_time/set_rtc_time rather than
the architecture specific one for the architecture it gets built for.
To make it more obvious what is going on, this moves and renames the
two functions into include/linux/mc146818rtc.h, which holds the
other mc146818 specific code. Ideally it would be in a .c file,
but that would require extra infrastructure as the functions are
called by multiple drivers with conflicting dependencies.
With this change, the asm-generic/rtc.h header also becomes much
more generic, so it can be reused more easily across any architecture
that still relies on the genrtc driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/rtc-cmos.c | 12 +--
include/asm-generic/rtc.h | 206 ++------------------------------------------
include/linux/mc146818rtc.h | 194 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 205 insertions(+), 207 deletions(-)
@@ -43,7 +43,7 @@#include<linux/of_platform.h>/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */-#include<asm-generic/rtc.h>+#include<linux/mc146818rtc.h>structcmos_rtc{structrtc_device*rtc;
@@ -190,10 +190,10 @@ static inline void cmos_write_bank2(unsigned char val, unsigned char addr)staticintcmos_read_time(structdevice*dev,structrtc_time*t){/* REVISIT: if the clock has a "century" register, use-*thatinsteadoftheheuristicinget_rtc_time().+*thatinsteadoftheheuristicinmc146818_get_time().*That'llmakeY3Kcompatility(year>2070)easy!*/-get_rtc_time(t);+mc146818_get_time(t);return0;}
@@ -31,202 +31,6 @@#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */-/*-*Returnstrueifaclockupdateisinprogress-*/-staticinlineunsignedcharrtc_is_updating(void)-{-unsignedcharuip;-unsignedlongflags;--spin_lock_irqsave(&rtc_lock,flags);-uip=(CMOS_READ(RTC_FREQ_SELECT)&RTC_UIP);-spin_unlock_irqrestore(&rtc_lock,flags);-returnuip;-}--staticinlineunsignedint__get_rtc_time(structrtc_time*time)-{-unsignedcharctrl;-unsignedlongflags;-unsignedcharcentury=0;--#ifdef CONFIG_MACH_DECSTATION-unsignedintreal_year;-#endif--/*-*readRTConceanyupdateinprogressisdone.Theupdate-*cantakejustover2ms.Wewait20ms.Thereisnoneedto-*topoll-wait(upto1s-eeccch)forthefallingedgeofRTC_UIP.-*Ifyouneedtoknow*exactly*whenasecondhasstarted,enable-*periodicupdatecompleteinterrupts,(viaioctl)andthen-*immediatelyread/dev/rtcwhichwillblockuntilyougettheIRQ.-*Oncethereadclears,readtheRTCtime(againviaioctl).Easy.-*/-if(rtc_is_updating())-mdelay(20);--/*-*OnlythevaluesthatwereadfromtheRTCareset.Weleave-*tm_wday,tm_ydayandtm_isdstuntouched.Eventhoughthe-*RTChasRTC_DAY_OF_WEEK,weignoreit,asitisonlyupdated-*bytheRTCwheninitiallysettoanon-zerovalue.-*/-spin_lock_irqsave(&rtc_lock,flags);-time->tm_sec=CMOS_READ(RTC_SECONDS);-time->tm_min=CMOS_READ(RTC_MINUTES);-time->tm_hour=CMOS_READ(RTC_HOURS);-time->tm_mday=CMOS_READ(RTC_DAY_OF_MONTH);-time->tm_mon=CMOS_READ(RTC_MONTH);-time->tm_year=CMOS_READ(RTC_YEAR);-#ifdef CONFIG_MACH_DECSTATION-real_year=CMOS_READ(RTC_DEC_YEAR);-#endif-#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century)-century=CMOS_READ(acpi_gbl_FADT.century);-#endif-ctrl=CMOS_READ(RTC_CONTROL);-spin_unlock_irqrestore(&rtc_lock,flags);--if(!(ctrl&RTC_DM_BINARY)||RTC_ALWAYS_BCD)-{-time->tm_sec=bcd2bin(time->tm_sec);-time->tm_min=bcd2bin(time->tm_min);-time->tm_hour=bcd2bin(time->tm_hour);-time->tm_mday=bcd2bin(time->tm_mday);-time->tm_mon=bcd2bin(time->tm_mon);-time->tm_year=bcd2bin(time->tm_year);-century=bcd2bin(century);-}--#ifdef CONFIG_MACH_DECSTATION-time->tm_year+=real_year-72;-#endif--if(century)-time->tm_year+=(century-19)*100;--/*-*AccountfordifferencesbetweenhowtheRTCusesthevalues-*andhowtheyaredefinedinastructrtc_time;-*/-if(time->tm_year<=69)-time->tm_year+=100;--time->tm_mon--;--returnRTC_24H;-}--#ifndef get_rtc_time-#define get_rtc_time __get_rtc_time-#endif--/* Set the current date and time in the real time clock. */-staticinlineint__set_rtc_time(structrtc_time*time)-{-unsignedlongflags;-unsignedcharmon,day,hrs,min,sec;-unsignedcharsave_control,save_freq_select;-unsignedintyrs;-#ifdef CONFIG_MACH_DECSTATION-unsignedintreal_yrs,leap_yr;-#endif-unsignedcharcentury=0;--yrs=time->tm_year;-mon=time->tm_mon+1;/* tm_mon starts at zero */-day=time->tm_mday;-hrs=time->tm_hour;-min=time->tm_min;-sec=time->tm_sec;--if(yrs>255)/* They are unsigned */-return-EINVAL;--spin_lock_irqsave(&rtc_lock,flags);-#ifdef CONFIG_MACH_DECSTATION-real_yrs=yrs;-leap_yr=((!((yrs+1900)%4)&&((yrs+1900)%100))||-!((yrs+1900)%400));-yrs=72;--/*-*Wewanttokeeptheyearsetto73untilMarch-*fornon-leapyears,sothatFeb,29thishandled-*correctly.-*/-if(!leap_yr&&mon<3){-real_yrs--;-yrs=73;-}-#endif--#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century){-century=(yrs+1900)/100;-yrs%=100;-}-#endif--/* These limits and adjustments are independent of-*whetherthechipisinbinarymodeornot.-*/-if(yrs>169){-spin_unlock_irqrestore(&rtc_lock,flags);-return-EINVAL;-}--if(yrs>=100)-yrs-=100;--if(!(CMOS_READ(RTC_CONTROL)&RTC_DM_BINARY)-||RTC_ALWAYS_BCD){-sec=bin2bcd(sec);-min=bin2bcd(min);-hrs=bin2bcd(hrs);-day=bin2bcd(day);-mon=bin2bcd(mon);-yrs=bin2bcd(yrs);-century=bin2bcd(century);-}--save_control=CMOS_READ(RTC_CONTROL);-CMOS_WRITE((save_control|RTC_SET),RTC_CONTROL);-save_freq_select=CMOS_READ(RTC_FREQ_SELECT);-CMOS_WRITE((save_freq_select|RTC_DIV_RESET2),RTC_FREQ_SELECT);--#ifdef CONFIG_MACH_DECSTATION-CMOS_WRITE(real_yrs,RTC_DEC_YEAR);-#endif-CMOS_WRITE(yrs,RTC_YEAR);-CMOS_WRITE(mon,RTC_MONTH);-CMOS_WRITE(day,RTC_DAY_OF_MONTH);-CMOS_WRITE(hrs,RTC_HOURS);-CMOS_WRITE(min,RTC_MINUTES);-CMOS_WRITE(sec,RTC_SECONDS);-#ifdef CONFIG_ACPI-if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&-acpi_gbl_FADT.century)-CMOS_WRITE(century,acpi_gbl_FADT.century);-#endif--CMOS_WRITE(save_control,RTC_CONTROL);-CMOS_WRITE(save_freq_select,RTC_FREQ_SELECT);--spin_unlock_irqrestore(&rtc_lock,flags);--return0;-}--#ifndef set_rtc_time-#define set_rtc_time __set_rtc_time-#endif-staticinlineunsignedintget_rtc_ss(void){structrtc_timeh;
@@ -14,6 +14,12 @@#include<asm/io.h>#include<linux/rtc.h> /* get the user-level API */#include<asm/mc146818rtc.h> /* register access macros */+#include<linux/bcd.h>+#include<linux/delay.h>++#ifdef CONFIG_ACPI+#include<linux/acpi.h>+#endif#ifdef __KERNEL__#include<linux/spinlock.h> /* spinlock_t */
@@ -120,4 +126,192 @@ struct cmos_rtc_board_info {#define RTC_IO_EXTENT_USED RTC_IO_EXTENT#endif /* ARCH_RTC_LOCATION */+/*+*Returnstrueifaclockupdateisinprogress+*/+staticinlineunsignedcharmc146818_is_updating(void)+{+unsignedcharuip;+unsignedlongflags;++spin_lock_irqsave(&rtc_lock,flags);+uip=(CMOS_READ(RTC_FREQ_SELECT)&RTC_UIP);+spin_unlock_irqrestore(&rtc_lock,flags);+returnuip;+}++staticinlineunsignedintmc146818_get_time(structrtc_time*time)+{+unsignedcharctrl;+unsignedlongflags;+unsignedcharcentury=0;++#ifdef CONFIG_MACH_DECSTATION+unsignedintreal_year;+#endif++/*+*readRTConceanyupdateinprogressisdone.Theupdate+*cantakejustover2ms.Wewait20ms.Thereisnoneedto+*topoll-wait(upto1s-eeccch)forthefallingedgeofRTC_UIP.+*Ifyouneedtoknow*exactly*whenasecondhasstarted,enable+*periodicupdatecompleteinterrupts,(viaioctl)andthen+*immediatelyread/dev/rtcwhichwillblockuntilyougettheIRQ.+*Oncethereadclears,readtheRTCtime(againviaioctl).Easy.+*/+if(mc146818_is_updating())+mdelay(20);++/*+*OnlythevaluesthatwereadfromtheRTCareset.Weleave+*tm_wday,tm_ydayandtm_isdstuntouched.Eventhoughthe+*RTChasRTC_DAY_OF_WEEK,weignoreit,asitisonlyupdated+*bytheRTCwheninitiallysettoanon-zerovalue.+*/+spin_lock_irqsave(&rtc_lock,flags);+time->tm_sec=CMOS_READ(RTC_SECONDS);+time->tm_min=CMOS_READ(RTC_MINUTES);+time->tm_hour=CMOS_READ(RTC_HOURS);+time->tm_mday=CMOS_READ(RTC_DAY_OF_MONTH);+time->tm_mon=CMOS_READ(RTC_MONTH);+time->tm_year=CMOS_READ(RTC_YEAR);+#ifdef CONFIG_MACH_DECSTATION+real_year=CMOS_READ(RTC_DEC_YEAR);+#endif+#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century)+century=CMOS_READ(acpi_gbl_FADT.century);+#endif+ctrl=CMOS_READ(RTC_CONTROL);+spin_unlock_irqrestore(&rtc_lock,flags);++if(!(ctrl&RTC_DM_BINARY)||RTC_ALWAYS_BCD)+{+time->tm_sec=bcd2bin(time->tm_sec);+time->tm_min=bcd2bin(time->tm_min);+time->tm_hour=bcd2bin(time->tm_hour);+time->tm_mday=bcd2bin(time->tm_mday);+time->tm_mon=bcd2bin(time->tm_mon);+time->tm_year=bcd2bin(time->tm_year);+century=bcd2bin(century);+}++#ifdef CONFIG_MACH_DECSTATION+time->tm_year+=real_year-72;+#endif++if(century)+time->tm_year+=(century-19)*100;++/*+*AccountfordifferencesbetweenhowtheRTCusesthevalues+*andhowtheyaredefinedinastructrtc_time;+*/+if(time->tm_year<=69)+time->tm_year+=100;++time->tm_mon--;++returnRTC_24H;+}++/* Set the current date and time in the real time clock. */+staticinlineintmc146818_set_time(structrtc_time*time)+{+unsignedlongflags;+unsignedcharmon,day,hrs,min,sec;+unsignedcharsave_control,save_freq_select;+unsignedintyrs;+#ifdef CONFIG_MACH_DECSTATION+unsignedintreal_yrs,leap_yr;+#endif+unsignedcharcentury=0;++yrs=time->tm_year;+mon=time->tm_mon+1;/* tm_mon starts at zero */+day=time->tm_mday;+hrs=time->tm_hour;+min=time->tm_min;+sec=time->tm_sec;++if(yrs>255)/* They are unsigned */+return-EINVAL;++spin_lock_irqsave(&rtc_lock,flags);+#ifdef CONFIG_MACH_DECSTATION+real_yrs=yrs;+leap_yr=((!((yrs+1900)%4)&&((yrs+1900)%100))||+!((yrs+1900)%400));+yrs=72;++/*+*Wewanttokeeptheyearsetto73untilMarch+*fornon-leapyears,sothatFeb,29thishandled+*correctly.+*/+if(!leap_yr&&mon<3){+real_yrs--;+yrs=73;+}+#endif++#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century){+century=(yrs+1900)/100;+yrs%=100;+}+#endif++/* These limits and adjustments are independent of+*whetherthechipisinbinarymodeornot.+*/+if(yrs>169){+spin_unlock_irqrestore(&rtc_lock,flags);+return-EINVAL;+}++if(yrs>=100)+yrs-=100;++if(!(CMOS_READ(RTC_CONTROL)&RTC_DM_BINARY)+||RTC_ALWAYS_BCD){+sec=bin2bcd(sec);+min=bin2bcd(min);+hrs=bin2bcd(hrs);+day=bin2bcd(day);+mon=bin2bcd(mon);+yrs=bin2bcd(yrs);+century=bin2bcd(century);+}++save_control=CMOS_READ(RTC_CONTROL);+CMOS_WRITE((save_control|RTC_SET),RTC_CONTROL);+save_freq_select=CMOS_READ(RTC_FREQ_SELECT);+CMOS_WRITE((save_freq_select|RTC_DIV_RESET2),RTC_FREQ_SELECT);++#ifdef CONFIG_MACH_DECSTATION+CMOS_WRITE(real_yrs,RTC_DEC_YEAR);+#endif+CMOS_WRITE(yrs,RTC_YEAR);+CMOS_WRITE(mon,RTC_MONTH);+CMOS_WRITE(day,RTC_DAY_OF_MONTH);+CMOS_WRITE(hrs,RTC_HOURS);+CMOS_WRITE(min,RTC_MINUTES);+CMOS_WRITE(sec,RTC_SECONDS);+#ifdef CONFIG_ACPI+if(acpi_gbl_FADT.header.revision>=FADT2_REVISION_ID&&+acpi_gbl_FADT.century)+CMOS_WRITE(century,acpi_gbl_FADT.century);+#endif++CMOS_WRITE(save_control,RTC_CONTROL);+CMOS_WRITE(save_freq_select,RTC_FREQ_SELECT);++spin_unlock_irqrestore(&rtc_lock,flags);++return0;+}+#endif /* _MC146818RTC_H */
On 26/04/2016 at 23:44:04 +0200, Arnd Bergmann wrote :
I've had these patches in my tree for a while, after the first one
had a few issues that are fixed in this new version. The old-style
PC RTC driver is now also disabled on m68k (as pointed out by
Geert), ppc (it was also blacklisted), and m32r (I showed that
it did not build).
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
Personally, I'd go for the kill and remove genrtc instead of cleaning it
up.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
From: Thomas Gleixner <hidden> Date: 2016-04-27 10:07:38
On Tue, 26 Apr 2016, Arnd Bergmann wrote:
Commit 3195ef59cb42 ("x86: Do full rtc synchronization with ntp") had
the side-effect of unconditionally enabling the RTC_LIB symbol on x86,
which in turn disables the selection of the CONFIG_RTC and
CONFIG_GEN_RTC drivers that contain a two older implementations of
the CONFIG_RTC_DRV_CMOS driver.
This removes x86 from the list.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
On Wednesday 27 April 2016 11:44:10 Alexandre Belloni wrote:
On 26/04/2016 at 23:44:04 +0200, Arnd Bergmann wrote :
quoted
I've had these patches in my tree for a while, after the first one
had a few issues that are fixed in this new version. The old-style
PC RTC driver is now also disabled on m68k (as pointed out by
Geert), ppc (it was also blacklisted), and m32r (I showed that
it did not build).
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
Personally, I'd go for the kill and remove genrtc instead of cleaning it up.
Right, so we could skip patches 5 and 6, and instead remove the two
headers as we remove the driver. Let's see what the architecture
maintainers think about it, at least powerpc actually enables gen_rtc
in its defconfig, so it might take a while to move it over.
Arnd
Hi Arnd,
On Wed, Apr 27, 2016 at 12:07 PM, Arnd Bergmann [off-list ref] wrote:
On Wednesday 27 April 2016 11:44:10 Alexandre Belloni wrote:
quoted
On 26/04/2016 at 23:44:04 +0200, Arnd Bergmann wrote :
quoted
I've had these patches in my tree for a while, after the first one
had a few issues that are fixed in this new version. The old-style
PC RTC driver is now also disabled on m68k (as pointed out by
Geert), ppc (it was also blacklisted), and m32r (I showed that
it did not build).
For the genrtc driver, rearranging the headers makes it simpler
to use and reduces duplication. In case of alpha and mn10300,
I've shown that the genrtc and rtc drivers are doing the same
thing, so we don't need them both. The remaining three
architectures (m68k, parisc, powerpc) actually all support
the newer rtc-generic driver, so we could remove genrtc completely
if we want to.
Personally, I'd go for the kill and remove genrtc instead of cleaning it up.
Right, so we could skip patches 5 and 6, and instead remove the two
headers as we remove the driver. Let's see what the architecture
maintainers think about it, at least powerpc actually enables gen_rtc
in its defconfig, so it might take a while to move it over.
FWIW, all PPC defconfigs (except tqm8xx.dts, which is a more recent platform)
enabling it did that long before my old commit to enable rtc-generic support
on PPC:
commit bcd68a70cb0eee556d86d93133aa150319bd9f53
Author: Geert Uytterhoeven [off-list ref]
Date: Thu Feb 19 16:50:46 2009 +0100
powerpc: Hook up rtc-generic, and kill rtc-ppc
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On Wednesday 27 April 2016 00:07:47 Rolf Eike Beer wrote:
Arnd Bergmann wrote:
quoted
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
On Wednesday 27 April 2016 12:19:59 Geert Uytterhoeven wrote:
quoted
Right, so we could skip patches 5 and 6, and instead remove the two
headers as we remove the driver. Let's see what the architecture
maintainers think about it, at least powerpc actually enables gen_rtc
in its defconfig, so it might take a while to move it over.
FWIW, all PPC defconfigs (except tqm8xx.dts, which is a more recent platform)
enabling it did that long before my old commit to enable rtc-generic support
on PPC:
commit bcd68a70cb0eee556d86d93133aa150319bd9f53
Author: Geert Uytterhoeven [off-list ref]
Date: Thu Feb 19 16:50:46 2009 +0100
powerpc: Hook up rtc-generic, and kill rtc-ppc
Ah, interesting. I have two observations about that patch:
- you were moving basically in the opposite direction that I am
trying to bring it now. ;-)
- I see now that four defconfigs (gamecube, powernv, pseries and wii)
do enable RTC_DRV_GENERIC. For some reason, ppc64_defconfig only
enables RTC_DRV_DS1307, I assume that is not intentional.
Arnd
On Wednesday 27 April 2016 13:21:16 Arnd Bergmann wrote:
On Wednesday 27 April 2016 00:07:47 Rolf Eike Beer wrote:
quoted
Arnd Bergmann wrote:
quoted
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
parisc in this case.
Fixed, thanks!
Actually, after the comment about just removing the gen_rtc driver
in the long run, I checked again and found that PARISC unconditionally
selects RTC_CLASS, so this driver can't even be built here.
We should just remove the header and drop PARISC from the list.
If we also drop m68k, that just leaves powerpc.
Arnd
On Wed, Apr 27, 2016 at 1:35 PM, Arnd Bergmann [off-list ref] wrote:
On Wednesday 27 April 2016 13:21:16 Arnd Bergmann wrote:
quoted
On Wednesday 27 April 2016 00:07:47 Rolf Eike Beer wrote:
quoted
Arnd Bergmann wrote:
quoted
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
parisc in this case.
Fixed, thanks!
Actually, after the comment about just removing the gen_rtc driver
in the long run, I checked again and found that PARISC unconditionally
selects RTC_CLASS, so this driver can't even be built here.
We should just remove the header and drop PARISC from the list.
If we also drop m68k, that just leaves powerpc.
I've just checked Debian's unofficial linux-image-4.5.0-1-m68k_4.5.1-1_m68k,
and it also enables RTC_CLASS and CONFIG_RTC_DRV_GENERIC, so gen_rtc
can be dropped on m68k for sure.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On Wednesday 27 April 2016 13:55:43 Geert Uytterhoeven wrote:
On Wed, Apr 27, 2016 at 1:35 PM, Arnd Bergmann [off-list ref] wrote:
quoted
On Wednesday 27 April 2016 13:21:16 Arnd Bergmann wrote:
quoted
On Wednesday 27 April 2016 00:07:47 Rolf Eike Beer wrote:
quoted
Arnd Bergmann wrote:
quoted
The asm-generic/rtc.h header can now be included by
architectures that provide their own set_rtc_time/get_rtc_time
macros, letting us remove most of the common contents in
the powerpc implementation.
parisc in this case.
Fixed, thanks!
Actually, after the comment about just removing the gen_rtc driver
in the long run, I checked again and found that PARISC unconditionally
selects RTC_CLASS, so this driver can't even be built here.
We should just remove the header and drop PARISC from the list.
If we also drop m68k, that just leaves powerpc.
I've just checked Debian's unofficial linux-image-4.5.0-1-m68k_4.5.1-1_m68k,
and it also enables RTC_CLASS and CONFIG_RTC_DRV_GENERIC, so gen_rtc
can be dropped on m68k for sure.
Ok, excellent. I'll try to rework the series then to completely eliminate
the driver (or leaving it ppc-only).
Arnd