All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Guo <peter.guo@bayhubtech.com>
To: Alex Ballas <alex@ballas.org>, "adam8157@gmail.com" <adam8157@gmail.com>
Cc: "ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"linux-mmc@VGER.KERNEL.ORG" <linux-mmc@vger.kernel.org>
Subject: RE: 1217:8520 [Dell Latitude E7450] O2 Micro, SD/MMC Card Reader doesn't work
Date: Fri, 18 Dec 2015 03:14:07 +0000	[thread overview]
Message-ID: <BY2PR04MB18438CFFD181C72EFEF408908FE10@BY2PR04MB1843.namprd04.prod.outlook.com> (raw)
In-Reply-To: <CAONpWduF6iH4Rr5Y610KP1RE342nWAajR27KFbu1N2iet4R0ZA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4071 bytes --]

Hi Alex & Adam,

I have send the patch. Please check it.
Attachment is the patch file.


BR
Peter.Guo

-----Original Message-----
From: Alex Ballas [mailto:alex@ballas.org] 
Sent: Wednesday, December 16, 2015 5:49 PM
To: Peter Guo; adam8157@gmail.com
Cc: ulf.hansson@linaro.org; linux-mmc@VGER.KERNEL.ORG
Subject: Re: 1217:8520 [Dell Latitude E7450] O2 Micro, SD/MMC Card Reader doesn't work

Re-adding Adam as the initial mail address is bouncing.

Kind Regards,
Alex


On Wed, Dec 16, 2015 at 5:42 AM, Peter Guo <peter.guo@bayhubtech.com> wrote:
> Hi Alex,
>
> Thanks for your Test, According to your info.
> I find the root cause of this issue is quirks 
> SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD is not suitable for our host for all cases.  Our host just want to clear SDHCI_TRANS_DMA bit only.
>
> to Adam,
>
> I will commit new patch this week, please check it.
>
>
> BR
> Peter.Guo
>
> -----Original Message-----
> From: Alex Ballas [mailto:alex@ballas.org]
> Sent: Saturday, December 12, 2015 10:04 PM
> To: Peter Guo; adam.lee@canonical.com; ulf.hansson@linaro.org
> Cc: linux-mmc@VGER.KERNEL.ORG
> Subject: 1217:8520 [Dell Latitude E7450] O2 Micro, SD/MMC Card Reader 
> doesn't work
>
> Hello,
>
> I have a Dell Latitude E7450 with a O2 Micro, SD/MMC Card Reader [1217:8520] card reader. When I insert my Sandisk ultra 64GB microSD (with a SD card adapter) I get the following errors.
>
> Dmesg output after I insert the SD card:
>
> [  306.054203] sdhci: Timeout waiting for Buffer Read Ready interrupt 
> during tuning procedure, falling back to fixed sampling clock [  
> 306.055982] mmc0: tuning execution failed [  306.055987] mmc0: error 
> -5 whilst initialising SD card [  306.466185] sdhci: Timeout waiting 
> for Buffer Read Ready interrupt during tuning procedure, falling back 
> to fixed sampling clock [  306.467964] mmc0: tuning execution failed [  
> 306.467970] mmc0: error -5 whilst initialising SD card [  306.890205] 
> sdhci: Timeout waiting for Buffer Read Ready interrupt during tuning 
> procedure, falling back to fixed sampling clock [  306.891993] mmc0: 
> tuning execution failed [  306.892005] mmc0: error -5 whilst 
> initialising SD card [  307.330197] sdhci: Timeout waiting for Buffer 
> Read Ready interrupt during tuning procedure, falling back to fixed 
> sampling clock [  307.331980] mmc0: tuning execution failed [  
> 307.331990] mmc0: error -5 whilst initialising SD card
>
> I used the latest mainline kernel available to me [1] $ uname -a Linux 
> cosmo 4.4.0-040400rc4-generic #201512061930 SMP Mon Dec 7
> 00:32:31 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
>
> It was working fine for kernel versions older than 4.1.8.
>
> I did a bisection and here is the first bad commit
>
>> e6c69099f63c84e1825c0f742a76ff4a8afeaa9b is the first bad commit 
>> commit e6c69099f63c84e1825c0f742a76ff4a8afeaa9b
>> Author: Adam Lee <adam.lee@canonical.com>
>> Date:   Mon Aug 3 14:33:28 2015 +0800
>>
>>     mmc: sdhci-pci: set the clear transfer mode register quirk for 
>> O2Micro
>>
>>     commit 143b648ddf1583905fa15d32be27a31442fc7933 upstream.
>>
>>     This patch fixes MMC not working issue on O2Micro/BayHub Host, which
>>     requires transfer mode register to be cleared when sending no DMA
>>     command.
>>
>>     Signed-off-by: Peter Guo <peter.guo@bayhubtech.com>
>>     Signed-off-by: Adam Lee <adam.lee@canonical.com>
>>     Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>>     Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> I originally logged this issue to the Ubuntu bug tracker[2], but it appears to be an upstream issue and so I was instructed to report here.
> Please note that I use the latest Bios version for the model.
>
> $ sudo dmidecode -s bios-version;sudo dmidecode -s bios-release-date
> A08
> 10/28/2015
>
> [1] http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.4-rc4-wily/
> [2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1523178
>
> Thanks,
> Alex

[-- Attachment #2: 0001-mmc-sdhci-Add-QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD.patch --]
[-- Type: application/octet-stream, Size: 2534 bytes --]

From b3862562928dfbc1fa971d2d092a6f0580294d4b Mon Sep 17 00:00:00 2001
From: "peter.guo" <peter.guo@bayhubtech.com>
Date: Fri, 18 Dec 2015 10:44:16 +0800
Subject: [PATCH 1/1] mmc: sdhci: Add QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD for o2Micro chip

Add SDHCI_QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD quirks2 for requires transfer
mode register SDHCI_TRNS_DMA bit to be cleared when sending no DMA.
Apply this quirks for O2Micro chip instead of SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD:
        a.  MMC card not working issue
        b.  SD tuning failed issue.

Signed-off-by: Peter Guo <peter.guo@bayhubtech.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 2 +-
 drivers/mmc/host/sdhci.c          | 4 ++++
 drivers/mmc/host/sdhci.h          | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index cf7ad45..3a6f179 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -614,7 +614,7 @@ 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,
+	.quirks2 = SDHCI_QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD,
 	.probe_slot = sdhci_pci_o2_probe_slot,
 	.resume = sdhci_pci_o2_resume,
 };
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index b48565e..fba9260 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -902,6 +902,10 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
 		} else {
 		/* clear Auto CMD settings for no data CMDs */
 			mode = sdhci_readw(host, SDHCI_TRANSFER_MODE);
+			if (host->quirks2 &
+			    SDHCI_QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD) {
+				mode &= ~(SDHCI_TRNS_DMA);
+			}
 			sdhci_writew(host, mode & ~(SDHCI_TRNS_AUTO_CMD12 |
 				SDHCI_TRNS_AUTO_CMD23), SDHCI_TRANSFER_MODE);
 		}
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 9d4aa31..97fd107 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -417,6 +417,9 @@ struct sdhci_host {
  * SD clock frequency or enabling back the internal clock.
  */
 #define SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST	(1<<16)
+/* need clear transfer mode register SDHCI_TRNS_DMA BIT before send cmd */
+#define SDHCI_QUIRK2_CLEAR_TRANSFERMODE_DMA_BEFORE_CMD	(1<<17)
+
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */
-- 
1.9.1


  reply	other threads:[~2015-12-18  3:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 14:04 1217:8520 [Dell Latitude E7450] O2 Micro, SD/MMC Card Reader doesn't work Alex Ballas
2015-12-16  3:42 ` Peter Guo
2015-12-16  9:48   ` Alex Ballas
2015-12-18  3:14     ` Peter Guo [this message]
2015-12-18  8:51       ` Ulf Hansson
2015-12-18  9:39         ` Peter Guo
2015-12-18 10:43           ` Alex Ballas
2015-12-18 22:55             ` Alex Ballas
2015-12-22  3:24               ` Peter Guo
2015-12-22  8:30                 ` Ulf Hansson
2015-12-23  6:39                   ` Peter Guo
2015-12-23 14:24                     ` Wan ZongShun
2015-12-23 11:13                   ` Russell King - ARM Linux
2015-12-28 11:47                     ` Ulf Hansson
2016-01-02 12:50                       ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY2PR04MB18438CFFD181C72EFEF408908FE10@BY2PR04MB1843.namprd04.prod.outlook.com \
    --to=peter.guo@bayhubtech.com \
    --cc=adam8157@gmail.com \
    --cc=alex@ballas.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.