Bug 871638

Summary: Read errors with Lenovo ThinkPad x220 internal SD Card reader
Product: [Fedora] Fedora Reporter: Yann Droneaud <yann>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: gansalmon, hub+rhbz, itamar, jonathan, jwulf, kernel-maint, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-13 12:21:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
kernel log of mmc errors none

Description Yann Droneaud 2012-10-30 22:46:15 UTC
Created attachment 635845 [details]
kernel log of mmc errors

When trying to read a SD Card (SanDisk Extreme III 2GB), using the internal SD Card reader of a Lenovo ThinkPad x220, I'm getting a lot of errors from MMC reader:

 mmcblk0: response CRC error sending r/w cmd command, card status 0xb00
 mmcblk0: error -84 sending status command, retrying
 mmcblk0: error -84 transferring data, sector 736, nr 1, cmd response 0x900, card status 0x0

Putting the SD Card again in the read doesn't trigger the same errors.
It seems the errors are triggered for the first SD-Card inserted in.


The card read is :

0d:00.0 System peripheral: Ricoh Co Ltd MMC/SD Host Controller (rev 04) (prog-if 01)
        Subsystem: Lenovo Device 21da
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at f1500000 (32-bit, non-prefetchable) [size=256]
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [78] Power Management version 3
        Capabilities: [80] Express Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [800] Advanced Error Reporting
        Kernel driver in use: sdhci-pci

0d:00.0 0880: 1180:e822 (rev 04) (prog-if 01)
        Subsystem: 17aa:21da

boot log:

kernel: [    3.850309] sdhci: Secure Digital Host Controller Interface driver
kernel: [    3.850312] sdhci: Copyright(c) Pierre Ossman
kernel: [    3.850573] sdhci-pci 0000:0d:00.0: >SDHCI controller found [1180:e822] (rev 7)
kernel: [    3.872695] mmc0: SDHCI controller on PCI [0000:0d:00.0] using DMA

Comment 1 Josh Boyer 2013-03-12 19:02:09 UTC
Are you still seeing this with 3.7.9 or 3.8.2 in updates-testing?

Comment 2 Yann Droneaud 2013-03-12 21:33:15 UTC
Tested with kernel 3.8.2, still with Fedora 17 x86_64 on a Lenovo Thinkpad x220

[    0.138036] pci 0000:0d:00.0: [1180:e823] type 00 class 0x088001
[    0.138054] pci 0000:0d:00.0: MMC controller base frequency changed to 50Mhz.
[    0.138079] pci 0000:0d:00.0: reg 10: [mem 0xf1500000-0xf15000ff]
[    0.138271] pci 0000:0d:00.0: supports D1 D2
[    0.138272] pci 0000:0d:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    3.132348] sdhci: Secure Digital Host Controller Interface driver
[    3.132360] sdhci: Copyright(c) Pierre Ossman
[    3.132596] sdhci-pci 0000:0d:00.0: SDHCI controller found [1180:e823] (rev 4)
[    3.161738] mmc0: SDHCI controller on PCI [0000:0d:00.0] using DMA
[  123.553323] mmc0: new high speed SD card at address e624
[  123.563063] mmcblk0: mmc0:e624 SD02G 1.89 GiB 
[  123.565647]  mmcblk0: p1
[  123.834298] SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts
[  175.589278] mmc0: card e624 removed


lspci returns different peripheral identier !?

0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 07) (prog-if 01)
	Subsystem: Lenovo Device 21da
	Flags: bus master, fast devsel, latency 0, IRQ 16
	Memory at f1500000 (32-bit, non-prefetchable) [size=256]
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [78] Power Management version 3
	Capabilities: [80] Express Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [800] Advanced Error Reporting
	Kernel driver in use: sdhci-pci

0d:00.0 0880: 1180:e823 (rev 07) (prog-if 01)
	Subsystem: 17aa:21da
	Flags: bus master, fast devsel, latency 0, IRQ 16
	Memory at f1500000 (32-bit, non-prefetchable) [size=256]
	Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [78] Power Management version 3
	Capabilities: [80] Express Endpoint, MSI 00
	Capabilities: [100] Virtual Channel
	Capabilities: [800] Advanced Error Reporting
	Kernel driver in use: sdhci-pci


The good news: I'm not able to reproduce the problem, the card reader seems to work in all cases.

Comment 3 Josh Boyer 2013-03-13 12:21:09 UTC
Great, thanks for letting us know.

Comment 4 Yann Droneaud 2013-03-13 15:56:15 UTC
The fix seems to be part of this merge request:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=080a62e2ceec28163194facb837d6388983aae5d

Especially in this commit
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=812089e01b9f65f90fc8fc670d8cce72a0e01fbb

PCI: Reduce Ricoh 0xe822 SD card reader base clock frequency to 50MHz

Otherwise it fails like this on cards like the Transcend 16GB SDHC card:

    mmc0: new SDHC card at address b368 mmcblk0: mmc0:b368 SDC 15.0 GiB
    mmcblk0: error -110 sending status command, retrying
    mmcblk0: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb0

Tested on my Lenovo x200 laptop.
[bhelgaas: changelog]
Signed-off-by: Andy Lutomirski <luto>
Signed-off-by: Bjorn Helgaas <bhelgaas>
Acked-by: Chris Ball <cjb>
CC: Manoj Iyer <manoj.iyer>
CC: stable.org

Comment 5 Yann Droneaud 2013-03-13 16:01:01 UTC
But I'm still surprised of the PCI ID difference in comment #0 and comment #2. Why do it changed ?

This seems to confuse other people too: see bug #722509, especially bug #722509, comment #19 for example.

This bug #722509 was fixed by https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3e309cdf07c930f29a4e0f233e47d399bea34c68

Comment 6 Yann Droneaud 2013-03-13 16:05:54 UTC
bug #894707 might be likely related.

Comment 7 Yann Droneaud 2013-03-13 16:14:08 UTC
See also bug #809330 and bug #843429.

bug #890546 could be related too.

Comment 8 Josh Boyer 2013-03-14 18:33:57 UTC
*** Bug 843429 has been marked as a duplicate of this bug. ***

Comment 9 Hubert Figuiere 2013-04-12 18:38:30 UTC
*** Bug 809330 has been marked as a duplicate of this bug. ***

Comment 10 Hubert Figuiere 2013-04-12 18:39:12 UTC
Works fine, albeit the card isn't automounted. I'll file a bug for that.