RTC DS1340 on MPC 8245 - problem
Aniket D.
aniket_spce at yahoo.com
Tue Nov 14 10:33:40 EST 2006
Problem:
When processor dependent macros are
set to use RTC ie (ppc_md.set_rtc_time = mydriver_set_rtc; ppc_md.get_rtc_time =
mydriver_get_rtc_time;), then the scheduler gets messed up and prints a message
“scheduling when atomic”.
System time is not synced to RTC
time.
Details:
Processor:
MPC8245
Kernel version: Linux
2.6.14
RTC chip: DS1340 (I2c
based)
Driver used: Standard kernel version
2.6.17 or later has a driver for RTC DS1340. I ported it to work with our
version of the kernel. So it is the driver provided by later version of the
standard kernel.
I have added the driver and the read
and write to the RTC works fine. Time that is set to the rtc remains on the RTC
even through successive reboots. So the driver is working
fine.
However we needed to sync the system
time with the RTC. For this purpose, I tried to use the drivers/rtc/hctosys.c
code. This code reads the time from the RTC during bootup, and does a
do_settimeofday so that system time reflects the time in the RTC. However, with
this change, as soon as settimeofday happens, I read it back, it displays the
correct time (same as RTC), but after system boots up, the system time is messed
up again.
Another thing that I changed was the
ppc_md.get_rtc_time and ppc_md.set_rtc_time – these function pointers were
pointed to my driver’s get_rtc_time and
set_rtc_time.
In the same function,
ppc_md.calibrate_decr is set to initialize the decrementer register. However the
ppc_md.time_init has still not been set. I looked up MPC8349 example and they
are enabling the ‘time base’ in this function. However for 8245 the time base
enable is not a bit in a register, but it is a signal. So does the
ppc_md.time_init need to be pointed to some function – what should that function
do? Is it needed at all?
Also, having set the
ppc_md.calibrate_decr, ppc_md.get_rtc_time and ppc_md.set_rtc_time, when the
system boots up, the scheduler prints a message that says “scheduling when
atomic” and the system doesn’t boot beyond this
point.
I have set these ppc_md function
pointers late during the bootup because it depends on initialization of the RTC
driver before these pointers are set.
Now as I understand, before the RTC
is available, the processor uses the decrementer register to keep time for the
scheduler. When the ppc_md.get/set_rtc_time are set, the processor starts using
the RTC to keep time. However the point where the handover from decrementer to
RTC happens is the point where the scheduler gets messed up.
Can you please guide me as to what
is the right way for me to use the RTC. Which are the places other than the
driver that I need to modify/add?
Thanks,
Aniket.
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20061113/3a141236/attachment.htm>
More information about the Linuxppc-dev
mailing list