mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Belisko Marek <marek.belisko@gmail.com>
To: Juergen Beisert <jbe@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 11/17] mci: handle SD cards < 2.0 correctly
Date: Mon, 11 Oct 2010 15:07:44 +0200	[thread overview]
Message-ID: <AANLkTi=hs=GY895Ab1COooFJFbmujrGSHjXKwT5aQo0_@mail.gmail.com> (raw)
In-Reply-To: <201010111448.43598.jbe@pengutronix.de>

Hi Juergen,

On Mon, Oct 11, 2010 at 2:48 PM, Juergen Beisert <jbe@pengutronix.de> wrote:
> Sascha Hauer wrote:
>> With SD cards older than 2.0 the sd_send_if_cond() fails. Do
>> not assume it's an MMC card in this case. Instead, assume
>> it's a MMC card if sd_send_op_cond() fails.
>>
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>>  drivers/mci/mci-core.c |   24 +++++++-----------------
>>  1 files changed, 7 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
>> index a6c81b8..57b82bf 100644
>> --- a/drivers/mci/mci-core.c
>> +++ b/drivers/mci/mci-core.c
>> @@ -1148,26 +1148,16 @@ static int mci_card_probe(struct device_d *mci_dev)
>>
>>       /* Check if this card can handle the "SD Card Physical Layer
>> Specification 2.0" */ rc = sd_send_if_cond(mci_dev);
>> -     if (rc) {
>> +     rc = sd_send_op_cond(mci_dev);
>> +     if (rc && rc == -ETIMEDOUT) {
>>               /* If the command timed out, we check for an MMC card */
>> -             if (rc == -ETIMEDOUT) {
>> -                     pr_debug("Card seems to be a MultiMediaCard\n");
>> -                     rc = mmc_send_op_cond(mci_dev);
>> -                     if (rc) {
>> -                             pr_err("MultiMediaCard voltage select failed with %d\n", rc);
>> -                             goto on_error;
>> -                     }
>> -             } else
>> -                     goto on_error;
>> -     } else {
>> -             /* Its a 2.xx card. Setup operation conditions */
>> -             rc = sd_send_op_cond(mci_dev);
>> -             if (rc) {
>> -                     pr_debug("Cannot setup SD card's operation condition\n");
>> -                     goto on_error;
>> -             }
>> +             pr_debug("Card seems to be a MultiMediaCard\n");
>> +             rc = mmc_send_op_cond(mci_dev);
>>       }
>>
>> +     if (rc)
>> +             goto on_error;
>> +
>>       rc = mci_startup(mci_dev);
>>       if (rc) {
>>               printf("Card's startup fails with %d\n", rc);
>
> Tested-by: Juergen Beisert <jbe@pengutronix.de>
>
> @Marek: You need this patch to make your SD card work on the mini2440.
After applying a patch it 's better but it hangs:
IO settings: bus width=1, frequency=0 Hz
IO settings: bus width=1, frequency=200098 Hz
Command with response
Command with response
Command with response
Command with response
Put the Card in Identify Mode
Command with response
Command with long response
Card's identification data is: 1B534D53-44202020-10C811B9-74008197
Get/Set relative address
Command with response
Get card's specific data
Command with response
Command with long response
Card's specific data is: 002F0032-5F5983CA-6DB7FF9F-96400063
Transfer speed: 25000000
Max. block length are: Write=512, Read=512 Bytes
Capacity: 970 MiB
Read block length: 512, Write block length: 512
Select the card, and put it into Transfer Mode
Command with response
Changing transfer frequency
Command with response
Trying to read the SCR (try 1 of 3)
Command with response
Command with response
Command with response
IO settings: bus width=1, frequency=50625000 Hz
Command with response
Card is up and running now, registering as a disk
mci_sd_read called: Read 1 block(s), starting at 0 to 31BBFBB9
Command with response

Than it hangs maybe in while(1) in s3c_send_command?

>
> jbe
>
> --
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
> Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
>

BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-10-11 13:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 11:28 Patches for -next Sascha Hauer
2010-10-11 11:28 ` [PATCH 01/17] i.MX27: Add support for SDHC pins Sascha Hauer
2010-10-11 11:28 ` [PATCH 02/17] mci: Add i.MX esdhc support Sascha Hauer
2010-10-11 11:28 ` [PATCH 03/17] mci: print error code on failure Sascha Hauer
2010-10-11 11:28 ` [PATCH 04/17] spi i.MX: add spi version namespace to register defines Sascha Hauer
2010-10-11 11:28 ` [PATCH 05/17] spi i.MX: redirect functions to version specific functions Sascha Hauer
2010-10-11 11:28 ` [PATCH 06/17] spi i.MX: Add i.MX51 support Sascha Hauer
2010-10-11 11:28 ` [PATCH 07/17] Move mfd drivers to drivers/mfd Sascha Hauer
2010-10-11 11:28 ` [PATCH 08/17] move include files for mfd drivers to include/mfd Sascha Hauer
2010-10-11 11:28 ` [PATCH 09/17] mfd mc13892: Add spi support Sascha Hauer
2010-10-11 11:28 ` [PATCH 10/17] mfd mc13892: support reading the revision Sascha Hauer
2010-10-11 11:28 ` [PATCH 11/17] mci: handle SD cards < 2.0 correctly Sascha Hauer
2010-10-11 12:48   ` Juergen Beisert
2010-10-11 13:07     ` Belisko Marek [this message]
2010-10-11 13:47       ` Juergen Beisert
2010-10-11 12:53   ` Juergen Beisert
2010-10-11 11:28 ` [PATCH 12/17] mci: align write buffer if necessary Sascha Hauer
2010-10-11 11:28 ` [PATCH 13/17] defaultenv: handle disk partitions Sascha Hauer
2010-10-11 12:26   ` Juergen Beisert
2010-10-11 12:50     ` Sascha Hauer
2010-10-11 12:59       ` Juergen Beisert
2010-10-11 13:54         ` Sascha Hauer
2010-10-11 14:22           ` Juergen Beisert
2010-10-12  6:51             ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-11 11:28 ` [PATCH 14/17] imx_serial: Add mx51 support Sascha Hauer
2010-10-11 11:28 ` [PATCH 15/17] ARM mmu: Call __mmu_cache_flush instead of hardcoded v4/v5 only function Sascha Hauer
2010-10-11 11:28 ` [PATCH 16/17] ARM i.MX: Add basic i.MX51 support Sascha Hauer
2010-10-11 11:28 ` [PATCH 17/17] ARM i.MX51: Add babbage board support 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='AANLkTi=hs=GY895Ab1COooFJFbmujrGSHjXKwT5aQo0_@mail.gmail.com' \
    --to=marek.belisko@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@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