860 rtc problem
Alex Zeffertt
ajz at cambridgebroadband.com
Fri Oct 18 02:02:23 EST 2002
On Thu, 17 Oct 2002, leeyang wrote:
Hi,
I've written a rtc driver for the mpc860. See attached files.
HOWTO BUILD
1. Edit KERNEL_DIR in Makefile
2. make (builds rtc.o and rtc)
HOWTO USE
root at 860# insmod rtc.o
root at 860# mknod /dev/rtc c 10 135
root at 860# rtc # (help text)
root at 860# rtc r # (read RTC)
root at 860# rtc w [opts] # (write to RTC)
NOTES
1. date and "date -s" only set a software clock ("xtime")
2. the software clock is initialised from a h/w RTC at boot
3. to make a date change persistent across reboots make sure you set
the RTC using rtc.
4. "rtc w" without further opts will set the RTC to equal the
software clock ("xtime")
5. Make sure your 860 has a 32k RTC xtal oscilator, and Keep Alive
PoWeR seperate from the main supply and XIN.
Alex
>
> Hi, all!
> HW:860T custom board
> SW:devel kernel 2.4.20-pre7 nfs mount on eldk
>
> Problem:Can not adjust time in linux shell(with 'date -s' command)
>
> RTC really runs when I use 'date' it says sometime around 1970's
> and it runs when power up.
> With 'date -s' command it returned time had been changed.
> However after a reset,the time go back to 1970's again :-(
>
> I try with 'hwclock' and it says below:
>
> bash-2.04# hwclock --debug
> hwclock 2.4c/util-linux-2.11f
> Using /dev/rtc interface to clock.
> Last drift adjustment done at 0 seconds after 1969
> Last calibration done at 0 seconds after 1969
> Hardware clock is on unknown time
> Assuming hardware clock is kept in local time.
> Waiting for clock tick...
> /dev/rtc does not have interrupt functions. Waiting in loop for time from
> /dev/rtc to change
> ...got clock tick
> Time read from Hardware Clock: 1970/01/09 21:28:28
> Hw clock time : 1970/01/09 21:28:28 = 786508 seconds since 1969
> Fri Jan 9 21:28:28 1970 -0.188839 seconds
>
>
> I guess it never really write value to RTC reg!!!
> Hope help!
>
> ps:I open /dev/rtc option in the kernel.
>
> Regards!
>
>
>
-------------- next part --------------
##########################################################################
#
# Copyright (C) 2001 Cambridge Broadband Ltd,
# Edinburgh House, Cowley Road
# Cambridge, England
# CB4 0DS
#
# ++44 1223 713000
#
# enquiries at cambridgebroadband.com
#
# http://www.cambridgebroadband.com
#
##########################################################################
CC = ppc_8xx-gcc
KERNELDIR = ../../kernel
DEBUG = -g
NODEBUG =
KERN_CFLAGS = -DMODULE -D__KERNEL__ -I$(KERNELDIR)/include -O2 -Wall $(NODEBUG)
USER_CFLAGS = -DUSERLAND_TESTCODE -I$(KERNELDIR)/include -O2 -Wall $(NODEBUG)
TARGETS = rtc.o rtc
all: $(TARGETS)
rtc.o: rtc.c
$(CC) $(KERN_CFLAGS) -c rtc.c
rtc: rtc.c
$(CC) $(USER_CFLAGS) -o $@ rtc.c
clean:
rm -f $(TARGETS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtc
Type: application/octet-stream
Size: 7952 bytes
Desc: rtc.c
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20021017/98badcef/attachment.obj
More information about the Linuxppc-embedded
mailing list