Re: linux 4.17, drivers/mmc/host/sdhci-pci-o2micro.c, crash with sdcard >128G

From: jean-luc malet
Date: Wed Mar 27 2019 - 16:58:34 EST


resentding in plain text


On Wed, Mar 27, 2019 at 9:56 PM jean-luc malet <jeanluc.malet@xxxxxxxxx> wrote:
>
> Hi everybody
> thanks to chuanjin pang, it's almost a year that I use my controler with sdcards >128G without issue, I upgraded my kernel to 5.0.4 and noticed that the sdcard bug was still present... so I applied the patch again and it did fixed the issue as it did on my previous kernel build
> since the stability seems very good, please consider applying this patch for futur kernel release
> thanks and regards
> JLM
>
> On Mon, Jun 11, 2018 at 2:04 PM jean-luc malet <jeanluc.malet@xxxxxxxxx> wrote:
>>
>> something has changed.... the sdcard wasn't working at all on 4.16.11 kernel (crash on reading but sdcard discovery was working) for any card and not at all on 4.9.? kernel (not even listing the sdcard when inserting) , in 4.17 it works with all card below 256G that I have... so there is obvioulsy a change somewhere that made this controler works....
>> best regards
>>
>> On Mon, Jun 11, 2018 at 1:11 PM Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
>>>
>>> On 09/06/18 11:38, jean-luc malet wrote:
>>> > Hi everybody!
>>> > thanks for adding support to my O2 Micro, Inc. Device 8620 in last kernel!!!
>>> > I was looking for it since long time!!!!
>>> >
>>> > # lspci -kv
>>> > 02:00.0 SD Host controller: O2 Micro, Inc. Device 8620 (rev 01) (prog-if 01)
>>> > Subsystem: Lenovo Device 3800
>>> > Flags: bus master, fast devsel, latency 0, IRQ 17
>>> > Memory at a1001000 (32-bit, non-prefetchable) [size=4K]
>>> > Memory at a1000000 (32-bit, non-prefetchable) [size=2K]
>>> > Capabilities: [6c] Power Management version 3
>>> > Capabilities: [48] MSI: Enable- Count=1/1 Maskable+ 64bit+
>>> > Capabilities: [80] Express Endpoint, MSI 00
>>> > Capabilities: [100] Virtual Channel
>>> > Capabilities: [200] Advanced Error Reporting
>>> > Capabilities: [230] Latency Tolerance Reporting
>>> > Capabilities: [240] L1 PM Substates
>>> > Kernel driver in use: sdhci-pci
>>> > Kernel modules: sdhci_pci
>>> >
>>> > it works fine with sdcard up to 128G but crash on my samsung 256G evo plus
>>> > card
>>> > (https://www.samsung.com/fr/memory-storage/evo-plus-microsd-card-with-sd-adapter/MB-MC256DAEU/)
>>> >
>>> > insert 256G card
>>> > #dmesg
>>> >
>>> > [94815.892525] mmc0: Tuning timeout, falling back to fixed sampling clock
>>> > [94815.892627] mmc0: new ultra high speed SDR104 SDXC card at address 0001
>>> > [94815.893398] mmcblk0: mmc0:0001 EE8QT 239 GiB
>>> > [94815.945330] mmc0: Tuning timeout, falling back to fixed sampling clock
>>> >
>>> > # dd if=/dev/mmcblk0 of=test bs=512 count=1
>>> >
>>> > dd: error reading '/dev/mmcblk0': Input/output error
>>> > 0+0 records in
>>> > 0+0 records out
>>> > 0 bytes copied, 42.829 s, 0.0 kB/s
>>> >
>>> > #dmesg
>>> >
>>> > [94825.956285] mmc0: Timeout waiting for hardware interrupt.
>>> > [94825.956289] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
>>> > [94825.956297] mmc0: sdhci: Sys addr: 0x00000008 | Version: 0x00000603
>>> > [94825.956304] mmc0: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000008
>>> > [94825.956310] mmc0: sdhci: Argument: 0x00000000 | Trn mode: 0x0000003b
>>> > [94825.956316] mmc0: sdhci: Present: 0x01ff0000 | Host ctl: 0x00000017
>>> > [94825.956322] mmc0: sdhci: Power: 0x0000000f | Blk gap: 0x00000000
>>> > [94825.956327] mmc0: sdhci: Wake-up: 0x00000000 | Clock: 0x00000007
>>> > [94825.956333] mmc0: sdhci: Timeout: 0x0000000a | Int stat: 0x00000000
>>> > [94825.956339] mmc0: sdhci: Int enab: 0x02ff008b | Sig enab: 0x02ff008b
>>> > [94825.956344] mmc0: sdhci: AC12 err: 0x00000004 | Slot int: 0x00000000
>>> > [94825.956350] mmc0: sdhci: Caps: 0x25fcc8bf | Caps_1: 0x00002077
>>> > [94825.956356] mmc0: sdhci: Cmd: 0x0000123a | Max curr: 0x005800c8
>>> > [94825.956362] mmc0: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0x00000000
>>> > [94825.956368] mmc0: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00001b00
>>> > [94825.956371] mmc0: sdhci: Host ctl2: 0x0000800b
>>> > [94825.956378] mmc0: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0xfffff208
>>> > [94825.956380] mmc0: sdhci: ============================================
>>> > [94826.007314] mmc0: Tuning timeout, falling back to fixed sampling clock
>>> >
>>> > remove card
>>> > insert 128G card (http://www.toshiba-sdcard.com/microsd/microsd_m302.html)
>>> > #dmesg
>>> >
>>> > [95214.753428] mmc0: Tuning timeout, falling back to fixed sampling clock
>>> > [95214.753530] mmc0: new ultra high speed SDR104 SDXC card at address 1234
>>> > [95214.754399] mmcblk0: mmc0:1234 SA128 116 GiB
>>> > [95214.756474] mmcblk0: p1
>>> >
>>> >
>>> > # dd if=/dev/mmcblk0 of=test bs=512 count=1
>>> > 1+0 records in
>>> > 1+0 records out
>>> > 512 bytes copied, 0.00209609 s, 244 kB/s
>>> >
>>> >
>>> > remove card
>>> > insert 128G card (samsung 128Gb evo U1 card)
>>> > #dmseg
>>> >
>>> > [95438.053427] mmc0: Tuning timeout, falling back to fixed sampling clock
>>> > [95438.053552] mmc0: new ultra high speed DDR50 SDXC card at address 59b4
>>> > [95438.054139] mmcblk0: mmc0:59b4 00000 120 GiB
>>> > [95438.056451] mmcblk0: p1
>>> >
>>> >
>>> > # dd if=/dev/mmcblk0 of=test bs=512 count=1
>>> >
>>> > 1+0 records in
>>> > 1+0 records out
>>> > 512 bytes copied, 0.0346192 s, 14.8 kB/s
>>> >
>>> >
>>> > since the toshiba a 256G samsung are both U3 this seems not related to this
>>> > since one of the samsung card works, this don't seems to be related to the
>>> > brand....
>>> > so this seems related to the size of the card....
>>> > if you need more information, I'll try to provide the best accurate ones :)
>>>
>>> Tuning fails for all the cards, it is just some of them still work with
>>> fixed sampling. You need to find someone who knows about the O2 Micro
>>> controllers. but no one has touched the driver since 2015.
From 63c3e27be619db1b13241cc3aff46ffdcc811ee0 Mon Sep 17 00:00:00 2001
From: "chuanjin.pang" <chuanjin.pang@xxxxxxxxxxxxxx>
Date: Sat, 15 Sep 2018 00:27:27 +0800
Subject: [PATCH] clean bayhub quirks2 flag for tuning UHS timeout issue

---
mmc/host/sdhci-pci-core.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/mmc/host/sdhci-pci-core.c b/mmc/host/sdhci-pci-core.c
index 77dd352..6573f44 100644
--- a/mmc/host/sdhci-pci-core.c
+++ b/mmc/host/sdhci-pci-core.c
@@ -1176,7 +1176,6 @@ static int jmicron_resume(struct sdhci_pci_chip *chip)
static const struct sdhci_pci_fixes sdhci_o2 = {
.probe = sdhci_pci_o2_probe,
.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
- .quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD,
.probe_slot = sdhci_pci_o2_probe_slot,
#ifdef CONFIG_PM_SLEEP
.resume = sdhci_pci_o2_resume,
--
2.7.4