public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Reinhard Meyer <u-boot@emk-elektronik.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] gen_atmel_mci freeze on at91sam9g45
Date: Sun, 05 Dec 2010 09:30:38 +0100	[thread overview]
Message-ID: <4CFB4DAE.3080903@emk-elektronik.de> (raw)
In-Reply-To: <AANLkTim744_gotLvzaVmb23i3GdN=brT3tiRtnqfcmkd@mail.gmail.com>

Dear eric cariat,
> I'm currently working on a custom board with an at91sam9g45 : I followed the
> instruction in README.atmel_mci. In U-boot, if I use the command mmcinfo,
> the system hang. The uSD is working correctly with at91bootstrap and linux.
> In U-boot everything seems fine, the card exchange a few command and
> response, and then freeze on the command 55 51 (the first command that will
> receive some data on DAT0 ) :
> 
> U-Boot> mmcinfo
> mci: bus_hz is 133333333, setting clock 150000 Hz, block size 512
"setting clock" should read "requesting clock". 150000 is the clock a MMC card
should be inquired with. Unfortunately the minimum clock obtainable is 260416,
but that did not cause problems with SD cards so far...
> mci: setting clock 260416 Hz, block size 512
So the software sets it to the minimum-.
> mci: bus_hz is 133333333, setting clock 0 Hz, block size 512
> mci: setting clock 260416 Hz, block size 512
> mci: bus_hz is 133333333, setting clock 260416 Hz, block size 512
> mci: setting clock 260416 Hz, block size 512

First make sure the clock values are correct: Assuming the system is running
at 400MHz, this would make sense if the MCI is clocked by system clock / 3.
Then the minimum clock would indeed be 260416.

Is the 9G45 (H)MCI is really identical to the 9260 MCI or are there subtle
differences?

> But if I add some printf to debug , just after the
> mci_data_op=mci_data_read() in gen_atmel_mci, then everything is OK and I
> can now use the uSD without any problem.
> Here is where I add the printf, so uSD is correctly handled :
> 
> diff -crbN u-boot-2010.09.orig/drivers/mmc/gen_atmel_mci.c
> u-boot-2010.09/drivers/mmc/gen_atmel_mci.c
> *** u-boot-2010.09.orig/drivers/mmc/gen_atmel_mci.c    2010-09-28
> 23:20:55.000000000 +0200
> --- u-boot-2010.09/drivers/mmc/gen_atmel_mci.c    2010-12-04
> 17:52:59.092770689 +0100
> ***************
> *** 252,257 ****
> --- 252,258 ----
>               while (!status && word_count < (sys_blocksize / 4)) {
>                   status = mci_data_op(mci, &dummy,
>                       error_flags);
> +                 printf("status=%x\n",status);
>                   word_count++;
>               }
>               if (status) {
> 

Have you tested whether a udelay() serves the same purpose? It would seem that there is
an issue when mci_data_op() is called too frequently. However, quite the same code exists
a few lines above and it did not hang there.

Is your data cache on?

There are no timeouts coded in mci_data_read() and mci_data_write(), maybe it would be good
to add some...

I also cannot rule out that pre-initialisation of the MCI by the bootstrap code could leave
some registers with values that the gen_atmel_mci driver does not reset. But then, a printf
would unlikely fix the problem.

Patches are always welcome ;)

Best Regards,
Reinhard

  reply	other threads:[~2010-12-05  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04 17:08 [U-Boot] gen_atmel_mci freeze on at91sam9g45 eric cariat
2010-12-05  8:30 ` Reinhard Meyer [this message]
2010-12-07 17:23   ` eric cariat
2010-12-08 20:15     ` Reinhard Meyer

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=4CFB4DAE.3080903@emk-elektronik.de \
    --to=u-boot@emk-elektronik.de \
    --cc=u-boot@lists.denx.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