From: Roberto Nibali <rnibali@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [BUG: barebox-git] failure at common/block.c:248/block_put()!
Date: Tue, 29 May 2012 15:33:35 +0200 [thread overview]
Message-ID: <CAONxwYOgrfE6KxjFSKB+5kyEw_=S6_JdaJ3xD6oD5Vg2mJG4hg@mail.gmail.com> (raw)
In-Reply-To: <CAONxwYPuBCkUE2M6MgpgG7sJQjsYJ8WYhgfhaGUju4f7xcL89g@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 8503 bytes --]
More information ...
> I am pretty sure we need to switch to 1BIT transfer and/or using the SDHCI_BROKEN_TIMEOUT_VAL
> quirk. I'll try to find out if I can add this functionality to barebox,
> unless you believe there's something else which causes this behaviour.
>
> I'll keep investigating ...
>
Added more debugging information, which pretty much pinpoints the culprit
from a software point of view:
diff --git a/common/block.c b/common/block.c
index 4253fc4..5e0b50a 100644
--- a/common/block.c
+++ b/common/block.c
@@ -142,6 +142,7 @@ static int block_cache(struct block_device *blk, int
block)
num_blocks = min(blk->rdbufsize, blk->num_blocks -
chunk->block_start);
ret = blk->ops->read(blk, chunk->data, chunk->block_start,
num_blocks);
+ printf("%s: blk->ops->read returned %d\n", __func__, ret);
if (ret) {
list_add_tail(&chunk->list, &blk->idle_blocks);
return ret;
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index ae3c805..024e18e 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -24,6 +24,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
+
+#define DEBUG
+
#include <config.h>
#include <common.h>
#include <driver.h>
@@ -239,6 +242,7 @@ esdhc_send_cmd(struct mci_host *mci, struct mci_cmd
*cmd, struct mci_data *data
struct fsl_esdhc_host *host = to_fsl_esdhc(mci);
struct fsl_esdhc *regs = host->regs;
int ret;
+ int loop;
esdhc_write32(®s->irqstat, -1);
@@ -280,6 +284,18 @@ esdhc_send_cmd(struct mci_host *mci, struct mci_cmd
*cmd, struct mci_data *dat
/* Wait for the command to complete */
ret = wait_on_timeout(100 * MSECOND,
esdhc_read32(®s->irqstat) & IRQSTAT_CC);
+ loop = 1;
+ while (ret && loop <=10) {
+ printf("%s: busy loop %d start\n", __func__, loop);
+ ret = wait_on_timeout(100 * MSECOND,
+ esdhc_read32(®s->irqstat) & IRQSTAT_CC);
+ printf("%s: busy loop %d end, cap=0x%08x, irqstat=0x%08x,
prsstat=0x%08x\n",
+ __func__, loop,
+ esdhc_read32(&host->regs->hostcapblt),
+ esdhc_read32(®s->irqstat),
+ esdhc_read32(®s->prsstat));
+ loop++;
+ }
if (ret) {
dev_err(host->dev, "timeout 1\n");
return -ETIMEDOUT;
It clearly hangs because the IRQSTAT_CC is never set in ®s->irqstat.
Now, I am not familiar enough with the quirks of the ESDHC technology to
know why the host never receives or sees the IRQ of a command complete,
however this behaviour pretty much renders my eSDHC interface unusable. See
output below:
sid1-noah:/ mount /dev/disk0.0 fat /mnt
block_cache: blk->ops->read returned 0
sid1-noah:/ cp /mnt/conblock_cache: blk->ops->read returned 0
sole_image.jffs2 /mnt/console_image.jffs2-backup
block_cache: blk->ops->read returned 0
block_cache: blk->ops->read returned 0
block_cache: blk->ops->read returned 0
block_cache: blk->ops->read returned 0
block_cache: blk->ops->read returned 0
block_cache: blk->ops->read returned 0
Data Write Failed in PIO Mode.imx-esdhc@imx-esdhc0: timeout 2
esdhc_send_cmd: busy loop 1 start
esdhc_send_cmd: busy loop 1 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 2 start
esdhc_send_cmd: busy loop 2 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 3 start
esdhc_send_cmd: busy loop 3 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 4 start
esdhc_send_cmd: busy loop 4 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 5 start
esdhc_send_cmd: busy loop 5 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 6 start
esdhc_send_cmd: busy loop 6 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 7 start
esdhc_send_cmd: busy loop 7 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 8 start
esdhc_send_cmd: busy loop 8 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 9 start
esdhc_send_cmd: busy loop 9 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 10 start
esdhc_send_cmd: busy loop 10 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
imx-esdhc@imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 start
esdhc_send_cmd: busy loop 1 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 2 start
esdhc_send_cmd: busy loop 2 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 3 start
esdhc_send_cmd: busy loop 3 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 4 start
esdhc_send_cmd: busy loop 4 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 5 start
esdhc_send_cmd: busy loop 5 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 6 start
esdhc_send_cmd: busy loop 6 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 7 start
esdhc_send_cmd: busy loop 7 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 8 start
esdhc_send_cmd: busy loop 8 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 9 start
esdhc_send_cmd: busy loop 9 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 10 start
esdhc_send_cmd: busy loop 10 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
imx-esdhc@imx-esdhc0: timeout 1
esdhc_send_cmd: busy loop 1 start
esdhc_send_cmd: busy loop 1 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 2 start
esdhc_send_cmd: busy loop 2 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 3 start
esdhc_send_cmd: busy loop 3 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 4 start
esdhc_send_cmd: busy loop 4 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 5 start
esdhc_send_cmd: busy loop 5 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 6 start
esdhc_send_cmd: busy loop 6 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 7 start
esdhc_send_cmd: busy loop 7 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 8 start
esdhc_send_cmd: busy loop 8 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 9 start
esdhc_send_cmd: busy loop 9 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
esdhc_send_cmd: busy loop 10 start
esdhc_send_cmd: busy loop 10 end, cap=0x07f30000, irqstat=0x00000000,
prsstat=0xf7880587
imx-esdhc@imx-esdhc0: timeout 1
block_cache: blk->ops->read returned -110
BUG: failure at common/block.c:249/block_put()!
BUG!
[<83f349a4>] (unwind_backtrace+0x0/0x9c) from [<83f1c094>] (panic+0x28/0x3c)
[<83f1c094>] (panic+0x28/0x3c) from [<83f05900>] (block_put+0x48/0x8c)
[<83f05900>] (block_put+0x48/0x8c) from [<83f059ec>]
(block_write+0xa8/0x120)
[<83f059ec>] (block_write+0xa8/0x120) from [<83f2d478>]
(cdev_write+0x30/0x34)
[<83f2d478>] (cdev_write+0x30/0x34) from [<83f30970>] (disk_write+0x24/0x30)
[<83f30970>] (disk_write+0x24/0x30) from [<83f2fabc>] (f_write+0x160/0x27c)
[<83f2fabc>] (f_write+0x160/0x27c) from [<83f30730>] (fat_write+0x18/0x30)
[<83f30730>] (fat_write+0x18/0x30) from [<83f31220>] (write+0xac/0xd0)
[<83f31220>] (write+0xac/0xd0) from [<83f21864>] (copy_file+0xec/0x17c)
[<83f21864>] (copy_file+0xec/0x17c) from [<83f191e0>] (do_cp+0x124/0x158)
[<83f191e0>] (do_cp+0x124/0x158) from [<83f07bb0>]
(execute_command+0x38/0x7c)
[<83f07bb0>] (execute_command+0x38/0x7c) from [<83f03bc8>]
(run_list_real+0x8a0/0x998)
[<83f03bc8>] (run_list_real+0x8a0/0x998) from [<83f03e04>]
(parse_stream_outer+0x144/0x240)
[<83f03e04>] (parse_stream_outer+0x144/0x240) from [<83f041fc>]
(run_shell+0x3c/0x5c)
[<83f041fc>] (run_shell+0x3c/0x5c) from [<83f09640>]
(start_barebox+0xd4/0x110)
[<83f09640>] (start_barebox+0xd4/0x110) from [<8010206c>] (0x8010206c)
Removing the loop<=10 limit throws the code into a livelock.
Any suggestions?
Cheers
Roberto
[-- Attachment #1.2: Type: text/html, Size: 11135 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-05-29 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 9:49 Roberto Nibali
2012-05-29 10:14 ` Sascha Hauer
2012-05-29 10:25 ` Roberto Nibali
2012-05-29 11:47 ` Roberto Nibali
2012-05-29 13:33 ` Roberto Nibali [this message]
2012-05-29 18:57 ` Sascha Hauer
2012-05-29 19:57 ` Roberto Nibali
2012-05-30 5:33 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAONxwYOgrfE6KxjFSKB+5kyEw_=S6_JdaJ3xD6oD5Vg2mJG4hg@mail.gmail.com' \
--to=rnibali@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox