public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* ARM Architecture and GENERIC_CMOS_UPDATE
@ 2011-01-29  0:35 Grant Erickson
  2011-02-01 22:32 ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Erickson @ 2011-01-29  0:35 UTC (permalink / raw)
  To: linux-omap

Is there any reason, to date, that the ARM architecture has not had the following kernel configuration option?

	config GENERIC_CMOS_UPDATE
	    def_bool y

Regards,

Grant


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ARM Architecture and GENERIC_CMOS_UPDATE
  2011-01-29  0:35 ARM Architecture and GENERIC_CMOS_UPDATE Grant Erickson
@ 2011-02-01 22:32 ` Tony Lindgren
  2011-02-02 16:57   ` Grant Erickson
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2011-02-01 22:32 UTC (permalink / raw)
  To: Grant Erickson; +Cc: linux-omap

* Grant Erickson <marathon96@gmail.com> [110128 16:34]:
> Is there any reason, to date, that the ARM architecture has not had the following kernel configuration option?
> 
> 	config GENERIC_CMOS_UPDATE
> 	    def_bool y

Looks like it would just require implementing update_persitent_clock.
No idea why it's not done for ARM , maybe send some patches for that?

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ARM Architecture and GENERIC_CMOS_UPDATE
  2011-02-01 22:32 ` Tony Lindgren
@ 2011-02-02 16:57   ` Grant Erickson
  2011-02-09 18:27     ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Erickson @ 2011-02-02 16:57 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap

On 2/1/11 2:32 PM, Tony Lindgren wrote:
> * Grant Erickson <marathon96@gmail.com> [110128 16:34]:
>> Is there any reason, to date, that the ARM architecture has not had the
>> following kernel configuration option?
>> 
>> config GENERIC_CMOS_UPDATE
>>    def_bool y
> 
> Looks like it would just require implementing update_persitent_clock.
> No idea why it's not done for ARM , maybe send some patches for that?

Tony:

Thanks for the confirmation. For the time being, for my 2.6.32 kernel, I
added the following to my board-specific file:

#if defined(CONFIG_GENERIC_CMOS_UPDATE) && defined(CONFIG_RTC_LIB)
/**
 * update_persistent_clock - set the hardware clock time to system time
 * @now: the current system wall clock time.
 *
 * This routine attempts to access the primary hardware real-time
 * clock and, if successful, sets it to the current system wall clock
 * time.
 *
 * This generation (2.6.32) of ARM kernel has an alternative function
 * do_set_rtc in linux/arch/arm/kernel/time.c that does something
 * similar; however, in a more awkward and non-standard way. So much
 * so, that in 2.6.36 kernels, it's gone away entirely.
 *
 * This more or less matches what is in linux/arch/sparc/kernel/time_64.c
 *
 * Returns 0 if the real-time clock was successfully set to the system
 * wall clock time; otherwise, < 0 on error.
 */
int update_persistent_clock(struct timespec now)
{
    const char * name = "rtc0";
    struct rtc_device *rtc;
    int err = -ENODEV;

    rtc = rtc_class_open(name);

    if (rtc) {
        err = rtc_set_mmss(rtc, now.tv_sec);
        rtc_class_close(rtc);
    }

    return err;
}
#endif /* defined(CONFIG_GENERIC_CMOS_UPDATE) && defined(CONFIG_RTC_LIB) */

and changed arch/arm/kernel/time.c as follows:

--- a/linux/arch/arm/kernel/time.c
+++ b/linux/arch/arm/kernel/time.c
@@ -89,6 +89,9 @@ static unsigned long dummy_gettimeoffset(void)
 }
 #endif
 
+#if defined(CONFIG_GENERIC_CMOS_UPDATE)
+static inline void do_set_rtc(void) { return; }
+#else /* !defined(CONFIG_GENERIC_CMOS_UPDATE) */
 static unsigned long next_rtc_update;
 
 /*
@@ -118,6 +121,7 @@ static inline void do_set_rtc(void)
    else
        next_rtc_update = xtime.tv_sec + 660;
 }
+#endif /* defined(CONFIG_GENERIC_CMOS_UPDATE) */
 
 #ifdef CONFIG_LEDS
 
The long-term solution probably involves adding a function pointer member
field for each machine description with a generic, default function that
does something akin to the above board-specific approach.

Comments welcomed.

-Grant



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ARM Architecture and GENERIC_CMOS_UPDATE
  2011-02-02 16:57   ` Grant Erickson
@ 2011-02-09 18:27     ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2011-02-09 18:27 UTC (permalink / raw)
  To: Grant Erickson; +Cc: linux-omap

* Grant Erickson <marathon96@gmail.com> [110202 08:56]:
> On 2/1/11 2:32 PM, Tony Lindgren wrote:
> > * Grant Erickson <marathon96@gmail.com> [110128 16:34]:
>  
> The long-term solution probably involves adding a function pointer member
> field for each machine description with a generic, default function that
> does something akin to the above board-specific approach.
> 
> Comments welcomed.

Maybe ask about that on LKML and LAKML? There may be some rtc related
changes queued up too..

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-09 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-29  0:35 ARM Architecture and GENERIC_CMOS_UPDATE Grant Erickson
2011-02-01 22:32 ` Tony Lindgren
2011-02-02 16:57   ` Grant Erickson
2011-02-09 18:27     ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox