Subject: [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER

From: [email-masked] (Jon Hunter)
Date: Thu, 8 Nov 2012 12:47:18 -0600

On 11/08/2012 12:28 PM, Hiremath, Vaibhav wrote:
> On Thu, Nov 08, 2012 at 23:43:31, Hunter, Jon wrote:
>>
>> On 11/08/2012 12:06 PM, Hiremath, Vaibhav wrote:
>>> On Thu, Nov 08, 2012 at 23:28:53, Hunter, Jon wrote:
>>>>
>>>> On 11/08/2012 11:47 AM, Hiremath, Vaibhav wrote:
>>>>> On Thu, Nov 08, 2012 at 23:09:57, Hunter, Jon wrote:
>>>>
>>>> [snip]
>>>>
>>>>>> I think you are missing the point here. For OMAP devices we have two
>>>>>> main external clock sources which are the 32kHz clock and the sys_clk
>>>>>> (can be a range of frequencies from 12-38.4MHz for OMAP4). The point is
>>>>>> for OMAP these clock sources are always present and AFAIK there is no
>>>>>> h/w configuration that allows you not to have the 32kHz clock source.
>>>>>> PRCM needs it and I think for OMAP1 the reset logic needs it (if memory
>>>>>> serves).
>>>>>>
>>>>>> Igor was mentioning a h/w scenario where the 32kHz source is not
>>>>>> present. However, I am not sure which devices support this and is
>>>>>> applicable too.
>>>>>>
>>>>>> So we are not discussing the 32k-sync-timer here. We are discussing
>>>>>> whether there are any device configurations where a 32k clock source
>>>>>> would not be available for the gptimer.
>>>>>>
>>>>>
>>>>> Exactly that is the point I am trying to make here,
>>>>>
>>>>> In case of AM33xx, it is certainly possible to build the system without 
>>>>> this 32Khz clock. 
>>>>>
>>>>> Interesting point here is, this 32KHz clock is external clock coming from 
>>>>> crystal connected to in-built RTC module.
>>>>
>>>> Thanks. Looking at the AM3358 data manual it states ...
>>>>
>>>> "The OSC1 oscillator provides a 32.768-kHz reference clock to the
>>>> real-time clock (RTC) and is connected to the RTC_XTALIN and RTC_XTALOUT
>>>> terminals. OSC1 is disabled by default after power is applied. This
>>>> clock input is optional and may not be required if the RTC is configured
>>>> to receive a clock from the internal 32k RC oscillator (CLK_RC32K) or
>>>> peripheral PLL (CLK_32KHZ) which receives a reference clock from the
>>>> OSC0 input."
>>>>
>>>> So what is clear to me that an external 32k clock source is optional.
>>>> However, it still appears that you will always have an internal 32k
>>>> source and so regardless of the h/w configuration, a gptimer will always
>>>> have an 32k clock available on the AM335x devices. Is that correct?
>>>>
>>>
>>> Internal RC oscillator is not accurate at all, so not guaranteed to give 
>>> accurate 32.768Hz clock. The oscillation band is from 16Khz to 64Khz.
>>>
>>> So it may not be useful as a system clocks, right?
>>
>> So I admit I am not familiar with the details on the AMxxxx stuff side
>> so much.
>>
>> So maybe I should ask this question ...
>>
>> Do you support a configuration where there is no external 32k clock AND
>> the internal oscillator and hence, RTC are not used?
>>
> 
> Why not, you could give-up on persistent time across suspend/resume and use 
> OSC clock as a input clock to timer.
> 
> And the timer code, which we have we have added fallback mechanism for this,
> First make sure that timer is properly set for RTC32K, if yes, then use it, 
> and if no, then fall back to OSC clock.

You mean sync-32k and not rtc32k right? We are just detecting the
presence of the sync-32k counter and if so use it, otherwise use a gptimer.

>> I would have expected that you would always want the RTC running, but if
>> you are saying that you don't require an external 32k and the internal
>> 32k is not accurate, then I assume that having the RTC available is not
>> mandatory either.
>>
> 
> Yes, it is not mandatory, considering fact that, you will not have 
> persistent time and other low-power modes. 
> Actually it depends on board/EVM use-case, right? 

Yes absolutely, just trying to understand if that is a valid use-case or
not. So for AM33xx the external 32k is not mandatory. Thanks.

Jon