Re: [PATCH 11/17] mci: handle SD cards < 2.0 correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

Belisko Marek wrote:
> On Mon, Oct 11, 2010 at 2:48 PM, Juergen Beisert <jbe@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx>
> >> ---
> >> Â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@xxxxxxxxxxxxxx>
> >
> > @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?

Your card is already probed and now the disk layer tries to read the partition 
table.

There seems a bug in one of the routines. The cards states:

> Transfer speed: 25000000

but the mci-core wants more:

> IO settings: bus width=1, frequency=50625000 Hz
                                      ^^^^^^^^^^^
I will check for it.

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/  |

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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux