Add powerpc get/set_rtc_time interface to new generic rtc class
PATCH 1/1 Add powerpc get/set_rtc_time interface to new generic rtc class
Add powerpc get/set_rtc_time interface to new generic rtc class. This abstracts rtc chip specific code from the platform code for rtc-over-i2c platforms. Specific RTC chip support is now configured under Device Drivers -> Real Time Clock. Setting time of day from the RTC on startup is also configurable.
Currently, the only default config in powerpc arch is the 8349 itx. Other platforms wanting to consolidate code may also use this.
--- arch/powerpc/kernel/time.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
arch/powerpc/kernel/time.c +44 -0
@@ -1048,6 +1048,50 @@ void __init time_init(void)set_dec (tb_ticks_per_jiffy); } +#ifdef CONFIG_RTC_CLASS +int set_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return -ENODEV ; + + err =rtc_set_time (class_dev, tm); + +rtc_class_close (class_dev); + +return 0 ; +} + +void get_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return ; + + err =rtc_read_time (class_dev, tm); + +rtc_class_close (class_dev); + +return ; +} + +static int __init rtc_class_hookup (void ) +{ + ppc_md.get_rtc_time = get_rtc_class_time; + ppc_md.set_rtc_time = set_rtc_class_time; + +return 0 ; +} + +late_initcall (rtc_class_hookup); +#endif /* CONFIG_RTC_CLASS */ +#define FEBRUARY 2#define STARTOFTIME 1970
Signature · 1 line
1.4.2.1
Quoted 10 lines · Kim Phillips
Add powerpc get/set_rtc_time interface to new generic rtc class. This abstracts rtc chip specific code from the platform code for rtc-over-i2c platforms. Specific RTC chip support is now configured under Device Drivers -> Real Time Clock. Setting time of day from the RTC on startup is also configurable.
Currently, the only default config in powerpc arch is the 8349 itx. Other platforms wanting to consolidate code may also use this.
Signed-off-by Kim Phillips <[email protected]>
I think we should only get that in if we also adapt the various platform RTC code to be in drivers/rtc ... right now, enabling that option will just break everybody.
Quoted 59 lines
--- arch/powerpc/kernel/time.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)arch/powerpc/kernel/time.c +44
-0@@ -1048,6 +1048,50 @@ void __init time_init(void)set_dec (tb_ticks_per_jiffy); } +#ifdef CONFIG_RTC_CLASS +int set_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return -ENODEV ; + + err =rtc_set_time (class_dev, tm); + +rtc_class_close (class_dev); + +return 0 ; +} + +void get_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return ; + + err =rtc_read_time (class_dev, tm); + +rtc_class_close (class_dev); + +return ; +} + +static int __init rtc_class_hookup (void ) +{ + ppc_md.get_rtc_time = get_rtc_class_time; + ppc_md.set_rtc_time = set_rtc_class_time; + +return 0 ; +} + +late_initcall (rtc_class_hookup); +#endif /* CONFIG_RTC_CLASS */ +#define FEBRUARY 2#define STARTOFTIME 1970
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines · Kim Phillips
Add powerpc get/set_rtc_time interface to new generic rtc class. This abstracts rtc chip specific code from the platform code for rtc-over-i2c platforms. Specific RTC chip support is now configured under Device Drivers -> Real Time Clock. Setting time of day from the RTC on startup is also configurable.
Quoted 8 lines
Quoted 4 lines
Currently, the only default config in powerpc arch is the 8349 itx. Other platforms wanting to consolidate code may also use this.
Signed-off-by Kim Phillips <[email protected]>I think we should only get that in if we also adapt the various platform RTC code to be in
drivers/rtc... right now, enabling that option will just break everybody.
Maybe just drop the init call for now and let people migrate over to using this and moving the drivers over to drivers/rtc which aren't supported there.
- k
Quoted 65 lines
Quoted 50 lines
--- arch/powerpc/kernel/time.c | 44 ++++++++++++++++++++++++++++++++ ++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)arch/powerpc/kernel/time.c +37
-0@@ -1048,6 +1048,50 @@ void __init time_init(void)set_dec (tb_ticks_per_jiffy); } +#ifdef CONFIG_RTC_CLASS +int set_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return -ENODEV ; + + err =rtc_set_time (class_dev, tm); + +rtc_class_close (class_dev); + +return 0 ; +} + +void get_rtc_class_time (struct rtc_time *tm) +{ +int err; +struct class_device *class_dev = +rtc_class_open (CONFIG_RTC_HCTOSYS_DEVICE ); + +if (class_dev ==NULL ) +return ; + + err =rtc_read_time (class_dev, tm); + +rtc_class_close (class_dev); + +return ; +} + +static int __init rtc_class_hookup (void ) +{ + ppc_md.get_rtc_time = get_rtc_class_time; + ppc_md.set_rtc_time = set_rtc_class_time;arch/powerpc/kernel/time.c void __init time_init(void) · line 1097
Quoted 10 lines
arch/powerpc/kernel/time.c +7
-0+ + return 0; +} + +late_initcall (rtc_class_hookup); +#endif /* CONFIG_RTC_CLASS */ +#define FEBRUARY 2#define STARTOFTIME 1970_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev
Quoted 15 lines · Kumar Gala
Quoted 13 lines · Benjamin Herrenschmidt
Quoted 11 lines · Kim Phillips
Add powerpc get/set_rtc_time interface to new generic rtc class. This abstracts rtc chip specific code from the platform code for rtc- over-i2c
platforms. Specific RTC chip support is now configured under Device Drivers -> Real Time Clock. Setting time of day from the RTC on startup is also configurable.Currently, the only default config in powerpc arch is the 8349 itx. Other platforms wanting to consolidate code may also use this.
Signed-off-by Kim Phillips <[email protected]>
Quoted 8 lines
Quoted 4 lines
I think we should only get that in if we also adapt the various platform
RTC code to be indrivers/rtc... right now, enabling that option will just break everybody.Maybe just drop the init call for now and let people migrate over to using this and moving the drivers over to
drivers/rtcwhich aren't supported there.
Yup. We shouldn't change ppc_md from an initcall that way for something that may not be supported by a platform. The platform code shall set ppc_md. (maybe calling some init function for doing it) if the platform supports the new class mecanism.
Ben.