hwclock not working

BaHko
Hello guys,

I have a problem with hwclock on mini2440 with Pengutronix

Hwclock is stuck on "Mon Nov 19 11:21:52 2012  0.000000 seconds"
And I can't sync it no matter what I try.

Till now I have tried:

after syncing the system clock

1. hwclock --systohc

2. reflashing barebox/bareboxenv/kernel/rootfs

still no luck

Any suggestions and ideas are welcome.

Regards

Juergen Beisert
Does "dmesg" show some kernel messages when you try to set the RTC?

$ data "some date"
$ hwclock -w
$ dmesg
$ hwclock

Does the second hwclock show the same time as the first one?

BaHko
Nope. Nothing that I can see

All the lines connected to RTC are:


Line 139: s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
Line 139: s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
Line 139: s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
Line 140: s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
Line 140: s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
Line 140: s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
Line 140: s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
Line 160: s3c-rtc s3c2410-rtc: setting system clock to 2012-11-19 11:21:52
UTC (1353324112)
Line 160: s3c-rtc s3c2410-rtc: setting system clock to 2012-11-19 11:21:52
UTC (1353324112)


And here is the info from dmesg:

Booting Linux on physical CPU 0
Initializing cgroup subsys cpu
Linux version 3.4.4-ptx-2012.06.0 (admin1@ubuntu) (gcc version 4.6.2
(OSELAS.Toolchain-2011.1.3) ) #1 PREEMPT Sat Oct 13 00:06:10 EEST 2012
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
On node 0 totalpages: 16384
free_area_init_node: node 0, pgdat c035ef10, node_mem_map c037e000
  Normal zone: 128 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 16256 pages, LIFO batch:3
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttySAC0,115200 mini2440=6tbc ip=none
root=/dev/mtdblock3 rootfsype=jffs2 noinitrd
mtdparts=nand:512k(barebox),384k(bareboxenv),2048k(kernel),-(root)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61356k/61356k available, 4180k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc031c544   (3154 kB)
      .init : 0xc031d000 - 0xc0338000   ( 108 kB)
      .data : 0xc0338000 - 0xc035f600   ( 158 kB)
       .bss : 0xc035f624 - 0xc037d308   ( 120 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000002
timer tcon=00500000, tcnt a4ca, tcfg 00ff02ff,00000000, usec 00001e57
sched_clock: 32 bits at 200 Hz, resolution 5000000ns, wraps every
4294967291ms
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x30295258 - 0x30295294
devtmpfs: initialized
gpiochip_add: registered GPIOs 0 to 23 on device: GPIOA
gpiochip_add: registered GPIOs 32 to 47 on device: GPIOB
gpiochip_add: registered GPIOs 64 to 79 on device: GPIOC
gpiochip_add: registered GPIOs 96 to 111 on device: GPIOD
gpiochip_add: registered GPIOs 128 to 143 on device: GPIOE
gpiochip_add: registered GPIOs 160 to 167 on device: GPIOF
gpiochip_add: registered GPIOs 192 to 207 on device: GPIOG
gpiochip_add: registered GPIOs 224 to 234 on device: GPIOH
gpiochip_add: registered GPIOs 256 to 271 on device: GPIOJ
NET: Registered protocol family 16
MINI2440: Option string mini2440=6tbc
MINI2440: LCD
 0:240x320
 1:800x480
 2:1024x768
 3:240x320
 4:640x480
 5:240x320
 [6:320x240]
 7:480x272

S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
S3C24XX DMA Driver, Copyright 2003-2006 Simtec Electronics
DMA channel 0 at c4804000, irq 33
DMA channel 1 at c4804040, irq 34
DMA channel 2 at c4804080, irq 35
DMA channel 3 at c48040c0, irq 36
s3c24xx-pwm s3c24xx-pwm.0: tin at 98876, tdiv at 98876, tin=divclk, base 0
S3C24XX CPU Frequency driver, s3c244x cpu support
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
Advanced Linux Sound Architecture Driver Version 1.0.25.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
s3c-adc s3c24xx-adc: attached adc driver
jffs2: version 2.2. (NAND) &#1073;&#9560; 2001-2006 Red Hat, Inc.
msgmni has been set to 119
io scheduler noop registered
io scheduler cfq registered (default)
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
console [ttySAC0] enabled
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
at24 0-0050: 1024 byte 24c08 EEPROM, writable, 16 bytes/write
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND hardware ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V
8-bit)
Bad block table found at page 524224, version 0x01
Bad block table found at page 524160, version 0x01
4 cmdlinepart partitions found on MTD device nand
Creating 4 MTD partitions on "nand":
0x000000000000-0x000000080000 : "barebox"
0x000000080000-0x0000000e0000 : "bareboxenv"
0x0000000e0000-0x0000002e0000 : "kernel"
0x0000002e0000-0x000040000000 : "root"
s3c24xx-nand s3c2440-nand: clock idle support enabled
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c487a300,c487c304 IRQ 51 MAC: 52:1a:98:42:1c:92 (chip)
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
samsung-ts s3c2440-ts: driver attached, registering input device
input: S3C24XX TouchScreen as /devices/virtual/input/input0
input: pwm-beeper as
/devices/platform/s3c24xx-pwm.0/pwm-beeper/input/input1
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
s3c2410_wdt: S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq disabled
cpuidle: using governor ladder
s3c-sdi s3c2440-sdi: powered down.
s3c-sdi s3c2440-sdi: mmc0 - using pio, hw SDIO IRQ
Registered led device: led1
Registered led device: led2
Registered led device: led3
Registered led device: led4
Registered led device: backlight
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
S3C24XX_UDA134X SoC Audio driver
soc-audio soc-audio: ASoC machine S3C24XX_UDA134X should use
snd_soc_register_card()
UDA134X SoC Audio Codec
asoc: uda134x-hifi <-> s3c24xx-iis mapping ok
TCP: cubic registered
NET: Registered protocol family 17
input: gpio-keys as /devices/platform/gpio-keys/input/input2
s3c-rtc s3c2410-rtc: setting system clock to 2012-11-19 11:21:52 UTC
(1353324112)
ALSA device list:
  #0: S3C24XX_UDA134X
usb 1-1: new full-speed USB device number 2 using s3c2410-ohci
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
s3c-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
mmc0: new SD card at address bf40
mmcblk0: mmc0:bf40 SU02G 1.84 GiB
 mmcblk0: p1
jffs2: Empty flash at 0x023bb638 ends at 0x023bb800
jffs2: Empty flash at 0x0361d1bc ends at 0x0361d800
VFS: Mounted root (jffs2 filesystem) on device 31:3.
devtmpfs: mounted
Freeing init memory: 108K
>udevd[363]: starting version 182
dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0x45E1



As I mentioned before I'm not able to change the hwclock. (-uw -w
--systohc) they don't work.
-s (--hctosys) is working

BaHko
Hm... I tried to unplug the power and to remove the battery just to see if
it will reset and now I'm getting 


s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
s3c-rtc s3c2410-rtc: warning: invalid RTC value so initializing it
s3c-rtc s3c2410-rtc: hctosys: unable to read the hardware clock

and /dev/rtc is gone.

Could it be bad battery? I'm asking because it was working with no problem
for a month until it got stuck on "19 Nov 2012" and now after removing the
battery it won't load the rtc???

Just right now I will try to revert to some of the previous builds

BaHko
Well I tried a lot of thing and nothing worked I have found this article
and tomorrow I will change the battery and I will hope that everything will
be ok. :)

to the article:
http://www.friendlyarm.net/forum/topic/4415

BaHko
Well it is official. :)

Dead battery is the reason hwclock to freeze at the last login date.

The symptoms are hwclock can set system clock but can't be set from the
system.

After removing the battery once it is dead the kernel start will not
recognize rtc any more.

Solution:

CHANGE THE GOD DAMN FRACKING BATTERY. :)

The type of the battery is CR1220

The cost: around $1-$1.5

In the end... HAPPY END

davef
I guess when at least three people find that replacing the battery fixed
this problem . . . that the fix becomes "more official"!

BaHko
Aaaa... Dave. :)

I was talking about my case and only about my case. :)

I had my suspicions that it may be dead battery but I refuse to believe it.
:)

TheRegnirps
Lately ARMWorks is shipping 2440's with no battery installed (and a new
battery in the package). But, and there is always a 'but' it seems - the
battery holder is a little delicate, so use care.

xakoi
I found a problem with rtc
i changed date 
then i adjust sys date to hwclock
hwclock also changed but its stop on new date.
my battery is good, but i change it new one.
i try adjust time lines above.
nothing i got, hwclock stills stop,
i have never seen this error on mini2440,

Thanks