Bug 596475 - ricoh e822 sdhci device not working
Summary: ricoh e822 sdhci device not working
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Stanislaw Gruszka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 644280
TreeView+ depends on / blocked
 
Reported: 2010-05-26 19:35 UTC by Gregg Lebovitz
Modified: 2011-02-18 09:45 UTC (History)
19 users (show)

Fixed In Version: kernel-2.6.35.6-48.fc14
Clone Of:
: 644280 (view as bug list)
Environment:
Last Closed: 2010-10-28 06:09:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
sdhci c file (48.37 KB, text/x-csrc)
2010-07-04 22:01 UTC, CyberCastle
no flags Details
sdhci-pci.c (20.77 KB, text/x-csrc)
2010-07-04 22:06 UTC, CyberCastle
no flags Details
sdhci.c (48.38 KB, text/x-csrc)
2010-07-04 22:06 UTC, CyberCastle
no flags Details
sdhci.h (13.09 KB, text/x-chdr)
2010-07-04 22:06 UTC, CyberCastle
no flags Details
mmc-make-sdhci-work-with-ricoh-mmc-controller-2.6.33.patch (3.08 KB, text/plain)
2010-07-15 17:06 UTC, Stanislaw Gruszka
no flags Details
mmc-ricoh_E822.diff (8.56 KB, patch)
2010-07-21 17:37 UTC, CyberCastle
no flags Details | Diff
2.6.33.5-124 kernel patches to fix ricoh 822 sdhci card reader (6.60 KB, patch)
2010-07-22 02:16 UTC, Gregg Lebovitz
no flags Details | Diff
f12-add-ricoh-e822.patch (4.17 KB, text/plain)
2010-09-09 09:02 UTC, Stanislaw Gruszka
no flags Details
dmesg after inserting the card with debug enabled (56.68 KB, text/plain)
2010-09-15 11:32 UTC, Brice Goglin
no flags Details

Description Gregg Lebovitz 2010-05-26 19:35:05 UTC
Description of problem:

sdhci device gets an error "mmc0: unexpected interrupt" when an sdhc card is inserted.


Version-Release number of selected component (if applicable):

linux-2.6.32.12-115

How reproducible:r

always


Steps to Reproduce:
1. insert sdhc card
2. check dmesg
3. driver gets a unexpected interrupt
  
Actual results:

sdhc card isn't recognized


Expected results:

sdhc card activating and partition table read


Additional info:

dmesg when card is inserted

mmc0: Unexpected interrupt 0x02000000.
sdhci: ============== REGISTER DUMP ==============
sdhci: Sys addr: 0x00000000 | Version:  0x00000402
sdhci: Blk size: 0x00007008 | Blk cnt:  0x00000001
sdhci: Argument: 0x00000000 | Trn mode: 0x00000013
sdhci: Present:  0x01ff0202 | Host ctl: 0x00000011
sdhci: Power:    0x0000000f | Blk gap:  0x00000000
sdhci: Wake-up:  0x00000000 | Clock:    0x00004007
sdhci: Timeout:  0x0000000a | Int stat: 0x02008008
sdhci: Int enab: 0x02ff00cb | Sig enab: 0x02ff00cb
sdhci: AC12 err: 0x00000000 | Slot int: 0x00000001
sdhci: Caps:     0x21e832b2 | Max curr: 0x00000040
sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x2dd84878
sdhci: ===========================================
mmc0: Timeout waiting for hardware interrupt.

dmesg when card is removed

sdhci: ============== REGISTER DUMP ==============
sdhci: Sys addr: 0x00000000 | Version:  0x00000402
sdhci: Blk size: 0x00007008 | Blk cnt:  0x00000001
sdhci: Argument: 0x00000000 | Trn mode: 0x00000013
sdhci: Present:  0x01ff0202 | Host ctl: 0x00000011
sdhci: Power:    0x0000000f | Blk gap:  0x00000000
sdhci: Wake-up:  0x00000000 | Clock:    0x00004007
sdhci: Timeout:  0x0000000a | Int stat: 0x00000000
sdhci: Int enab: 0x02ff00cb | Sig enab: 0x02ff00cb
sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci: Caps:     0x21e832b2 | Max curr: 0x00000040
sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x2dd84878
sdhci: ===========================================
mmc0: error -110 whilst initialising SD card

Comment 1 Gregg Lebovitz 2010-06-06 17:09:55 UTC
This exact problem exists in the Fedora 12 distribution.

Comment 2 Stanislaw Gruszka 2010-06-12 11:02:30 UTC
Bug report version is F-13, this is mistake or on F-13 sd card not work as well?

Comment 3 Stanislaw Gruszka 2010-06-26 18:11:12 UTC
We need clarification, if this is only F-12 problem, or F-12 and F-13 problem. Info if card works on rawhide will be useful as well.

Comment 4 Gregg Lebovitz 2010-06-26 19:15:54 UTC
this both a F12 and F13 problem. I will try rawhide when I get the chance

Comment 5 CyberCastle 2010-07-04 21:59:58 UTC
[Possible FIX]

I modified the patch posted here (http://thread.gmane.org/gmane.linux.kernel.commits.mm/62262) to support this device.

Attached are the files modified to be compiled into the kernel 2.6.1934.

Tested on OpenSuSE 11.3 RC2

P.D.: I'm sorry for my bad english.

Comment 6 CyberCastle 2010-07-04 22:01:36 UTC
Created attachment 429415 [details]
sdhci c file

Comment 7 CyberCastle 2010-07-04 22:06:01 UTC
Created attachment 429416 [details]
sdhci-pci.c

Comment 8 CyberCastle 2010-07-04 22:06:30 UTC
Created attachment 429417 [details]
sdhci.c

Comment 9 CyberCastle 2010-07-04 22:06:54 UTC
Created attachment 429418 [details]
sdhci.h

Comment 10 CyberCastle 2010-07-04 22:08:26 UTC
Tested on Dell Precision M4500

Comment 11 Gregg Lebovitz 2010-07-07 20:43:01 UTC
This patch doesn't work against the Fedora 13 kernels. I can't' get it to build.

Comment 12 Stanislaw Gruszka 2010-07-15 17:06:37 UTC
Created attachment 432147 [details]
mmc-make-sdhci-work-with-ricoh-mmc-controller-2.6.33.patch

CyberCastle,

Thank you very much for your help. Normally we use patches for kernel source changes not single files. I prepared this patch for 2.6.33 kernel. It generate different files than yours attached here? 

Gregg,
Could you test this patch?

Comment 13 Gregg Lebovitz 2010-07-21 02:44:14 UTC
applied the patch to my sdhci.c sdhci.h and sdhci-pci.c and I don't see any change in behavior.

Comment 14 CyberCastle 2010-07-21 17:35:37 UTC
The patch posted by  Stanislaw Gruszka is incomplete, because it doesn't refer to this device (Ricoh E822)

Test with my patch....

Comment 15 CyberCastle 2010-07-21 17:37:44 UTC
Created attachment 433467 [details]
mmc-ricoh_E822.diff

Comment 16 Gregg Lebovitz 2010-07-22 01:39:39 UTC
I applied the diffs as well as I could to the Fedora 2.6.33.5-124 kernel and it appears to work. There were some differences, likely because the Fedora kernel is older than the one you are patching.

now we need to figure out how to get the patches into the kernel.

Gregg

Comment 17 Gregg Lebovitz 2010-07-22 02:16:54 UTC
Created attachment 433567 [details]
2.6.33.5-124 kernel patches to fix ricoh 822 sdhci card reader

CyberCastle's patches applied to the sdhci.c sdhci.h sdhci-pci.c in the Fedora 2.6.33.5-124 kernel.

Comment 18 Stanislaw Gruszka 2010-07-22 09:20:46 UTC
(In reply to comment #14)
> The patch posted by  Stanislaw Gruszka is incomplete, because it doesn't refer
> to this device (Ricoh E822)

Thanks again, I'm reassigning bug to you :-)

(In reply to comment #16)
> now we need to figure out how to get the patches into the kernel.

Since this is support for new device, this it will get fedora by that long way: mm tree -> linus tree -> fedora rawhide -> fedora release. Actually bug can be closed with UPSTREAM resolution, but please post patch upstream with missing parts (against mm tree). Let me know if you need help with that.

Comment 19 Stanislaw Gruszka 2010-08-04 06:52:38 UTC
Hi CyberCastle,

Any news about upstream posting to mm tree. BTW: it seems only below hunk need to be posted:

> +     {      
> +             .vendor         = PCI_VENDOR_ID_RICOH,                                                 
> +             .device         = 0xe822,
> +             .subvendor      = PCI_ANY_ID,                                                          
> +             .subdevice      = PCI_ANY_ID,                                                          
> +             .driver_data    = (kernel_ulong_t)&sdhci_ricoh_mmc,                                    
> +     },

Comment 20 Gregg Lebovitz 2010-08-04 14:39:17 UTC
stanislaw,

You still have to add the sdhci_ricoh_mmc methods

ricoh_mmc_probe_slot
ricoh_mmc_resume

and struct sdhci_pci_fixes sdhci_ricoh_mmc

Gregg

Comment 21 Stanislaw Gruszka 2010-08-04 14:49:49 UTC
Yes, these things are missing in linux-2.6, but proper patches are already in mm tree http://userweb.kernel.org/~akpm/mmotm/ .

I will post missing hunk today.

Comment 22 Sergio Basto 2010-08-31 00:56:17 UTC
(In reply to comment #21)
> Yes, these things are missing in linux-2.6, but proper patches are already in
> mm tree http://userweb.kernel.org/~akpm/mmotm/ .
> 
> I will post missing hunk today.

Where is or what is the completed patch for fedora kernels ? 
Thanks,

Comment 23 Stanislaw Gruszka 2010-09-09 09:02:57 UTC
Created attachment 446174 [details]
f12-add-ricoh-e822.patch

Patch for fedora 12

Comment 24 Stanislaw Gruszka 2010-09-09 09:34:43 UTC
Patch from above comment 23 apples also on F-13 2.6.34 kernel.

Comment 25 Stanislaw Gruszka 2010-09-09 10:07:57 UTC
I will post patches to fedora mailing list to make device work on F-12,13,14 and rawhide.

Comment 26 Stanislaw Gruszka 2010-09-09 10:12:00 UTC
(In reply to comment #25)
> I will post patches to fedora mailing list to make device work on F-12,13,14
Actually since bug is reported against F-13, I will not touch F-12.

Comment 27 Alex Tucker 2010-09-09 13:01:39 UTC
I've rebuilt kernel-2.6.34.6-47.fc13.src.rpm including the patch in attachment 446174 [details], and the SD reader on my Dell Precision M4500 now works fine.

Comment 28 Brice Goglin 2010-09-14 21:50:40 UTC
Unless I am mistaken, this patch is in 2.6.36. But .36-rc3 doesn't work
on my Dell E6410. It just say:
  mmc0: new high speed SD card at address b368
and nothing else happens.

Is there anything to do apart from using the right kernel? Putting 0x40 in sdhci debug_quirks in modprobe helped in the past. Is any of this still needed nowadays?

Comment 29 Stanislaw Gruszka 2010-09-15 07:59:05 UTC
(In reply to comment #28)
> Unless I am mistaken, this patch is in 2.6.36. 

Yes, patches are there.

> But .36-rc3 doesn't work
> on my Dell E6410. It just say:
>   mmc0: new high speed SD card at address b368
> and nothing else happens.

Some SD cards do not work. We have RHEL6 bug report about that (Bug 623631), but closed as INSUFFICIENT DATA.

> Is there anything to do apart from using the right kernel? Putting 0x40 in
> sdhci debug_quirks in modprobe helped in the past. Is any of this still needed
> nowadays?

Please try :-)

Do you have kernel compiled with CONFIG_DYNAMIC_DEBUG=y . If so please do:

> # mount -t debugfs debugfs /sys/kernel/debug/
> # find /lib/modules/`uname -r`/kernel/drivers/mmc -name "*.ko" -exec basename {} .ko \; | while read m ; do echo "module $m +p" ; done > /sys/kernel/debug/dynamic_debug/control

and put card in, and provide dmesg output.

Comment 30 Brice Goglin 2010-09-15 11:32:14 UTC
Created attachment 447442 [details]
dmesg after inserting the card with debug enabled

Comment 31 Stanislaw Gruszka 2010-09-17 11:21:56 UTC
Could you tell what is exact card model/type (SDIO, SDHC, SD ...)? Seems for unknown reason for me, this card is recognized as MMC, what is wrong. Do you have information if that card works with other MMC/SD readers in linux.

Comment 32 Brice Goglin 2010-09-17 11:31:00 UTC
The card is a regular SD card with nothing interesting to say about it. I don't have another machine at hand to try another reader, I'll let you know when I'll find something to test on.

Comment 33 Gregg Lebovitz 2010-09-17 11:52:02 UTC
I can give this new kernel patch a try this weekend. Since I have a working driver in my 2.6.33 kernel, we can use this as a reference. I also have a 6410 laptop.

Comment 34 Stanislaw Gruszka 2010-09-20 08:08:17 UTC
(In reply to comment #31)
> Seems for
> unknown reason for me, this card is recognized as MMC, what is wrong.
No, driver do proper SD card initialization sequence, but there is something wrong when reading card parameters.

Brice, since this is upstream problem too, could you please report it on linux-mmc.org mailing list ?

Comment 35 Brice Goglin 2010-09-20 08:13:59 UTC
FWIW, the card works fine on Dell Latitude E6500 (older model) with Ubuntu 10.4,
  03:01.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)

So I guess the problem is in the reader, not in the card itself.

I'll mail the MMC ML, thanks.

Comment 36 Fedora Update System 2010-10-19 04:36:19 UTC
kernel-2.6.35.6-46.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/kernel-2.6.35.6-46.fc14

Comment 37 Fedora Update System 2010-10-19 06:31:21 UTC
kernel-2.6.34.7-61.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/kernel-2.6.34.7-61.fc13

Comment 38 Fedora Update System 2010-10-19 06:36:07 UTC
kernel-2.6.32.23-170.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/kernel-2.6.32.23-170.fc12

Comment 39 Stanislaw Gruszka 2010-10-19 09:55:15 UTC
Brice, for your issue I going to open a new bug report, any news from upstream?

Comment 40 Brice Goglin 2010-10-19 10:04:36 UTC
I never got any reply to my mail to the mailing list.

Comment 41 Reinout van Schouwen 2010-10-20 15:16:32 UTC
I've got a Dell Latitude E6410 and FC14 kernel 2.6.35.6-45.fc14.x86_64.
Upon inserting a SD card (actually an SD card adapter for a micro SD card), nothing seems to happen. Dmesg shows this error each time I insert it:

[12930.177557] mmc0: ADMA error
[12930.179608] mmc0: Got data interrupt 0x02000000 even though no data operation was in progress.
[12930.179615] sdhci: ============== REGISTER DUMP ==============
[12930.179625] sdhci: Sys addr: 0x00000000 | Version:  0x00000402
[12930.179634] sdhci: Blk size: 0x00007008 | Blk cnt:  0x00000001
[12930.179643] sdhci: Argument: 0x00000000 | Trn mode: 0x00000013
[12930.179652] sdhci: Present:  0x01ff0000 | Host ctl: 0x00000011
[12930.179660] sdhci: Power:    0x0000000f | Blk gap:  0x00000000
[12930.179669] sdhci: Wake-up:  0x00000000 | Clock:    0x00004007
[12930.179678] sdhci: Timeout:  0x0000000a | Int stat: 0x00000000
[12930.179686] sdhci: Int enab: 0x02ff00cb | Sig enab: 0x02ff00cb
[12930.179695] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
[12930.179703] sdhci: Caps:     0x21e832b2 | Max curr: 0x00000040
[12930.179712] sdhci: ADMA Err: 0x00000001 | ADMA Ptr: 0x022d7804
[12930.179717] sdhci: ===========================================
[12930.180804] mmc0: error -5 whilst initialising SD card

Comment 42 Colin.Simpson 2010-10-20 16:43:58 UTC
We have this issue too with RHEL5 on Dell laptops. The RHEL5 kernel looks way too far behind to make the patch easy to apply, but maybe looks not impossible, just time consuming.

Anyone tried/succeeded on RHEL5? I suppose an RFE from RH on this is out of the question, the answer might be RHEL6 I guess.

Comment 43 Michael Zabriskie 2010-10-20 16:52:16 UTC
(In reply to comment #37)
> kernel-2.6.34.7-61.fc13 has been submitted as an update for Fedora 13.
> https://admin.fedoraproject.org/updates/kernel-2.6.34.7-61.fc13

Result with Dell M4500.
This patch does not work in every case for me.

8GB SD - Works
Kingston 2GB SD - Works
A-Data 16GB SDHC - Does not (same "kernel: mmc0: error -110 whilst initialising SD card" error)

Tried patching kernel-2.6.34.7-56.fc13.x86_64 with f12-add-ricoh-e822.patch.
And tried kernel-2.6.34.7-61.fc13.x86_64 from comment 37.
I get the same result with both.

Anyone else experiencing a similar problem with this patch?

Comment 44 Fedora Update System 2010-10-22 17:32:42 UTC
kernel-2.6.35.6-48.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/kernel-2.6.35.6-48.fc14

Comment 45 Fedora Update System 2010-10-22 18:04:32 UTC
kernel-2.6.34.7-61.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 46 Fedora Update System 2010-10-28 06:09:31 UTC
kernel-2.6.35.6-48.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 47 Fedora Update System 2010-10-30 23:42:22 UTC
kernel-2.6.32.23-170.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 48 Stanislaw Gruszka 2011-02-18 09:45:37 UTC
I have a patch (and compiled kernel with patch) that could possibly fix remaining problems with e822. Please test, also if you have already ricoh controller working, to see if it not causing regression.

https://bugzilla.redhat.com/show_bug.cgi?id=644280#c6


Note You need to log in before you can comment on or make changes to this bug.