[U-Boot-Users] i.MX31: question about CFG_HZ and CKIL

Hi all,
in the i.MX31 processor reference manual they mention a 32 kHz clock as input for several timers and controllers. Sometimes it's called ipg_clk_32k. But the documentation does not clearly state, that this clock actually is the CKIL.
As far as I could derive from the ADS schematics the CKIL is feeded with 32768 Hz instead of 32000 Hz. On our board we use 32768 Hz either.
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as CFG_HZ in mx31ads.h is 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Thank you for comments.
Best Regards, Jens

On Wed, 7 May 2008, Jens Gehrlein wrote:
in the i.MX31 processor reference manual they mention a 32 kHz clock as input for several timers and controllers. Sometimes it's called ipg_clk_32k. But the documentation does not clearly state, that this clock actually is the CKIL.
As far as I could derive from the ADS schematics the CKIL is feeded with 32768 Hz instead of 32000 Hz. On our board we use 32768 Hz either.
MCIMX31RM Rev 2.3, section 3.4.4.1.1:
<quote> The i.MX31 and i.MX31L processors can use either a 32 kHz, 32.768 kHz or a 38.4 kHz crystal as the external low frequency source. Throughout this chapter, the low frequency crystal is referred to as the 32 kHz crystal, even though this can refer to the 32.768 or 38.4 kHz values. </quote>
So, so far it is allowed to use a 32768 crystal.
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as CFG_HZ in mx31ads.h is 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Further, it depends on the CLKSS signal, which on i.MX31ADS is connected to JP22, whether CKIL is used as the reference clock. Unless you override this choise later in software.
In any case, I think, you are right. I'll submit a patch for mx31ads shortly, then you'll see what you could change for your platform too.
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer

In message 48216F73.4010809@tqs.de you wrote:
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as CFG_HZ in mx31ads.h is 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Note that CFG_HZ is not really configurable, even if the name suggests so. In reality, CFG_HZ is a constant with the value 1000.
There are some broken boards which don't handle this correctly, but at least that's what you should set.
Best regards,
Wolfgang Denk

Hi Wolfgang, Guennadi,
Wolfgang Denk schrieb:
In message 48216F73.4010809@tqs.de you wrote:
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as CFG_HZ in mx31ads.h is 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Note that CFG_HZ is not really configurable, even if the name suggests so. In reality, CFG_HZ is a constant with the value 1000.
There are some broken boards which don't handle this correctly, but at least that's what you should set.
So, as far as I understood the function get_timer() must also return a value that is counted up 1000 times per second. But according to cpu/arm1136/mx31/interrupt.c this is not the case. GPTCNT is updated with 32000 or 32768 Hz, and this counter register's value is currently returned by get_timer() (minus base, passed by the caller).
If CFG_HZ should be set to 1000 than cpu/arm1136/mx31/interrupt.c should be fixed, i.e. the prescaler had to be adjusted from 1 to approx. 33. Do you agree or did I understand this timer stuff completely wrong?
Best regards, Jens

In message 482A8875.1090802@tqs.de you wrote:
If CFG_HZ should be set to 1000 than cpu/arm1136/mx31/interrupt.c should be fixed, i.e. the prescaler had to be adjusted from 1 to approx. 33. Do you agree or did I understand this timer stuff completely wrong?
Yes.
It makes little sense to have 32 kHz interrupts on a system that uses polling drivers only.
Best regards,
Wolfgang Denk
participants (3)
-
Guennadi Liakhovetski
-
Jens Gehrlein
-
Wolfgang Denk