Skip to contentSkip to conversation

A MMC card transfer issue

DISCUSSION Tomoya MORINAGA 5 participants 26 messages Nov 9, 2010 – Mar 25, 2011 14 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
521 EXT_CSD_BUS_WIDTH, ext_csd_bit);
522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {
527 printk(KERN_WARNING "%s: switch to bus width %d "
528 "failed\n", mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host, bus_width);
533 }
534 }
535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

Signature · 2 lines
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
#1 lore raw

2010/11/9 Tomoya MORINAGA <[email protected]>:

Quoted 48 lines

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

 505        /*
 506         * Activate wide bus (if supported).
 507         */
 508        if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
 509            (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 510                unsigned ext_csd_bit, bus_width;
 511
 512                if (host->caps & MMC_CAP_8_BIT_DATA) {
 513                        ext_csd_bit = EXT_CSD_BUS_WIDTH_8; 514                        bus_width = MMC_BUS_WIDTH_8;
 515                } else {
 516                        ext_csd_bit = EXT_CSD_BUS_WIDTH_4; 517                        bus_width = MMC_BUS_WIDTH_4;
 518                }
 519
 520                err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 521                                 EXT_CSD_BUS_WIDTH, ext_csd_bit); 522
 523                if (err && err != -EBADMSG)
 524                        goto free_card;
 525
 526                if (err) {
 527                        printk(KERN_WARNING "%s: switch to bus width %d " 528                               "failed\n", mmc_hostname(card->host), 529                               1 << bus_width);
 530                        err = 0;
 531                } else {
 532                        mmc_set_bus_width(card->host, bus_width); 533                }
 534        }
 535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

Quoted 3 lines

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

You can find a patch for 4-bit support. the problem is there's some bug related so it set the 4 & 8 bit support both.
So line 512 is always true. you can just remove the one line like this.

It's quirk-and-dirty patch. now we try to find a generic solution to solve this issue.

drivers/mmc/host/sdhci.c +1 -1
@@ -1849,7 +1849,7 @@ int sdhci_add_host(struct sdhci_host *host)
        mmc->caps |= MMC_CAP_SDIO_IRQ;
 
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
-               mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        if (caps & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

Thank you,
Kyungmin Park

Quoted 9 lines

--
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Park,

Thank you for your information.
I will try it soon.

Thanks,
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.
----- Original Message -----
From: "Kyungmin Park" <[email protected]>
To: "Tomoya MORINAGA" <[email protected]>
Cc: <[email protected]>; <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>
Sent: Tuesday, November 09, 2010 2:53 PM
Subject: Re: A MMC card transfer issue

Quoted 88 lines

2010/11/9 Tomoya MORINAGA <[email protected]>:

Quoted 48 lines

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 521 EXT_CSD_BUS_WIDTH, ext_csd_bit);
522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {
527 printk(KERN_WARNING "%s: switch to bus width %d " 528 "failed\n", mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host, bus_width);
533 }
534 }
535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

Quoted 3 lines

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

You can find a patch for 4-bit support. the problem is there's some bug related so it set the 4 & 8 bit support both.
So line 512 is always true. you can just remove the one line like this.

It's quirk-and-dirty patch. now we try to find a generic solution to solve this issue.

drivers/mmc/host/sdhci.c +1 -1
@@ -1849,7 +1849,7 @@ int sdhci_add_host(struct sdhci_host *host)
        mmc->caps |= MMC_CAP_SDIO_IRQ;
 
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
-               mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        if (caps & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

Thank you,
Kyungmin Park

Quoted 9 lines

--
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
In reply to Kyungmin Park

Hi Park,

Though I tried to patch yours to "sdhci.c" of linux-2.6.36, but it seems your patch has already patched in linux-2.6.36.

Using this linux, MMC card is not recognized. Inserting the MMC card, I saw the following erro message.

[   11.035441] sdhci: Secure Digital Host Controller Interface driver
[   11.035450] sdhci: Copyright(c) Pierre Ossman
[   11.058295] sdhci-pci 0000:02:04.0: SDHCI controller found [8086:8809] (rev 1)
[   11.058342]   alloc irq_desc for 18 on node -1
[   11.058350]   alloc kstat_irqs on node -1
[   11.058373] sdhci-pci 0000:02:04.0: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058385] sdhci-pci 0000:02:04.0: Invalid iomem size. You may experience problems.
[   11.058487] sdhci-pci 0000:02:04.0: setting latency timer to 64
[   11.058623] Registered led device: mmc0::
[   11.058736] mmc0: SDHCI controller on PCI [0000:02:04.0] using DMA
[   11.058774] sdhci-pci 0000:02:04.1: SDHCI controller found [8086:880a] (rev 1)
[   11.058816] sdhci-pci 0000:02:04.1: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058828] sdhci-pci 0000:02:04.1: Invalid iomem size. You may experience problems.
[   11.058904] sdhci-pci 0000:02:04.1: setting latency timer to 64
[   11.059047] Registered led device: mmc1::
[   11.059153] mmc1: SDHCI controller on PCI [0000:02:04.1] using DMA
[   11.547645] mmc1: new high speed SD card at address 0ec7
[   11.629400] mmcblk0: mmc1:0ec7 SV02G 1.87 GiB (ro)
[   11.630314]  mmcblk0: p1
[   12.076459] gzip used greatest stack depth: 6008 bytes left
[   12.321795] ip used greatest stack depth: 5724 bytes left
[   13.786510] EXT3-fs (dm-0): using internal journal
[   13.887463] EXT3-fs: barriers not enabled
[   13.887872] kjournald starting.  Commit interval 5 seconds
[   13.888154] EXT3-fs (sda1): using internal journal
[   13.888178] EXT3-fs (sda1): mounted filesystem with writeback data mode
[   23.183874] Adding 2064380k swap on /dev/mapper/VolGroup00-LogVol01.  Priority:-1 extents:1 across:2064380k
[   39.171225] gconfd-2 used greatest stack depth: 5692 bytes left
[   86.545435] metacity[2318]: segfault at 0 ip 080aa093 sp bfd899a0 error 4 in metacity[8048000+82000]
[  115.124784] hda-intel: Invalid position buffer, using LPIB read method instead.
[  115.124821] hda-intel: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[  346.630117] mmc1: card 0ec7 removed
[  408.266730] mmc1: new MMC card at address 0001
[  408.268142] mmcblk0: mmc1:0001 MMC    1.87 GiB
[  408.275970] mmcblk0: retrying using single block read
[  408.278451] mmcblk0: error -84 transferring data, sector 0, nr 8, card status 0x900
[  408.278464] end_request: I/O error, dev mmcblk0, sector 0
[  408.280966] mmcblk0: error -84 transferring data, sector 1, nr 7, card status 0x900
[  408.280978] end_request: I/O error, dev mmcblk0, sector 1

I have suspected mmc.c is buggy.
I tried to disable like the following in "mmc_init_card". As a result, the MMC card to be recognized correctly. What's do you think ?

*/
static int mmc_init_card(struct mmc_host *host, u32 ocr,
struct mmc_card *oldcard)
{
......

/*
* Activate wide bus (if supported).
*/
#if 0 //101111
if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&

     (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {

unsigned ext_csd_bit, bus_width;

  if (host->caps & MMC_CAP_8_BIT_DATA) {
   ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
   bus_width = MMC_BUS_WIDTH_8;
  } else {
   ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
   bus_width = MMC_BUS_WIDTH_4;
  }

err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,

     EXT_CSD_BUS_WIDTH, ext_csd_bit);
  if (err && err != -EBADMSG)
   goto free_card;

if (err) {
printk(KERN_WARNING "%s: switch to bus width %d "

          "failed\n", mmc_hostname(card->host),
          1 << bus_width);

err = 0;
} else {
mmc_set_bus_width(card->host, bus_width);
}
}
#endif //101111

------
Thanks,

Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

----- Original Message -----
From: "Kyungmin Park" <[email protected]>
To: "Tomoya MORINAGA" <[email protected]>
Cc: <[email protected]>; <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>
Sent: Tuesday, November 09, 2010 2:53 PM
Subject: Re: A MMC card transfer issue

Quoted 88 lines

2010/11/9 Tomoya MORINAGA <[email protected]>:

Quoted 48 lines

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 521 EXT_CSD_BUS_WIDTH, ext_csd_bit);
522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {
527 printk(KERN_WARNING "%s: switch to bus width %d " 528 "failed\n", mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host, bus_width);
533 }
534 }
535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

Quoted 3 lines

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

You can find a patch for 4-bit support. the problem is there's some bug related so it set the 4 & 8 bit support both.
So line 512 is always true. you can just remove the one line like this.

It's quirk-and-dirty patch. now we try to find a generic solution to solve this issue.

drivers/mmc/host/sdhci.c +1 -1
@@ -1849,7 +1849,7 @@ int sdhci_add_host(struct sdhci_host *host)
        mmc->caps |= MMC_CAP_SDIO_IRQ;
 
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
-               mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        if (caps & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

Thank you,
Kyungmin Park

Quoted 9 lines

--
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

Hi Park,

How's the issue going ?

With best regards.
---
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.
----- Original Message -----
From: "Tomoya MORINAGA" <[email protected]>
To: "Kyungmin Park" <[email protected]>
Cc: <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>; <[email protected]>
Sent: Thursday, November 11, 2010 11:59 AM
Subject: Re: A MMC card transfer issue

Quoted 207 lines

Hi Park,

Though I tried to patch yours to "sdhci.c" of linux-2.6.36, but it seems your patch has already patched in linux-2.6.36.

Using this linux, MMC card is not recognized. Inserting the MMC card, I saw the following erro message.

[   11.035441] sdhci: Secure Digital Host Controller Interface driver
[   11.035450] sdhci: Copyright(c) Pierre Ossman
[   11.058295] sdhci-pci 0000:02:04.0: SDHCI controller found [8086:8809] (rev 1)
[   11.058342]   alloc irq_desc for 18 on node -1
[   11.058350]   alloc kstat_irqs on node -1
[   11.058373] sdhci-pci 0000:02:04.0: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058385] sdhci-pci 0000:02:04.0: Invalid iomem size. You may experience problems.
[   11.058487] sdhci-pci 0000:02:04.0: setting latency timer to 64
[   11.058623] Registered led device: mmc0::
[   11.058736] mmc0: SDHCI controller on PCI [0000:02:04.0] using DMA
[   11.058774] sdhci-pci 0000:02:04.1: SDHCI controller found [8086:880a] (rev 1)
[   11.058816] sdhci-pci 0000:02:04.1: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058828] sdhci-pci 0000:02:04.1: Invalid iomem size. You may experience problems.
[   11.058904] sdhci-pci 0000:02:04.1: setting latency timer to 64
[   11.059047] Registered led device: mmc1::
[   11.059153] mmc1: SDHCI controller on PCI [0000:02:04.1] using DMA
[   11.547645] mmc1: new high speed SD card at address 0ec7
[   11.629400] mmcblk0: mmc1:0ec7 SV02G 1.87 GiB (ro)
[   11.630314]  mmcblk0: p1
[   12.076459] gzip used greatest stack depth: 6008 bytes left
[   12.321795] ip used greatest stack depth: 5724 bytes left
[   13.786510] EXT3-fs (dm-0): using internal journal
[   13.887463] EXT3-fs: barriers not enabled
[   13.887872] kjournald starting.  Commit interval 5 seconds
[   13.888154] EXT3-fs (sda1): using internal journal
[   13.888178] EXT3-fs (sda1): mounted filesystem with writeback data mode
[   23.183874] Adding 2064380k swap on /dev/mapper/VolGroup00-LogVol01.  Priority:-1 extents:1 across:2064380k
[   39.171225] gconfd-2 used greatest stack depth: 5692 bytes left
[   86.545435] metacity[2318]: segfault at 0 ip 080aa093 sp bfd899a0 error 4 in metacity[8048000+82000]
[  115.124784] hda-intel: Invalid position buffer, using LPIB read method instead.
[  115.124821] hda-intel: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[  346.630117] mmc1: card 0ec7 removed
[  408.266730] mmc1: new MMC card at address 0001
[  408.268142] mmcblk0: mmc1:0001 MMC    1.87 GiB
[  408.275970] mmcblk0: retrying using single block read
[  408.278451] mmcblk0: error -84 transferring data, sector 0, nr 8, card status 0x900
[  408.278464] end_request: I/O error, dev mmcblk0, sector 0
[  408.280966] mmcblk0: error -84 transferring data, sector 1, nr 7, card status 0x900
[  408.280978] end_request: I/O error, dev mmcblk0, sector 1

I have suspected mmc.c is buggy.
I tried to disable like the following in "mmc_init_card". As a result, the MMC card to be recognized correctly. What's do you think ?

*/
static int mmc_init_card(struct mmc_host *host, u32 ocr,
struct mmc_card *oldcard)
{
......

/*
* Activate wide bus (if supported).
*/
#if 0 //101111
if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&

     (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {

unsigned ext_csd_bit, bus_width;

  if (host->caps & MMC_CAP_8_BIT_DATA) {
   ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
   bus_width = MMC_BUS_WIDTH_8;
  } else {
   ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
   bus_width = MMC_BUS_WIDTH_4;
  }

err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,

     EXT_CSD_BUS_WIDTH, ext_csd_bit);
  if (err && err != -EBADMSG)
   goto free_card;
  if (err) {
   printk(KERN_WARNING "%s: switch to bus width %d "
          "failed\n", mmc_hostname(card->host),
          1 << bus_width);
   err = 0;
  } else {
   mmc_set_bus_width(card->host, bus_width);

}
}
#endif //101111

------
Thanks,

Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

----- Original Message -----
From: "Kyungmin Park" <[email protected]>
To: "Tomoya MORINAGA" <[email protected]>
Cc: <[email protected]>; <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>
Sent: Tuesday, November 09, 2010 2:53 PM
Subject: Re: A MMC card transfer issue

Quoted 82 lines

2010/11/9 Tomoya MORINAGA <[email protected]>:

Quoted 48 lines

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 521 EXT_CSD_BUS_WIDTH, ext_csd_bit);
522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {
527 printk(KERN_WARNING "%s: switch to bus width %d " 528 "failed\n", mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host, bus_width);
533 }
534 }
535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

Quoted 3 lines

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

You can find a patch for 4-bit support. the problem is there's some bug related so it set the 4 & 8 bit support both.
So line 512 is always true. you can just remove the one line like this.

It's quirk-and-dirty patch. now we try to find a generic solution to solve this issue.

drivers/mmc/host/sdhci.c +1 -1
@@ -1849,7 +1849,7 @@ int sdhci_add_host(struct sdhci_host *host)
        mmc->caps |= MMC_CAP_SDIO_IRQ;
 
        if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
-               mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        if (caps & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

Thank you,
Kyungmin Park

Quoted 9 lines

--
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

resend as plain text

Quoted 252 lines · Philip Rakity

take the 8 bit patch that chris put on the mailing list. It may fix this.

Hi Philip,

Quoted 3 lines · Philip Rakity

a) QUIRK removed for 8 bit support since platform issue - not quirk
b) platform Flag defined for sdhci-pxa.c and plat-pxa
c) comments added to sdhci.c on usage

Thanks very much, I'll plan on sending this to Linus tomorrow, along with the rest of my .37 queue, unless there are any more review comments from anyone.

http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commit;h=15ec44611904be0dcc97b84c29fbf964e5e2b36f

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
Quoted 229 lines · Tomoya MORINAGA

Hi Park,

How's the issue going ?

With best regards.
---
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.
----- Original Message -----
From: "Tomoya MORINAGA" <[email protected]>
To: "Kyungmin Park" <[email protected]>
Cc: <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>; <[email protected]>
Sent: Thursday, November 11, 2010 11:59 AM
Subject: Re: A MMC card transfer issue

Quoted 201 lines

Hi Park,

Though I tried to patch yours to "sdhci.c" of linux-2.6.36, but it seems your patch has already patched in linux-2.6.36.

Using this linux, MMC card is not recognized. Inserting the MMC card, I saw the following erro message.

[   11.035441] sdhci: Secure Digital Host Controller Interface driver
[   11.035450] sdhci: Copyright(c) Pierre Ossman
[   11.058295] sdhci-pci 0000:02:04.0: SDHCI controller found [8086:8809] (rev 1)
[   11.058342]   alloc irq_desc for 18 on node -1
[   11.058350]   alloc kstat_irqs on node -1
[   11.058373] sdhci-pci 0000:02:04.0: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058385] sdhci-pci 0000:02:04.0: Invalid iomem size. You may experience problems.
[   11.058487] sdhci-pci 0000:02:04.0: setting latency timer to 64
[   11.058623] Registered led device: mmc0::
[   11.058736] mmc0: SDHCI controller on PCI [0000:02:04.0] using DMA
[   11.058774] sdhci-pci 0000:02:04.1: SDHCI controller found [8086:880a] (rev 1)
[   11.058816] sdhci-pci 0000:02:04.1: PCI INT C -> GSI 18 (level, low) -> IRQ 18
[   11.058828] sdhci-pci 0000:02:04.1: Invalid iomem size. You may experience problems.
[   11.058904] sdhci-pci 0000:02:04.1: setting latency timer to 64
[   11.059047] Registered led device: mmc1::
[   11.059153] mmc1: SDHCI controller on PCI [0000:02:04.1] using DMA
[   11.547645] mmc1: new high speed SD card at address 0ec7
[   11.629400] mmcblk0: mmc1:0ec7 SV02G 1.87 GiB (ro)
[   11.630314]  mmcblk0: p1
[   12.076459] gzip used greatest stack depth: 6008 bytes left
[   12.321795] ip used greatest stack depth: 5724 bytes left
[   13.786510] EXT3-fs (dm-0): using internal journal
[   13.887463] EXT3-fs: barriers not enabled
[   13.887872] kjournald starting.  Commit interval 5 seconds
[   13.888154] EXT3-fs (sda1): using internal journal
[   13.888178] EXT3-fs (sda1): mounted filesystem with writeback data mode
[   23.183874] Adding 2064380k swap on /dev/mapper/VolGroup00-LogVol01.  Priority:-1 extents:1 across:2064380k
[   39.171225] gconfd-2 used greatest stack depth: 5692 bytes left
[   86.545435] metacity[2318]: segfault at 0 ip 080aa093 sp bfd899a0 error 4 in metacity[8048000+82000]
[  115.124784] hda-intel: Invalid position buffer, using LPIB read method instead.
[  115.124821] hda-intel: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[  346.630117] mmc1: card 0ec7 removed
[  408.266730] mmc1: new MMC card at address 0001
[  408.268142] mmcblk0: mmc1:0001 MMC    1.87 GiB
[  408.275970] mmcblk0: retrying using single block read
[  408.278451] mmcblk0: error -84 transferring data, sector 0, nr 8, card status 0x900
[  408.278464] end_request: I/O error, dev mmcblk0, sector 0
[  408.280966] mmcblk0: error -84 transferring data, sector 1, nr 7, card status 0x900
[  408.280978] end_request: I/O error, dev mmcblk0, sector 1

I have suspected mmc.c is buggy.
I tried to disable like the following in "mmc_init_card". As a result, the MMC card to be recognized correctly. What's do you think ?

*/
static int mmc_init_card(struct mmc_host *host, u32 ocr, struct mmc_card *oldcard)
{
......

/*
* Activate wide bus (if supported).
*/
#if 0 //101111
if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&

    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {

unsigned ext_csd_bit, bus_width;

if (host->caps & MMC_CAP_8_BIT_DATA) {
ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
bus_width = MMC_BUS_WIDTH_8;
} else {
ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
bus_width = MMC_BUS_WIDTH_4;
}

err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,

    EXT_CSD_BUS_WIDTH, ext_csd_bit);

if (err && err != -EBADMSG)
goto free_card;

if (err) {
printk(KERN_WARNING "%s: switch to bus width %d "

         "failed\n", mmc_hostname(card->host),
         1 << bus_width);

err = 0;
} else {
mmc_set_bus_width(card->host, bus_width);
}
}
#endif //101111

------
Thanks,

Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

----- Original Message -----
From: "Kyungmin Park" <[email protected]>
To: "Tomoya MORINAGA" <[email protected]>
Cc: <[email protected]>; <[email protected]>; "Andrew"" <[email protected]>; <[email protected]>
Sent: Tuesday, November 09, 2010 2:53 PM
Subject: Re: A MMC card transfer issue

Quoted 82 lines

2010/11/9 Tomoya MORINAGA <[email protected]>:

Quoted 48 lines

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub). The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card).
The card is 1 bit bus width. And the card is according to MMC specification V3.x. And the EG20T has a 4 bit bus width capability
Linux MMC standard driver decides the card bus width as 4 bit,
if the MMC specification version is larger than or equal to V4.0 like below.

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 521 EXT_CSD_BUS_WIDTH, ext_csd_bit);
522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {
527 printk(KERN_WARNING "%s: switch to bus width %d " 528 "failed\n", mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host, bus_width);
533 }
534 }
535

However the MMC specification version id is the same as V3.x and V4.0. Therefore the driver uses the 4 bit bus width for the MMC card
even if the card has only 1 bit bus width.
I modified the driver to use 1 bit bus width only tentatively and confirmed that we can mount the card and R/W correctly.

Quoted 3 lines

I think we can not support MMC_CAP_4_BIT_DATA or MMC_CAP_8_BIT_DATA in MMC V4.0.

How do you think ?

You can find a patch for 4-bit support. the problem is there's some bug related so it set the 4 & 8 bit support both.
So line 512 is always true. you can just remove the one line like this.

It's quirk-and-dirty patch. now we try to find a generic solution to solve this issue.

drivers/mmc/host/sdhci.c +1 -1
@@ -1849,7 +1849,7 @@ int sdhci_add_host(struct sdhci_host *host)
       mmc->caps |= MMC_CAP_SDIO_IRQ;
 
       if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
-               mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+               mmc->caps |= MMC_CAP_4_BIT_DATA;
 
       if (caps & SDHCI_CAN_DO_HISPD)
               mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

Thank you,
Kyungmin Park

Quoted 9 lines

--
Thanks,
Tomoya MORINAGA(OKI SEMICONDUCTOR CO., LTD.)
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

I just looked in the 2.6.37 code and the fix is not there. It is in the 2.6.37 linus tree.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mmc/core/mmc.c;h=16006ef153fe081c2f0f0a09cd4443ce7f3c49a1;hb=a25cecce88194b2edf38b8c3b1665e9318eb2d22

Chris Ball who maintains this should know when it will be pushed upwards.

Philip

Quoted 27 lines · Tomoya MORINAGA

Hi Philip,

Quoted 3 lines · Philip Rakity

Thanks very much, I'll plan on sending this to Linus tomorrow, along with the rest of my .37 queue, unless there are any more review comments from anyone.

We tried to use the MMC card like the following on kernel-2.6.37.

Quoted 9 lines · Tomoya MORINAGA

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub).
The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card). The card is 1 bit bus width. And the card is according to MMC specification V3.x.
And the EG20T has a 4 bit bus width capability Linux MMC standard driver decides the card bus width as 4 bit, if the MMC specification version is larger than or equal to V4.0 like below.

However it seems the issue remains to be seen. Have you fixed the MMC unrecognized issue in kernel-2.6.37?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#9 lore raw

Hi Chris,

Quoted 9 lines · Philip Rakity

I just looked in the 2.6.37 code and the fix is not there. It is in the 2.6.37 linus tree.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.g
it;a=blob;f=drivers/mmc/core/mmc.c;h=16006ef153fe081c2f0f0a09c d4443ce7f3c49a1;hb=a25cecce88194b2edf38b8c3b1665e9318eb2d22

Chris Ball who maintains this should know when it will be pushed upwards.

Do you know when the above patch will be integrated to kernel ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#10 lore raw
Quoted 9 lines · Tomoya MORINAGA
Quoted 6 lines · Philip Rakity

I just looked in the 2.6.37 code and the fix is not there. It is in the 2.6.37 linus tree.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.g
it;a=blob;f=drivers/mmc/core/mmc.c;h=16006ef153fe081c2f0f0a09c d4443ce7f3c49a1;hb=a25cecce88194b2edf38b8c3b1665e9318eb2d22

Do you know when the above patch will be integrated to kernel ?

I don't understand, sorry. The link is to a file, not a patch, and Philip's statement above talks about a patch being in 2.6.37 but not being in 2.6.37, which I don't understand either.

Looking back farther in the thread, I think you're both talking about:
http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commit;h=15ec44611904be0dcc97b84c29fbf964e5e2b36f

This patch was merged into Linus' 2.6.37-rc4 on Nov 27 2010, and released as part of 2.6.37.

Can you elaborate on your question, if it's still outstanding?

Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#11 lore raw

Chris,

transcend card is 1 bit card. Requires bus_width patches.

Philip

Quoted 28 lines · Chris Ball
Quoted 9 lines · Tomoya MORINAGA
Quoted 6 lines · Philip Rakity

I just looked in the 2.6.37 code and the fix is not there. It is in the 2.6.37 linus tree.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.g
it;a=blob;f=drivers/mmc/core/mmc.c;h=16006ef153fe081c2f0f0a09c d4443ce7f3c49a1;hb=a25cecce88194b2edf38b8c3b1665e9318eb2d22

Do you know when the above patch will be integrated to kernel ?

I don't understand, sorry. The link is to a file, not a patch, and Philip's statement above talks about a patch being in 2.6.37 but not being in 2.6.37, which I don't understand either.

Looking back farther in the thread, I think you're both talking about:
http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commit;h=15ec44611904be0dcc97b84c29fbf964e5e2b36f

This patch was merged into Linus' 2.6.37-rc4 on Nov 27 2010, and released as part of 2.6.37.

Can you elaborate on your question, if it's still outstanding?

Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
Tested-by Reviewed-by Chris Ball
#12 lore raw
In reply to a message not in the archive

For 1 bit transcend cards you need these 2 patches.

Quoted 1 line

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001

From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Some old MMC devices fail with the 4/8 bits the driver tries to use exclusively. This patch adds a test for the given bus setup and falls back to the lower bit mode (until 1-bit mode) when the test fails.

[Major rework and refactoring by tiwai]
[Quirk addition and many fixes by prakity]

---
 drivers/mmc/core/mmc.c     |   76 ++++++++++++++++++++-------------
 drivers/mmc/core/mmc_ops.c |  101 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/core/mmc_ops.h |    1 +
 drivers/mmc/host/sdhci.c   |    7 +++-
 drivers/mmc/host/sdhci.h   |    1 +
 include/linux/mmc/host.h   |    1 +
 include/linux/mmc/mmc.h    |    2 +
 7 files changed, 159 insertions(+), 30 deletions(-)
drivers/mmc/core/mmc.c +47 -29
index 76bb621..1d8409f 100644
@@ -534,39 +534,57 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 */
 	if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
 	    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
-		unsigned ext_csd_bit, bus_width;
-
-		if (host->caps & MMC_CAP_8_BIT_DATA) {
-			if (ddr)
-				ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_8;
-			else
-				ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
-			bus_width = MMC_BUS_WIDTH_8;
-		} else {
-			if (ddr)
-				ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_4;
-			else
-				ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
-			bus_width = MMC_BUS_WIDTH_4;
+		static unsigned ext_csd_bits[][2] = {
+			{ EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 },
+			{ EXT_CSD_BUS_WIDTH_4, EXT_CSD_DDR_BUS_WIDTH_4 },
+			{ EXT_CSD_BUS_WIDTH_1, EXT_CSD_BUS_WIDTH_1 },
+		};
+		static unsigned bus_widths[] = {
+			MMC_BUS_WIDTH_8,
+			MMC_BUS_WIDTH_4,
+			MMC_BUS_WIDTH_1
+		};
+		unsigned idx, bus_width = 0;
+
+		if (host->caps & MMC_CAP_8_BIT_DATA)
+			idx = 0;
+		else
+			idx = 1;
+		for (; idx < ARRAY_SIZE(bus_widths); idx++) {
+			bus_width = bus_widths[idx];
+			if (bus_width == MMC_BUS_WIDTH_1)
+				ddr = 0; /* no DDR for 1-bit width */
+			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+					 EXT_CSD_BUS_WIDTH,
+					 ext_csd_bits[idx][0]);
+			if (!err) {
+				/*
+				 * If controller can't handle bus width test,
+				 * use the highest bus width to maintain
+				 * compatibility with previous MMC behavior.
+				 */
+				if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST))
+					break;
+				mmc_set_bus_width_ddr(card->host,
+						      bus_width, MMC_SDR_MODE);
+				err = mmc_bus_test(card, bus_width);
+				if (!err)
+					break;
+			}
 		}
 
-		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-				 EXT_CSD_BUS_WIDTH, ext_csd_bit);
-
-		if (err && err != -EBADMSG)
-			goto free_card;
-
+		if (!err && ddr) {
+			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+					EXT_CSD_BUS_WIDTH,
+					ext_csd_bits[idx][1]);
+		}
 		if (err) {
 			printk(KERN_WARNING "%s: switch to bus width %d ddr %d "
-			       "failed\n", mmc_hostname(card->host),
-			       1 << bus_width, ddr);
-			err = 0;
-		} else {
-			if (ddr)
-				mmc_card_set_ddr_mode(card);
-			else
-				ddr = MMC_SDR_MODE;
-
+				"failed\n", mmc_hostname(card->host),
+				1 << bus_width, ddr);
+			goto free_card;
+		} else if (ddr) {
+			mmc_card_set_ddr_mode(card);
 			mmc_set_bus_width_ddr(card->host, bus_width, ddr);
 		}
 	}
drivers/mmc/core/mmc_ops.c +101 -0

104 lines not on this page · raw message

drivers/mmc/core/mmc_ops.h +1 -0
index 653eb8e..e6d44b8 100644
@@ -26,6 +26,7 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid);
 int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
 int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
 int mmc_card_sleepawake(struct mmc_host *host, int sleep);
+int mmc_bus_test(struct mmc_card *card, u8 bus_width);
 
 #endif
 
drivers/mmc/host/sdhci.c +6 -1
index 5569886..d5febe5 100644
@@ -23,6 +23,7 @@
 
 #include <linux/leds.h>
 
+#include <linux/mmc/mmc.h>
 #include <linux/mmc/host.h>
 
 #include "sdhci.h"
@@ -1521,7 +1522,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 
 	if (intmask & SDHCI_INT_DATA_TIMEOUT)
 		host->data->error = -ETIMEDOUT;
-	else if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT))
+	else if (intmask & SDHCI_INT_DATA_END_BIT)
+		host->data->error = -EILSEQ;
+	else if ((intmask & SDHCI_INT_DATA_CRC) &&
+		SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))
+			!= MMC_BUS_TEST_R)
 		host->data->error = -EILSEQ;
 	else if (intmask & SDHCI_INT_ADMA_ERROR) {
 		printk(KERN_ERR "%s: ADMA error\n", mmc_hostname(host->mmc));
drivers/mmc/host/sdhci.h +1 -0
index 1efe7dc..6e0969e 100644
@@ -52,6 +52,7 @@
 #define  SDHCI_CMD_RESP_SHORT_BUSY 0x03
 
 #define SDHCI_MAKE_CMD(c, f) (((c & 0xff) << 8) | (f & 0xff))
+#define SDHCI_GET_CMD(c) ((c>>8) & 0x3f)
 
 #define SDHCI_RESPONSE		0x10
 
include/linux/mmc/host.h +1 -0
index 3a85e73..bcb793e 100644
@@ -172,6 +172,7 @@ struct mmc_host {
 #define MMC_CAP_1_2V_DDR	(1 << 12)	/* can support */
 						/* DDR mode at 1.2V */
 #define MMC_CAP_POWER_OFF_CARD	(1 << 13)	/* Can power off after boot */
+#define MMC_CAP_BUS_WIDTH_TEST	(1 << 14)	/* CMD14/CMD19 bus width ok */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
include/linux/mmc/mmc.h +2 -0
index 956fbd87..612301f 100644
@@ -40,7 +40,9 @@
 #define MMC_READ_DAT_UNTIL_STOP  11   /* adtc [31:0] dadr        R1  */
 #define MMC_STOP_TRANSMISSION    12   /* ac                      R1b */
 #define MMC_SEND_STATUS          13   /* ac   [31:16] RCA        R1  */
+#define MMC_BUS_TEST_R           14   /* adtc                    R1  */
 #define MMC_GO_INACTIVE_STATE    15   /* ac   [31:16] RCA            */
+#define MMC_BUS_TEST_W           19   /* adtc                    R1  */
 #define MMC_SPI_READ_OCR         58   /* spi                  spi_R3 */
 #define MMC_SPI_CRC_ON_OFF       59   /* spi  [0:0] flag      spi_R1 */
 
Signature · 1 line
1.7.3.5
Quoted 1 line

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

With the bus-width test patch, mmc_set_bus_width*() isn't called properly when the driver doesn't set MMC_CAP_BUS_WIDTH and no DDR mode. This patch fixes the regression by moving the call up before the cap test.

---
 drivers/mmc/core/mmc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/mmc.c +2 -2
index 1d8409f..c86dd73 100644
@@ -558,6 +558,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 					 EXT_CSD_BUS_WIDTH,
 					 ext_csd_bits[idx][0]);
 			if (!err) {
+				mmc_set_bus_width_ddr(card->host,
+						      bus_width, MMC_SDR_MODE);
 				/*
 				 * If controller can't handle bus width test,
 				 * use the highest bus width to maintain
@@ -565,8 +567,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 				 */
 				if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST))
 					break;
-				mmc_set_bus_width_ddr(card->host,
-						      bus_width, MMC_SDR_MODE);
 				err = mmc_bus_test(card, bus_width);
 				if (!err)
 					break;
Signature · 1 line
1.7.3.5
Quoted 27 lines · Tomoya MORINAGA

Hi Philip,

Quoted 3 lines · Philip Rakity

Thanks very much, I'll plan on sending this to Linus tomorrow, along with the rest of my .37 queue, unless there are any more review comments from anyone.

We tried to use the MMC card like the following on kernel-2.6.37.

Quoted 9 lines · Tomoya MORINAGA

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub).
The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card). The card is 1 bit bus width. And the card is according to MMC specification V3.x.
And the EG20T has a 4 bit bus width capability Linux MMC standard driver decides the card bus width as 4 bit, if the MMC specification version is larger than or equal to V4.0 like below.

However it seems the issue remains to be seen. Have you fixed the MMC unrecognized issue in kernel-2.6.37?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#13 lore raw

Hi Philip, Chris

Quoted 1 line

For 1 bit transcend cards you need these 2 patches.

Thank you for your information.
It seems these patches aren't applied for kernel-2.6.37, right ?

Will you apply these patches for kernel-2.6.38?

BTW, I attached dmesg log when inserts MMC card with kernel-2.6.37.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 434 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Wednesday, January 19, 2011 3:05 PM
To: Tomoya MORINAGA
Cc: Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

For 1 bit transcend cards you need these 2 patches.

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001
From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Some old MMC devices fail with the 4/8 bits the driver tries to use exclusively. This patch adds a test for the given bus setup and falls back to the lower bit mode (until 1-bit mode) when the test fails.

[Major rework and refactoring by tiwai]
[Quirk addition and many fixes by prakity]

---
 drivers/mmc/core/mmc.c     |   76 ++++++++++++++++++++-------------
 drivers/mmc/core/mmc_ops.c |  101 
++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/core/mmc_ops.h |    1 +
 drivers/mmc/host/sdhci.c   |    7 +++-
 drivers/mmc/host/sdhci.h   |    1 +
 include/linux/mmc/host.h   |    1 +
 include/linux/mmc/mmc.h    |    2 +
 7 files changed, 159 insertions(+), 30 deletions(-)
drivers/mmc/core/mmc.c +28 -14
index 76bb621..1d8409f 100644
@@ -534,39 +534,57 @@ static int mmc_init_card(struct 
 mmc_host *host, u32 ocr,
 	 */
 	if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
 	    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
-		unsigned ext_csd_bit, bus_width;
-
-		if (host->caps & MMC_CAP_8_BIT_DATA) {
-			if (ddr)
-				ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_8;
-			else
-				ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
-			bus_width = MMC_BUS_WIDTH_8;
-		} else {
-			if (ddr)
-				ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_4;
-			else
-				ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
-			bus_width = MMC_BUS_WIDTH_4;
+		static unsigned ext_csd_bits[][2] = {
+			{ EXT_CSD_BUS_WIDTH_8, 
 EXT_CSD_DDR_BUS_WIDTH_8 },
+			{ EXT_CSD_BUS_WIDTH_4, 
 EXT_CSD_DDR_BUS_WIDTH_4 },
+			{ EXT_CSD_BUS_WIDTH_1, EXT_CSD_BUS_WIDTH_1 },
+		};
+		static unsigned bus_widths[] = {
+			MMC_BUS_WIDTH_8,
+			MMC_BUS_WIDTH_4,
+			MMC_BUS_WIDTH_1
+		};
+		unsigned idx, bus_width = 0;
+
+		if (host->caps & MMC_CAP_8_BIT_DATA)
+			idx = 0;
+		else
+			idx = 1;
+		for (; idx < ARRAY_SIZE(bus_widths); idx++) {
+			bus_width = bus_widths[idx];
+			if (bus_width == MMC_BUS_WIDTH_1)
+				ddr = 0; /* no DDR for 1-bit width */
+			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+					 EXT_CSD_BUS_WIDTH,
+					 ext_csd_bits[idx][0]);
+			if (!err) {
+				/*
+				 * If controller can't handle 
 bus width test,
+				 * use the highest bus width to maintain
+				 * compatibility with previous 

MMC behavior.

drivers/mmc/core/mmc.c +2 -0
+				 */
+				if (!(host->caps & 

MMC_CAP_BUS_WIDTH_TEST))

drivers/mmc/core/mmc.c +3 -0
+					break;
+				mmc_set_bus_width_ddr(card->host,
+						      

bus_width, MMC_SDR_MODE);

drivers/mmc/core/mmc.c +9 -6
+				err = mmc_bus_test(card, bus_width);
+				if (!err)
+					break;
+			}
 		}
 
-		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-				 EXT_CSD_BUS_WIDTH, ext_csd_bit);
-
-		if (err && err != -EBADMSG)
-			goto free_card;
-
+		if (!err && ddr) {
+			err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+					EXT_CSD_BUS_WIDTH,
+					ext_csd_bits[idx][1]);
+		}
 		if (err) {
 			printk(KERN_WARNING "%s: switch to bus 

width %d ddr %d "

drivers/mmc/core/mmc.c +5 -9
-			       "failed\n", mmc_hostname(card->host),
-			       1 << bus_width, ddr);
-			err = 0;
-		} else {
-			if (ddr)
-				mmc_card_set_ddr_mode(card);
-			else
-				ddr = MMC_SDR_MODE;
-
+				"failed\n", mmc_hostname(card->host),
+				1 << bus_width, ddr);
+			goto free_card;
+		} else if (ddr) {
+			mmc_card_set_ddr_mode(card);
 			mmc_set_bus_width_ddr(card->host, 

bus_width, ddr);

drivers/mmc/core/mmc.c +0 -0
 		}
 	}
(quoted diff) +0 -0

b/drivers/mmc/core/mmc_ops.c index 326447c..60842f8 100644

drivers/mmc/core/mmc_ops.c +2 -0
@@ -462,3 +462,104 @@ int mmc_send_status(struct mmc_card 
 *card, u32 *status)
 	return 0;
 }
 
+static int
+mmc_send_bus_test(struct mmc_card *card, struct mmc_host 

*host, u8 opcode,

drivers/mmc/core/mmc_ops.c +44 -0
+		  u8 len)
+{
+	struct mmc_request mrq;
+	struct mmc_command cmd;
+	struct mmc_data data;
+	struct scatterlist sg;
+	u8 *data_buf;
+	u8 *test_buf;
+	int i, err;
+	static u8 testdata_8bit[8] = { 0x55, 0xaa, 0, 0, 0, 0, 0, 0 };
+	static u8 testdata_4bit[4] = { 0x5a, 0, 0, 0 };
+
+	/* dma onto stack is unsafe/nonportable, but callers to this
+	 * routine normally provide temporary on-stack buffers ...
+	 */
+	data_buf = kmalloc(len, GFP_KERNEL);
+	if (!data_buf)
+		return -ENOMEM;
+
+	if (len == 8)
+		test_buf = testdata_8bit;
+	else if (len == 4)
+		test_buf = testdata_4bit;
+	else {
+		printk(KERN_ERR "%s: Invalid bus_width %d\n",
+		       mmc_hostname(host), len);
+		kfree(data_buf);
+		return -EINVAL;
+	}
+
+	if (opcode == MMC_BUS_TEST_W)
+		memcpy(data_buf, test_buf, len);
+
+	memset(&mrq, 0, sizeof(struct mmc_request));
+	memset(&cmd, 0, sizeof(struct mmc_command));
+	memset(&data, 0, sizeof(struct mmc_data));
+
+	mrq.cmd = &cmd;
+	mrq.data = &data;
+	cmd.opcode = opcode;
+	cmd.arg = 0;
+
+	/* NOTE HACK:  the MMC_RSP_SPI_R1 is always correct here, but we
+	 * rely on callers to never use this with "native" 

calls for reading

drivers/mmc/core/mmc_ops.c +1 -0
+	 * CSD or CID.  Native versions of those commands use 

the R2 type,

drivers/mmc/core/mmc_ops.c +51 -0
+	 * not R1 plus a data block.
+	 */
+	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
+
+	data.blksz = len;
+	data.blocks = 1;
+	if (opcode == MMC_BUS_TEST_R)
+		data.flags = MMC_DATA_READ;
+	else
+		data.flags = MMC_DATA_WRITE;
+
+	data.sg = &sg;
+	data.sg_len = 1;
+	sg_init_one(&sg, data_buf, len);
+	mmc_wait_for_req(host, &mrq);
+	err = 0;
+	if (opcode == MMC_BUS_TEST_R) {
+		for (i = 0; i < len / 4; i++)
+			if ((test_buf[i] ^ data_buf[i]) != 0xff) {
+				err = -EIO;
+				break;
+			}
+	}
+	kfree(data_buf);
+
+	if (cmd.error)
+		return cmd.error;
+	if (data.error)
+		return data.error;
+
+	return err;
+}
+
+int mmc_bus_test(struct mmc_card *card, u8 bus_width) {
+	int err, width;
+
+	if (bus_width == MMC_BUS_WIDTH_8)
+		width = 8;
+	else if (bus_width == MMC_BUS_WIDTH_4)
+		width = 4;
+	else if (bus_width == MMC_BUS_WIDTH_1)
+		return 0; /* no need for test */
+	else
+		return -EINVAL;
+
+	/*
+	 * Ignore errors from BUS_TEST_W.  BUS_TEST_R will fail if there
+	 * is a problem.  This improves chances that the test will work.
+	 */
+	mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width);
+	err = mmc_send_bus_test(card, card->host, 

MMC_BUS_TEST_R, width);

drivers/mmc/core/mmc_ops.c +2 -0
+	return err;
+}
(quoted diff) +0 -0

b/drivers/mmc/core/mmc_ops.h index 653eb8e..e6d44b8 100644

drivers/mmc/core/mmc_ops.h +0 -0
@@ -26,6 +26,7 @@ int mmc_send_cid(struct mmc_host *host, u32 
 *cid);  int mmc_spi_read_ocr(struct mmc_host *host, int 

highcap, u32 *ocrp); int mmc_spi_set_crc(struct mmc_host *host, int use_crc); int mmc_card_sleepawake(struct mmc_host *host, int sleep);

drivers/mmc/core/mmc_ops.h +1 -0
+int mmc_bus_test(struct mmc_card *card, u8 bus_width);
 
 #endif
(quoted diff) +0 -0

b/drivers/mmc/host/sdhci.c index 5569886..d5febe5 100644

drivers/mmc/host/sdhci.c +6 -1
@@ -23,6 +23,7 @@
 
 #include <linux/leds.h>
 
+#include <linux/mmc/mmc.h>
 #include <linux/mmc/host.h>
 
 #include "sdhci.h"
@@ -1521,7 +1522,11 @@ static void sdhci_data_irq(struct 
 sdhci_host *host, u32 intmask)
 
 	if (intmask & SDHCI_INT_DATA_TIMEOUT)
 		host->data->error = -ETIMEDOUT;
-	else if (intmask & (SDHCI_INT_DATA_CRC | 
 SDHCI_INT_DATA_END_BIT))
+	else if (intmask & SDHCI_INT_DATA_END_BIT)
+		host->data->error = -EILSEQ;
+	else if ((intmask & SDHCI_INT_DATA_CRC) &&
+		SDHCI_GET_CMD(sdhci_readw(host, SDHCI_COMMAND))
+			!= MMC_BUS_TEST_R)
 		host->data->error = -EILSEQ;
drivers/mmc/host/sdhci.c +0 -0
 	else if (intmask & SDHCI_INT_ADMA_ERROR) {
 		printk(KERN_ERR "%s: ADMA error\n", 

mmc_hostname(host->mmc)); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 1efe7dc..6e0969e 100644

drivers/mmc/host/sdhci.h +1 -0
@@ -52,6 +52,7 @@
 #define  SDHCI_CMD_RESP_SHORT_BUSY 0x03
 
 #define SDHCI_MAKE_CMD(c, f) (((c & 0xff) << 8) | (f & 0xff))
+#define SDHCI_GET_CMD(c) ((c>>8) & 0x3f)
 
 #define SDHCI_RESPONSE		0x10
 
(quoted diff) +0 -0

b/include/linux/mmc/host.h index 3a85e73..bcb793e 100644

include/linux/mmc/host.h +0 -0
@@ -172,6 +172,7 @@ struct mmc_host {
 #define MMC_CAP_1_2V_DDR	(1 << 12)	/* can support */
 						/* DDR mode at 1.2V */
 #define MMC_CAP_POWER_OFF_CARD	(1 << 13)	/* Can 

power off after boot */
+#define MMC_CAP_BUS_WIDTH_TEST (1 << 14) /*
CMD14/CMD19 bus width ok */

mmc_pm_flag_t pm_caps; /* supported pm
features */

(quoted diff) +0 -0

b/include/linux/mmc/mmc.h index 956fbd87..612301f 100644

include/linux/mmc/mmc.h +2 -1
@@ -40,7 +40,9 @@
 #define MMC_READ_DAT_UNTIL_STOP  11   /* adtc [31:0] dadr    
    R1  */
 #define MMC_STOP_TRANSMISSION    12   /* ac                  
    R1b */
 #define MMC_SEND_STATUS          13   /* ac   [31:16] RCA    
    R1  */
+#define MMC_BUS_TEST_R           14   /* adtc                
    R1  */
 #define MMC_GO_INACTIVE_STATE    15   /* ac   [31:16] RCA    
        */
+#define MMC_BUS_TEST_W           19   /* adtc                
    R1  */
 #define MMC_SPI_READ_OCR         58   /* spi                 
 spi_R3 */
 #define MMC_SPI_CRC_ON_OFF       59   /* spi  [0:0] flag     
 spi_R1 */
 
--

1.7.3.5

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

With the bus-width test patch, mmc_set_bus_width*() isn't called properly
when the driver doesn't set MMC_CAP_BUS_WIDTH and no DDR mode. This patch fixes the regression by moving the call up before the cap test.

---
 drivers/mmc/core/mmc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/mmc.c +2 -0
index 1d8409f..c86dd73 100644
@@ -558,6 +558,8 @@ static int mmc_init_card(struct mmc_host 
 *host, u32 ocr,
 					 EXT_CSD_BUS_WIDTH,
 					 ext_csd_bits[idx][0]);
 			if (!err) {
+				mmc_set_bus_width_ddr(card->host,
+						      
 bus_width, MMC_SDR_MODE);
 				/*

* If controller can't handle
bus width test,

drivers/mmc/core/mmc.c +0 -2
 				 * use the highest bus width to maintain
@@ -565,8 +567,6 @@ static int mmc_init_card(struct mmc_host 
 *host, u32 ocr,
 				 */
 				if (!(host->caps & 
 MMC_CAP_BUS_WIDTH_TEST))
 					break;
-				mmc_set_bus_width_ddr(card->host,
-						      
 bus_width, MMC_SDR_MODE);
drivers/mmc/core/mmc.c +0 -0
 				err = mmc_bus_test(card, bus_width);
 				if (!err)
 					break;
Signature · 1 line
1.7.3.5
Quoted 4 lines · Tomoya MORINAGA

Hi Philip,

Quoted 1 line · Philip Rakity

Thanks very much, I'll plan on sending this to Linus

tomorrow, along

Quoted 15 lines
Quoted 2 lines

with the rest of my .37 queue, unless there are any more review comments from anyone.

We tried to use the MMC card like the following on kernel-2.6.37.

Quoted 9 lines · Tomoya MORINAGA

I am facing the issue about some MMC cards on Intel EG20T PCH (Platform Controller Hub).
The linux version is 2.6.36.
I can not transfer data the MMC cards (e.g. Transcned MMC card). The card is 1 bit bus width. And the card is according to MMC specification V3.x.
And the EG20T has a 4 bit bus width capability Linux MMC standard driver decides the card bus width as 4 bit, if the MMC specification version is larger than or equal to V4.0

like below.

Quoted 8 lines

However it seems the issue remains to be seen. Have you fixed the MMC unrecognized issue in kernel-2.6.37?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#14 lore raw
In reply to Philip Rakity

Hi,

Quoted 7 lines · Philip Rakity

For 1 bit transcend cards you need these 2 patches.

Quoted 1 line

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001

From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Present in 2.6.38-rc1.

Quoted 4 lines
Quoted 1 line

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

Also present in 2.6.38-rc1.

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#15 lore raw

Hi Chris,

Thank you for your information.
We will test using 2.6.38-rc1 and report to you.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 39 lines

-----Original Message-----
From: Chris Ball [mailto:[email protected]]
Sent: Thursday, January 20, 2011 2:43 AM
To: Philip Rakity
Cc: Tomoya MORINAGA; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

Hi,

Quoted 8 lines · Philip Rakity

For 1 bit transcend cards you need these 2 patches.

Quoted 2 lines

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001

From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Present in 2.6.38-rc1.

Quoted 6 lines
Quoted 2 lines

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

Also present in 2.6.38-rc1.

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#16 lore raw
In reply to Chris Ball

On Thursday, January 20, 2011 2:43 AM, Chris Ball wrote

Quoted 2 lines

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

I have tested the latest "2.6.38-rc2".
However, the issue remains to be seen.

Thanks in advance,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 39 lines

-----Original Message-----
From: Chris Ball [mailto:[email protected]]
Sent: Thursday, January 20, 2011 2:43 AM
To: Philip Rakity
Cc: Tomoya MORINAGA; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

Hi,

Quoted 8 lines · Philip Rakity

For 1 bit transcend cards you need these 2 patches.

Quoted 2 lines

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001

From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Present in 2.6.38-rc1.

Quoted 6 lines
Quoted 2 lines

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

Also present in 2.6.38-rc1.

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#17 lore raw

Did you define the CAP for BUS WIDTH ?

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Philip

Quoted 51 lines · Tomoya MORINAGA

On Thursday, January 20, 2011 2:43 AM, Chris Ball wrote

Quoted 2 lines

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

I have tested the latest "2.6.38-rc2".
However, the issue remains to be seen.

Thanks in advance,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 39 lines

-----Original Message-----
From: Chris Ball [mailto:[email protected]]
Sent: Thursday, January 20, 2011 2:43 AM
To: Philip Rakity
Cc: Tomoya MORINAGA; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

Hi,

Quoted 8 lines · Philip Rakity

For 1 bit transcend cards you need these 2 patches.

Quoted 2 lines

From 22113efd00491310da802f3b1a9a66cfcf415fac Mon Sep 17 00:00:00 2001

From: Aries Lee <[email protected]>
Date: Wed, 15 Dec 2010 08:14:24 +0100
Subject: [PATCH] mmc: Test bus-width for old MMC devices

Present in 2.6.38-rc1.

Quoted 6 lines
Quoted 2 lines

From 08c82dfad2458f8f9b83126224a85e7ea9e2b046 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Wed, 22 Dec 2010 09:59:44 +0100
Subject: [PATCH] mmc: fix mmc_set_bus_width_ddr() call without bus-width-test cap

Also present in 2.6.38-rc1.

So, please re-test against 2.6.38-rc1 and let us know whether you still have problems. Thanks,

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#18 lore raw

Hi Philip,

Quoted 5 lines · Philip Rakity

Did you define the CAP for BUS WIDTH ?

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code "drivers/mmc" at all Is the above mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#19 lore raw

yes

you need to have the driver or the low level code enable this QUIRK.

which mmc driver are you using.

Quoted 19 lines · Tomoya MORINAGA

Hi Philip,

Quoted 5 lines · Philip Rakity

Did you define the CAP for BUS WIDTH ?

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code "drivers/mmc" at all Is the above mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#20 lore raw

Hi Philip,

Quoted 1 line

which MMC driver are you using.

Could you teach me how to get the information ?

Quoted 1 line

you need to have the driver or the low level code enable this QUIRK.

BTW, Is the above permanent treatment?
I think modifying kernel source code isn't preferred.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 38 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:04 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

yes

you need to have the driver or the low level code enable this QUIRK.

which mmc driver are you using.

Quoted 19 lines · Tomoya MORINAGA

Hi Philip,

Quoted 5 lines · Philip Rakity

Did you define the CAP for BUS WIDTH ?

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code "drivers/mmc" at all Is the above mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#21 lore raw

There is no good answer.

Doing this patch for 2.6.20 or so a long time ago had problems because some controllers did not work. The failures were equally unpleasant.

The failure you see today is at least not a regression since 1 bit did not work before.

We hope that developers who know their h/w works add the CAP.

Quoted 53 lines · Tomoya MORINAGA

Hi Philip,

Quoted 1 line

which MMC driver are you using.

Could you teach me how to get the information ?

Quoted 1 line

you need to have the driver or the low level code enable this QUIRK.

BTW, Is the above permanent treatment?
I think modifying kernel source code isn't preferred.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 38 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:04 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

yes

you need to have the driver or the low level code enable this QUIRK.

which mmc driver are you using.

Quoted 19 lines · Tomoya MORINAGA

Hi Philip,

Quoted 5 lines · Philip Rakity

Did you define the CAP for BUS WIDTH ?

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code "drivers/mmc" at all Is the above mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

#22 lore raw

Hi Philip,

Quoted 1 line

which MMC driver are you using.

According to boot message, it seems sdhci.c is loaded.

Do I add only "mmc->caps |= MMC_CAP_BUS_WIDTH_TEST" in sdhc.c ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 82 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:44 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]; Toshiharu Okada
Subject: Re: A MMC card transfer issue

There is no good answer.

Doing this patch for 2.6.20 or so a long time ago had problems because some controllers did not work. The failures were equally unpleasant.

The failure you see today is at least not a regression since 1 bit did not work before.

We hope that developers who know their h/w works add the CAP.

Quoted 6 lines · Tomoya MORINAGA

Hi Philip,

Quoted 1 line

which MMC driver are you using.

Could you teach me how to get the information ?

Quoted 1 line

you need to have the driver or the low level code enable

this QUIRK.

Quoted 21 lines

BTW, Is the above permanent treatment?
I think modifying kernel source code isn't preferred.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 13 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:04 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: A MMC card transfer issue

yes

you need to have the driver or the low level code enable

this QUIRK.

Quoted 10 lines
Quoted 10 lines

which mmc driver are you using.

Quoted 5 lines · Tomoya MORINAGA

Hi Philip,

Quoted 2 lines · Philip Rakity

Did you define the CAP for BUS WIDTH ?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code "drivers/mmc" at all Is

the above

Quoted 9 lines
Quoted 8 lines
Quoted 7 lines

mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): AF584C10-A796-4 3 5 [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#35 lore raw

Nico,

Need some advice on how to solve a problem with mmc. Some background

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

mmc cards have NO card specific data field to say the bus width that is supported. SD cards have this field.

The only way to know what width a mmc card supports is to probe the card sending CMD14/CMD19. (JEDEC standard 84- A441).

In my system with the mods we made we can detect all mmc
cards correctly. The CMD14/CMD19 does not work correctly on Tomoya's system.

The CMD14/CMD19 times out. (see below) The CMD14/CMD19 works on multiple Marvell SoC chips, Tomoya's uses a PCI controller.

The transcend mmc card does not have the PHYSICAL pins for 4 bit mode; only 1 bit can be supported.

Testing the bus width is the recommend way to find out the bus width. The current behavior when the QUIRK is not defined is to default to 4 bit mode (same as has been done historically).

The only way to guarantee that cards really do work would be to default to 1 bit mode but this has a 4x performance degradation.

One possible solution would be to try to do a test read operation on the mmc card if the bus test failed and see if there is an error. In this case change the bus width to 1 bit.

a) Do you think this is a good idea? --
b) How to plumb it in ? -- can you sketch something out and I will try to implement it.

regards,

Philip

Quoted 498 lines · Philip Rakity
Quoted 9 lines · Tomoya MORINAGA

Hi Philip,

Quoted 5 lines

The only way to know what width a mmc card supports is to probe the card sending CMD14/CMD19. (JEDEC standard 84- A441).

In my system with the mods we made we can detect all mmc cards correctly..

What's your system ? Linux ?

linux -- 4 different Marvell SoC chips. Running linux-next. SD Host cotnroler
supports SD2.0 and now SD 3.0 specs.

Quoted 10 lines
Quoted 4 lines

The current code without BUS_WIDTH QUIRK defined -- breaks the transcend card in 1 bit mode but allows 4 bit cards to work. do you agree ?

Yes,
Currently, since MMC driver works as 4-bit mode,
MMC-v4-1bit doesn't work.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

I do not know how to fix the problem in any other way...

possible choices are like below, I think.
1. always going into 1 bit mode (Like Windows)
2. As mentioned previous my mail, support 1-bit mode option by kernel configuration.

Propose patch for this or we could extend existing QUIRK or CAP for 1 bit mode will look in the morning.

Quoted 1 line

3. Not support like the 1bit-MMC card (current spec)

In some systems.

The good news is that the transcend card IS REALLY STRANGE ! and quite an EXCEPTION. The bad news is things don't work all the time. Let me think how we could go into 1 bit mode. Let me post something to the mmc/ list on this -- Nico has good good ideas on how to do things like this in the mmc/core layer.

Philip

Quoted 449 lines

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 442 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Monday, January 31, 2011 6:49 AM
To: Tomoya MORINAGA
Cc: Toshiharu Okada; Manabu Miyata; Takahiro Shimizu
Subject: Re: A MMC card transfer issue

Back to the beginning ..

We also discovered that having a SD controller that supports 8 bit data and a board design that does not -- does not all the 8 bit card to work at full speed.
Using the controller values is not sufficient.

We discovered that the transcend 1 bit card does not work in linux. The transcend mmc card does NOT have the electrical pins to support 4 bit mode --- compare the card against some other SD cards you have and you will see the missing pins.

mmc cards have NO card specific data field to say the bus width that is supported. SD cards have this field.

The only way to know what width a mmc card supports is to probe the card sending CMD14/CMD19. (JEDEC standard 84- A441).

In my system with the mods we made we can detect all mmc cards correctly..

I understand it does not work on your system.

The current code without BUS_WIDTH QUIRK defined -- breaks the transcend card in 1 bit mode but allows 4 bit cards to work. do you agree ?

I do not believe the code worked before the bus width test otherwise I would not have seen to problem and we would not have generated any patches.

You could guarantee all mmc cards work with bus_test by always going into 1 bit mode -- but his has a severe performance impact.

I do not know how to fix the problem in any other way...

Any suggestions

Philip

Quoted 12 lines · Philip Rakity
Quoted 6 lines · Tomoya MORINAGA

Hi Philip,

It doesn't detect the 1bit-MMC correctly.

Quoted 1 line

cmd.flags &= ~MSP_RSP_CRC;

BTW, the above is not MSP_RSP_CRC but MMC_RSP_CRC.

My topo

Quoted 2 lines

Root cause is MMC driver can't judge whether the interted

MMC-v4-card is 1-bit or not.

Quoted 5 lines
Quoted 1 line

Thus, I think a user can only set "Use MMC-v4-1bit" or not.

this is why the QUIRK is there.

Quoted 2 lines

Though sent the following last November, How about the

following line

Quoted 3 lines
Quoted 3 lines

valid or invalid with compile option (Kconfig) ?

In fact, invalidating the following line, the MMC-v4-1bit

card can be detected correctly.

Quoted 28 lines

which line ?

The bus width test is needed for 8 bit cards.

Philip

Quoted 21 lines
Quoted 21 lines

linux/drivers/mmc/core/mmc.c

505 /*
506 * Activate wide bus (if supported).
507 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
509 (host->caps & (MMC_CAP_4_BIT_DATA |
MMC_CAP_8_BIT_DATA))) {
510 unsigned ext_csd_bit, bus_width;
511
512 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8;
515 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4;
518 }
519
520 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
521 EXT_CSD_BUS_WIDTH,

ext_csd_bit);

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

522
523 if (err && err != -EBADMSG)
524 goto free_card;
525
526 if (err) {

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

527 printk(KERN_WARNING "%s: switch
to bus width %d "
528 "failed\n",
mmc_hostname(card->host),
529 1 << bus_width);
530 err = 0;
531 } else {
532 mmc_set_bus_width(card->host,

bus_width);

Quoted 18 lines
Quoted 18 lines
Quoted 3 lines

533 }
534 }
535

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 8 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Friday, January 28, 2011 2:28 PM
To: Tomoya MORINAGA
Cc: Toshiharu Okada; Manabu Miyata
Subject: Re: A MMC card transfer issue

Quoted 1 line
Quoted 1 line
Quoted 1 line

The SD controller you are using is broken. It does not

handle bus

Quoted 1 line
Quoted 1 line
Quoted 1 line

width testing (CMD19/CMD14) gives CRC errors. Not sure

now to fix

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

this... or work around it.

It is possible we should define a new RSP type that does

not specify

Quoted 1 line
Quoted 1 line
Quoted 1 line

CRC (this is contained in the RESP_R1 see mmc_ops.c when

doing the

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

send_bus_test().

as a fast hack. add a line after

cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

cmd.flags &= ~MSP_RSP_CRC;

and see what happens.

This is the problem I saw before in 2.6.20 and we could

not figure

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines

out a work around.

Philip

Quoted 17 lines · Tomoya MORINAGA

Hi Philip,

I attached boot log with CONFIG_MMC_DEBUG.

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 8 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Friday, January 28, 2011 9:59 AM
To: Tomoya MORINAGA
Cc: Toshiharu Okada; Manabu Miyata
Subject: Re: A MMC card transfer issue

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ouch

please send complete console log. Want to see what

startup looks

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines

like.

you will need to enable CONFIG_MMC_DEBUG

it is the only way to get a trace from the linux point of view.

PHilip

Quoted 27 lines · Tomoya MORINAGA

Hi Philip,

According to your saying,
I deleted the following 2-lines in drivers/mmc/core/mmc.c

Quoted 2 lines

if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST))

      break;

However, the issue remains to be seen.
I attached the dmesg log.
The error log differs from previous log.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 9 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Friday, January 28, 2011 6:33 AM
To: Tomoya MORINAGA
Cc: Toshiharu Okada; Manabu Miyata
Subject: Re: A MMC card transfer issue

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Are you comfortable just deleting the test for the CAP for

bus width

Quoted 3 lines
Quoted 3 lines

in mmc.c ?

I see you are using PCI and SD -- this is where we

had problems

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

before.

In drivers/mmc/core/mmc.c

change

                      if (!err) {
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

mmc_set_bus_width_ddr(card->host,

bus_width, MMC_SDR_MODE);
/*
* If controller can't handle
bus width test,
* use the highest

bus width to maintain

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

* compatibility with

previous

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

MMC behavior.

                               */
                              if (!(host->caps &
MMC_CAP_BUS_WIDTH_TEST))
                                      break;
                              err =

mmc_bus_test(card, bus_width);

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
                              if (!err)
                                      break;
                      }

to

                      if (!err) {
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

mmc_set_bus_width_ddr(card->host,

bus_width, MMC_SDR_MODE);
#if 0
/*
* If controller can't handle
bus width test,
* use the highest

bus width to maintain

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

* compatibility with

previous

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

MMC behavior.

                               */
                              if (!(host->caps &

MMC_CAP_BUS_WIDTH_TEST))
break; #endif
err =

mmc_bus_test(card, bus_width);

Quoted 64 lines
Quoted 64 lines
Quoted 64 lines
Quoted 51 lines
Quoted 51 lines
Quoted 36 lines
Quoted 36 lines
                              if (!err)
                                      break;
                      }

This will tell us more about what if going on.

Philip

Quoted 25 lines · Tomoya MORINAGA

Hi Philip

Thank you for you help.
I attached my kernel configuration file for 2.6.38-rc2.

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 15 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 12:42 PM
To: Tomoya MORINAGA
Subject: Re: A MMC card transfer issue

Lets go off list.

send me the linux dot_config.

I can go from there.

Philip

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Tomoya MORINAGA
Quoted 7 lines

Hi Philip,

which MMC driver are you using.
According to boot message, it seems sdhci.c is loaded.

Do I add only "mmc->caps |= MMC_CAP_BUS_WIDTH_TEST"

in sdhc.c ?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:44 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park; [email protected];
[email protected];

[email protected];

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

[email protected]; Toshiharu Okada
Subject: Re: A MMC card transfer issue

There is no good answer.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Doing this patch for 2.6.20 or so a long time ago

had problems

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

because some controllers did not work. The failures

were equally

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

unpleasant.

The failure you see today is at least not a

regression since

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

1 bit did not work before.

We hope that developers who know their h/w works add

the CAP.

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

On Jan 26, 2011, at 5:31 PM, Tomoya MORINAGA wrote:

Hi Philip,

which MMC driver are you using.
Could you teach me how to get the information ?

you need to have the driver or the low level code enable
this QUIRK.
BTW, Is the above permanent treatment?
I think modifying kernel source code isn't preferred.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Thursday, January 27, 2011 10:04 AM
To: Tomoya MORINAGA
Cc: Chris Ball; Kyungmin Park;

[email protected];

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 18 lines
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

[email protected];

[email protected];

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

[email protected]
Subject: Re: A MMC card transfer issue

yes

you need to have the driver or the low level code enable
this QUIRK.

which mmc driver are you using.

On Jan 26, 2011, at 5:00 PM, Tomoya MORINAGA wrote:

Hi Philip,

On Thursday, January 27, 2011 12:42 AM, Philip

Quoted 2 lines · Rakity
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Did you define the CAP for BUS WIDTH ?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

MMC_CAP_BUS_WIDTH_TEST

in the driver or the platform driver ?

Let me make the above meaning clear.

I don't modify kernel source code

"drivers/mmc" at all Is

Quoted 21 lines
Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

the above
mean I must modify something kernel source code ?

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

<config.config>

<Transcend_log>

<Transcend_log_debug_on>

#36 lore raw
Quoted 5 lines · Philip Rakity

The transcend mmc card does not have the PHYSICAL pins for 4 bit mode; only 1 bit can be supported.

Testing the bus width is the recommend way to find out the bus width. The current behavior when the QUIRK is not defined is to default to 4 bit mode (same as has been done historically).

Quoted 8 lines

The only way to guarantee that cards really do work would be to default to 1 bit mode but this has a 4x performance degradation.

One possible solution would be to try to do a test read operation on the mmc card if the bus test failed and see if there is an error. In this case change the bus width to 1 bit.

a) Do you think this is a good idea? --
b) How to plumb it in ? -- can you sketch something out and I will try to implement it.

Sure. This is probably a good thing to attempt lowering the bus width on errors. In mmc_request_done() you could attempt switching to a narrower bus width and reattempt the failed command if that command was about some data transfer and the error was -ETIMEDOUT.

Nicolas

#37 lore raw
In reply to Philip Rakity

Hi Philip

Still we can see the issue in 2.6.38(The latest kernel). In 2.6.38, is this issue resolved ?

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 8 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Tuesday, February 01, 2011 1:41 AM
To: Nicolas Pitre
Cc: Tomoya MORINAGA; Toshiharu Okada; Manabu Miyata; Takahiro Shimizu; [email protected]
Subject: Re: A MMC card transfer issue

#38 lore raw

I think the solution is to try to rad the CSD if bus test fails. If CSD read fails then lower bus width until it passes. Not had time to work on this yet. On my list of things to do.
________________________________________
From: Tomoya MORINAGA [[email protected]]
Sent: Tuesday, March 22, 2011 5:31 PM
To: Philip Rakity; 'Nicolas Pitre'
Cc: 'Toshiharu Okada'; [email protected]
Subject: RE: A MMC card transfer issue

Hi Philip

Still we can see the issue in 2.6.38(The latest kernel). In 2.6.38, is this issue resolved ?

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

Quoted 8 lines

-----Original Message-----
From: Philip Rakity [mailto:[email protected]]
Sent: Tuesday, February 01, 2011 1:41 AM
To: Nicolas Pitre
Cc: Tomoya MORINAGA; Toshiharu Okada; Manabu Miyata; Takahiro Shimizu; [email protected]
Subject: Re: A MMC card transfer issue

#39 lore raw

Hi Philip,

Quoted 4 lines · Philip Rakity

I think the solution is to try to rad the CSD if bus test fails. If CSD read fails then lower bus width until it passes. Not had time to work on this yet. On my list of things to do.

OK.
Do you have fixed schedule for this work ?
If yes, let me know the schedule.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.