[#6524] Endless loop in rtc-bfin driver
Submitted By: Morten Kvistgaard
Open Date
2011-04-06 03:10:21
Priority:
Medium Assignee:
Nobody
Status:
Open Fixed In Release:
N/A
Found In Release:
2010R1-RC5 Release:
2010R1-RC5
Category:
Drivers Board:
EZBRD
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Postponed
Uboot version or rev.:
Newest release Toolchain version or rev.:
Newest release
App binary format:
N/A
Summary: Endless loop in rtc-bfin driver
Details:
The Blackfin RTC driver contains an endless loop during initialization, which will hang the system and prevent it from booting.
The error will most likely only trigger on boards with bad hardware. (But I can't say for sure.)
Observe line 143 in file 'blackfin-linux-dist/linux-2.6.x/drivers/rtc/rtc-bfin.c':
==========================================================================
static void bfin_rtc_sync_pending(struct device *dev)
{
dev_dbg_stamp(dev);
while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING)
wait_for_completion_timeout(&bfin_write_complete, HZ * 5);
dev_dbg_stamp(dev);
}
==========================================================================
This is the endless loop. In some cases the RTC_ISTAT_WRITE_PENDING will never go low. (Thereby causing the endless loop.)
Now, observe line 395:
==========================================================================
/* sometimes the bootloader touched things, but the write complete was not
* enabled, so let's just do a quick timeout here since the IRQ will not fire ...
*/
while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING)
if (time_after(jiffies, timeout))
break;
bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
==========================================================================
This is the same loop, but it has a timeout (failsafe). Also notice your own comments. And here's the thing: The next command (bfin_rtc_reset) will call the *first* loop and thereby trigger the error.
I suggest you replace the loop at 143 with the one at 395.
Follow-ups
--- Mike Frysinger 2011-04-06 13:50:02
do you actually have a board with a problem ?
--- Morten Kvistgaard 2011-04-07 03:32:38
Yes, we have our newly made custom bf526 (ezbrd) board.
Our board hasn't got a clock attached to the internal rtc though, so we don't
intend to use the rtc. (It's a coinsident that we've run into this.)
It turns out that the "write pending flag" of the rtc ISTAT register
is "undefined/random" at startup, without a clock. Even though the
specs says otherwise.
... still, even if the hw is bad (or non-existing) the rtc driver shouldn't
hang up the whole system.
--- Sonic Zhang 2011-04-07 03:39:55
In your case, you should disable bfin rtc driver in kernel config.
--- Morten Kvistgaard 2011-04-07 03:42:50
Indeed
--- Mike Frysinger 2011-04-07 11:50:31
iirc, in the past we've seen the RTC peripheral cause the core to hang by any
sort of MMR access when the xtal is not hooked up. so i'm not inclined to tweak
one area when things fundamentally fail at the hardware level.
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
No Files Were Found