hardware clock not saved if board power is removed on babbage 2.5

Bug #427289 reported by Oliver Grawert
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-fsl-imx51 (Ubuntu)
Fix Released
High
Brad Figg
Karmic
Fix Released
High
Brad Figg

Bug Description

doing a plain reboot or shutdown, then powering up again, the babbage 2.5 properly keeps it's clock setting.
as soon as power is removed the clock is set to 01 01 1970 on next boot (which results in various problems i.e. filesystem check) ...
this is either a hardware issue with the battery not keeping the rtc up to date when power is removed or the clock setting is not saved in the right place by the rtc driver.

Tags: armel

CVE References

Oliver Grawert (ogra)
Changed in linux-fsl-imx51 (Ubuntu):
importance: Undecided → High
assignee: nobody → Amit Kucheria (amitk)
milestone: none → karmic-alpha-6
tags: added: armel
Revision history for this message
Paul Larson (pwlars) wrote :

Still easily reproducible in current daily builds

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: New → Triaged
Revision history for this message
Loïc Minier (lool) wrote :

Hi,

Freescale told the patch I'm attaching is probably needed to help things work.

They mentioned there are two RTCs on Babbage, the one they are using and recommend we use is the power management one.

They said they might be other issues with the RTC but this should solve the top issue.

The patch I'm attaching is from the sdk 1.6 pre release.

Bye

Revision history for this message
Loïc Minier (lool) wrote :

Oh and I verified that it applied to our imx51 branch.

Revision history for this message
David Mandala (davidm) wrote :

The patch will not show instant results, as it simply enables the button battery to be charged. The button battery holds the RTC running when power is removed so you need to allow the battery to charge for some time (likely 8-10 hours) before it will hold the clock alive.

There is also some chance that the battery is dead beyond charging so we may need to replace them. Might be worth testing by pull the button battery out record it's voltage, then replace it, give it time to charge, pull it out again and check it's voltage again and see if the battery has taken any charge, if not we could/should replace the battery and see if the charging circuit can maintain the battery over time.

Oliver Grawert (ogra)
Changed in linux-fsl-imx51 (Ubuntu Karmic):
milestone: karmic-alpha-6 → ubuntu-9.10-beta
Revision history for this message
Amit Kucheria (amitk) wrote :

Fix committed and about to be uploaded.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Triaged → Fix Committed
Revision history for this message
Oliver Grawert (ogra) wrote :

testing with 2.6.31-101-imx51 i now left the battery charge for two days but there doesnt seem to be a difference ...
reboot works and keeps the time just fine, shutting down, removing power and booting up again gets me the clock to 01.01.1970

Revision history for this message
Oliver Grawert (ogra) wrote :

oh, and i dont have a voltmeter handy but given the board and battery are pretty new i would expect the battery to not be broken ... i will try to find a voltmeter to actually measure the voltage

Loïc Minier (lool)
Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Fix Committed → Triaged
Revision history for this message
Oliver Grawert (ogra) wrote :

ok, finally fond my voltmeter:
if the board is powered off completely i see 1.104V measuring directly on the battery.
powering up the board this does not change at all. given that the regulator should initialize a charge, i would expect the voltage to change the moment the charger gets initialized but this does not happen.

it can very likely be that my battery is dead (which would be very sad given that it is not easily replaceable without soldering) but i would still expect seeing teh voltage raise as soon as the charger initializes.

Revision history for this message
Amit Kucheria (amitk) wrote :

For those who see this bug, could you please try to measure the the batter voltage. I suspect several of you have dead batteries that won't charge anymore.

My board managed to keep its date and time after being unplugged for over 3 days. (I was working on in on Friday and then put it on the place back home. Only started working on it today - Tuesday). It maintained the date/time info.

Revision history for this message
Amit Kucheria (amitk) wrote :

Marking invalid so that it annoys people with this bug into action :-p

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Triaged → Invalid
Revision history for this message
Paul Larson (pwlars) wrote :

Please use the incomplete state for that, as that's what it is for. Also, invalid causes it to fall off the radar unless you are actively looking for it or subscribed. I'll try to dig out a voltmeter today and take a look at this on my board also.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Invalid → Incomplete
Revision history for this message
Paul Larson (pwlars) wrote :

@amitk also, since yours is working, could you please verify the voltages that you see when it's on/charging, and also the voltage with the power completely disconnected?

Revision history for this message
Paul Larson (pwlars) wrote :

I'm seeing about 2-2.01V when powered on. I left it running for several hours this morning while I did an install, and about another hour or two after that. Time was correct and current when I powered down. I left it off for about 30 min and tested the battery again. I got pretty close to the same number, about 1.96V. When I powered it back on without the network attached, the time came up as Dec 31, 1969.

Revision history for this message
Loïc Minier (lool) wrote :

I installed a Babbage 2.0 with latest karmic image (beta image candidate) and left it running for the night; then I unplugged everything (including ethernet and DVI) for ~30 mn and the time was back to 1970 when I powered it again. (ntpdate didn't kick in due to NM not picking up the interface.)

Steve Langasek (vorlon)
Changed in linux-fsl-imx51 (Ubuntu Karmic):
milestone: ubuntu-9.10-beta → ubuntu-9.10
Revision history for this message
Amit Kucheria (amitk) wrote :

I might've made a mistake in the RTC configuration. Brad, could you try enabling CONFIG_RTC_MC13892=y ( from Jaunty) and disabling CONFIG_RTC_DRV_MXC_V2=y.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Incomplete → Triaged
Brad Figg (brad-figg)
Changed in linux-fsl-imx51 (Ubuntu Karmic):
assignee: Amit Kucheria (amitk) → Brad Figg (brad-figg)
status: Triaged → In Progress
Revision history for this message
Brad Figg (brad-figg) wrote :

In the current fsl-imx51 branch. The configuration already has CONFIG_RTC_MC13892=y. I disabled CONFIG_RTC_DRV_MXC_V2 and tested that change. The date is reset across simple reboots. I didn't bother testing pulling the power.

Revision history for this message
Oliver Grawert (ogra) wrote :

hmm, i see two different options in my current config (-101 though)

ogra@babbage2:~/devel/kernel/linux-fsl-imx51-2.6.31$ grep 13892 /boot/config-2.6.31-101-imx51 |grep RTC
CONFIG_MXC_MC13892_RTC=y
# CONFIG_RTC_MC13892 is not set

Revision history for this message
Brad Figg (brad-figg) wrote :

I applied the following patch, built and tested. This didn't help. In fact, the date/time is reset across simple reboots.

diff --git a/debian.fsl-imx51/config/config.common.ubuntu b/debian.fsl-imx51/config/config.common.ubuntu
index c7c95b0..7730975 100644
--- a/debian.fsl-imx51/config/config.common.ubuntu
+++ b/debian.fsl-imx51/config/config.common.ubuntu
@@ -1939,7 +1939,7 @@ CONFIG_RTC_DRV_M48T59=m
 CONFIG_RTC_DRV_M48T86=m
 CONFIG_RTC_DRV_MAX6900=m
 CONFIG_RTC_DRV_MAX6902=m
-CONFIG_RTC_DRV_MXC_V2=y
+# CONFIG_RTC_DRV_MXC_V2 is not set
 CONFIG_RTC_DRV_PCF50633=m
 CONFIG_RTC_DRV_PCF8563=m
 CONFIG_RTC_DRV_PCF8583=m
@@ -1962,7 +1962,7 @@ CONFIG_RTC_INTF_DEV_UIE_EMUL=y
 CONFIG_RTC_INTF_PROC=y
 CONFIG_RTC_INTF_SYSFS=y
 CONFIG_RTC_LIB=y
-# CONFIG_RTC_MC13892 is not set
+CONFIG_RTC_MC13892=y
 CONFIG_RTL8187=m
 CONFIG_RTL8187_LEDS=y
 CONFIG_RT_GROUP_SCHED=y
--
1.6.3.3

Revision history for this message
Brad Figg (brad-figg) wrote :

I applied the following patch as well and still no joy.

diff --git a/debian.fsl-imx51/config/config.common.ubuntu b/debian.fsl-imx51/config/config.common.ubuntu
index 7730975..6660034 100644
--- a/debian.fsl-imx51/config/config.common.ubuntu
+++ b/debian.fsl-imx51/config/config.common.ubuntu
@@ -1431,7 +1431,7 @@ CONFIG_MXC_MC13892_BATTERY=y
 CONFIG_MXC_MC13892_CONNECTIVITY=y
 CONFIG_MXC_MC13892_LIGHT=y
 CONFIG_MXC_MC13892_POWER=y
-CONFIG_MXC_MC13892_RTC=y
+# CONFIG_MXC_MC13892_RTC is not set
 # CONFIG_MXC_NAND_LOW_LEVEL_ERASE is not set
 CONFIG_MXC_PMIC=y
 CONFIG_MXC_PMIC_I2C=y

Revision history for this message
Zhang Lily (r58066) wrote :

Please note BBG2.0 coin-cell battery can not be chargable. If the voltage of coin-cell battery is lower than 1.8V, it can not maintain RTC any more. You can replace another coin-cell battery or use BBG2.5/BBG3.0 whose coin-cell battery can be chargable for tests.

Revision history for this message
Brad Figg (brad-figg) wrote :

I'm testing with a BBG2.5. Thanks for the heads up though.

Revision history for this message
Oliver Grawert (ogra) wrote :

same here, i belive the only person that commented here on the bug who actually has a 2.0 available is lioc, the rest of us should be testing on 2.5 anyway.

Revision history for this message
Dinh Nguyen (dinh-nguyen) wrote :

I have checked on my BBG3.0, that the time is correctly kept after a shutdown.
My KCONFIG has this:

#
# on-CPU RTC drivers
#
# CONFIG_RTC_MXC is not set
# CONFIG_RTC_DRV_MXC_V2 is not set
# CONFIG_RTC_DRV_IMXDI is not set
CONFIG_RTC_MC13892=y
# CONFIG_DMADEVICES is not set
CONFIG_REGULATOR=y
# CONFIG_REGULATOR_DEBUG is not set
# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_BQ24022 is not set
CONFIG_REGULATOR_MC13892=y
CONFIG_UIO=y
# CONFIG_UIO_PDRV is not set
CONFIG_UIO_PDRV_GENIRQ=m
# CONFIG_UIO_SMX is not set
# CONFIG_UIO_SERCOS3 is not set

Please check that:
CONFIG_MXC_MC13892_RTC=y

Also, on my BBG3.0 board, I am measuring 2.69V on the coin-cell. Can you measure on your board what is the coin-cell voltage?

Revision history for this message
Loïc Minier (lool) wrote :

Is the voltage supposed to match between b3.0 and 2.5/2.0?

Revision history for this message
Paul Larson (pwlars) wrote :

This appears to get fixed using the test kernel from comment #5 in bug 446140

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.9 KiB)

This bug was fixed in the package linux-fsl-imx51 - 2.6.31-105.14

---------------
linux-fsl-imx51 (2.6.31-105.14) karmic; urgency=low

  [ Andy Whitcroft ]

  * rebase to Ubuntu-2.6.31-14.46
  * [Config] update configs since rebase to Ubuntu-2.6.31-14.46
  * lirc update dropped module lirc_mceusb2

  [ Upstream Kernel Changes ]

  * mxc spi: fix spi driver for 2.6.31
    - LP: #427289, #446140

  [ Ubuntu: 2.6.31-14.46 ]

  * reinstate armel.mk with no flavours
    - LP: #449637
  * [Upstream] elevator: fix fastfail checks to allow merge of readahead
    requests
    - LP: #444915
  * [Upstream] block: silently error unsupported empty barriers too
    - LP: #420423
  * SAUCE: AppArmor: Fix mediation of "deleted" paths
    - LP: #415632
  * [Config] CONFIG_X86_MCE
    https://lists.ubuntu.com/archives/kernel-team/2009-October/007584.html
  * Revert "appletalk: Fix skb leak when ipddp interface is not loaded,
    CVE-2009-2903" - Use patch from 2.6.31.4 which is slightly different.
  * x86: fix csum_ipv6_magic asm memory clobber
  * tty: Avoid dropping ldisc_mutex over hangup tty re-initialization
  * x86: Don't leak 64-bit kernel register values to 32-bit processes
  * tracing: correct module boundaries for ftrace_release
  * ftrace: check for failure for all conversions
  * futex: fix requeue_pi key imbalance
  * futex: Move exit_pi_state() call to release_mm()
  * futex: Nullify robust lists after cleanup
  * futex: Fix locking imbalance
  * NOHZ: update idle state also when NOHZ is inactive
  * ima: ecryptfs fix imbalance message
  * libata: fix incorrect link online check during probe
  * sound: via82xx: move DXS volume controls to PCM interface
  * ASoC: WM8350 capture PGA mutes are inverted
  * KVM: Prevent overflow in KVM_GET_SUPPORTED_CPUID
  * KVM: VMX: flush TLB with INVEPT on cpu migration
  * KVM: fix LAPIC timer period overflow
  * KVM: SVM: Fix tsc offset adjustment when running nested
  * KVM: SVM: Handle tsc in svm_get_msr/svm_set_msr correctly
  * net: Fix wrong sizeof
  * mm: add_to_swap_cache() must not sleep
  * sis5513: fix PIO setup for ATAPI devices
  * PIT fixes to unbreak suspend/resume (bug #14222)
  * IMA: open new file for read
  * ACPI: Clarify resource conflict message
  * ACPI: fix Compaq Evo N800c (Pentium 4m) boot hang regression
  * net: restore tx timestamping for accelerated vlans
  * net: unix: fix sending fds in multiple buffers
  * tun: Return -EINVAL if neither IFF_TUN nor IFF_TAP is set.
  * tcp: fix CONFIG_TCP_MD5SIG + CONFIG_PREEMPT timer BUG()
  * net: Fix sock_wfree() race
  * smsc95xx: fix transmission where ZLP is expected
  * sky2: Set SKY2_HW_RAM_BUFFER in sky2_init
  * appletalk: Fix skb leak when ipddp interface is not loaded
  * ax25: Fix possible oops in ax25_make_new
  * ax25: Fix SIOCAX25GETINFO ioctl
  * sit: fix off-by-one in ipip6_tunnel_get_prl
  * Linux 2.6.31.4
  * drm/i915: Fix FDI M/N setting according with correct color depth
    - LP: #416792

  [ Ubuntu: 2.6.31-13.45 ]

  * [Config] Add sd_mod to scsi-modules udeb for powerpc
  * SAUCE: Update to LIRC 0.8.6
    - LP: #432678
  * [Config] CONFIG_X86_PAT=y
    https://lists.ubuntu.com/archives/kernel-team/2009-October/007477.html...

Read more...

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: In Progress → Fix Released
Revision history for this message
Paul Larson (pwlars) wrote :

Two people now reporting that this bug may be back in the current daily images. Will continue to investigate, but I wanted to go ahead and reopen this since it seems likely to be the case.

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Fix Released → Triaged
Revision history for this message
Loïc Minier (lool) wrote :

Actually things work like a charm with Babbage 2.5 for me; they never worked with Babbage 2.0.

It seems Paul's 2.5 fails, my works, and all 2.0 fail. We need more input.

Revision history for this message
Paul Larson (pwlars) wrote :

Ok, I misunderstood a conversation on irc. Loic confirmed that on his 2.5 the time is still preserved after being unplugged. Looks like my battery is just going dead :(

Changed in linux-fsl-imx51 (Ubuntu Karmic):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.