From: Kumar Gala <galak@kernel.crashing.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] Add powerpc get/set_rtc_time interface to new generic rtc class
Date: Tue, 26 Sep 2006 09:14:15 -0500 [thread overview]
Message-ID: <2FE0EA9E-D0E8-4A6B-8184-454DAAE02FC5@kernel.crashing.org> (raw)
In-Reply-To: <1159240397.5462.11.camel@localhost.localdomain>
On Sep 25, 2006, at 10:13 PM, Benjamin Herrenschmidt wrote:
> On Mon, 2006-09-25 at 21:55 -0500, Kim Phillips wrote:
>> 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 <kim.phillips@freescale.com>
>
> 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
>> ---
>> arch/powerpc/kernel/time.c | 44 ++++++++++++++++++++++++++++++++
>> ++++++++++++
>> 1 files changed, 44 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
>> index 7a3c3f7..a231b6d 100644
>> --- a/arch/powerpc/kernel/time.c
>> +++ b/arch/powerpc/kernel/time.c
>> @@ -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
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
next prev parent reply other threads:[~2006-09-26 14:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-26 2:55 [PATCH] Add powerpc get/set_rtc_time interface to new generic rtc class Kim Phillips
2006-09-26 3:13 ` Benjamin Herrenschmidt
2006-09-26 14:14 ` Kumar Gala [this message]
2006-09-26 22:01 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2FE0EA9E-D0E8-4A6B-8184-454DAAE02FC5@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).