Skip to contentSkip to conversation

Enable DMA for Ricoh reader on Lenovo laptops

PATCH Superseded Vasily Khoruzhick 3 participants 14 messages Feb 1, 2010 – Feb 26, 2010

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

PATCH 1/1 Enable DMA for Ricoh reader on Lenovo laptops

Ricoh SD/MMC card reader on Lenovo laptops (3000 n100, 3000 n200) doesn't announce DMA capability, however it supports DMA. Without this patch audio clicks and cursor is jerky during card access.

From 442d0b0234a20f442cacfd0844bc8128a81638bc Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <[email protected]>
Date: Mon, 1 Feb 2010 10:55:55 +0200
Subject: [PATCH] Enable DMA for Ricoh reader on Lenovo laptops

---
 drivers/mmc/host/sdhci-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/mmc/host/sdhci-pci.c +3 -0
index 5c3a176..ada9d10 100644
@@ -87,6 +87,9 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
 	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
 		chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
 
+	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO)
+		chip->quirks |= SDHCI_QUIRK_FORCE_DMA;
+
 	return 0;
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH v2 1/1 Enable DMA for Ricoh reader on Lenovo laptops

В сообщении от 1 февраля 2010 11:10:53 автор Vasily Khoruzhick написал:

Quoted 3 lines

Ricoh SD/MMC card reader on Lenovo laptops (3000 n100, 3000 n200) doesn't announce DMA capability, however it supports DMA. Without this patch audio clicks and cursor is jerky during card access.

It seems that Ricoh R5C822 card reader on mentioned laptops need one more quirk. Here's updated patch.

From 3b93e891e0e37afefc1f1eca461dcfc3ded879f9 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <[email protected]>
Date: Tue, 2 Feb 2010 18:12:54 +0200
Subject: [PATCH v2] Enable DMA for Ricoh reader on Lenovo laptops

---
 drivers/mmc/host/sdhci-pci.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/mmc/host/sdhci-pci.c +5 -1
index 5c3a176..d49e5ff 100644
@@ -80,13 +80,17 @@ struct sdhci_pci_chip {
 
 static int ricoh_probe(struct sdhci_pci_chip *chip)
 {
-	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM)
+	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM ||
+	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO)
 		chip->quirks |= SDHCI_QUIRK_CLOCK_BEFORE_RESET;
 
 	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
 	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
 		chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
 
+	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO)
+		chip->quirks |= SDHCI_QUIRK_FORCE_DMA;
+
 	return 0;
 }
 
Signature · 1 line
1.6.6.1
#2 lore raw

В сообщении от 2 февраля 2010 18:17:15 автор Vasily Khoruzhick написал:

Quoted 2 lines

It seems that Ricoh R5C822 card reader on mentioned laptops need one more quirk. Here's updated patch.

Ping :)

#3 lore raw
Quoted 5 lines · Vasily Khoruzhick

В сообщении от 2 февраля 2010 18:17:15 автор Vasily Khoruzhick написал:

Quoted 2 lines

It seems that Ricoh R5C822 card reader on mentioned laptops need one more quirk. Here's updated patch.

Ping :)

I am very interested in this patch.
I do have a ricoh reader, and SDHCI portion indeed works in PIO only. If you need to read xD cards with this reader I have written a driver for xD portion.

Best regards,
Maxim Levitsky

#4 lore raw

В сообщении от 14 февраля 2010 18:39:08 Maxim Levitsky написал:

Quoted 1 line

I am very interested in this patch.

Is your reader integrated in some Lenovo's laptop? If it is, what is exact model of laptop? What about Acked-by/Tested-by if patch works for you?

Quoted 3 lines

I do have a ricoh reader, and SDHCI portion indeed works in PIO only. If you need to read xD cards with this reader I have written a driver for xD portion.

Where patch for xD can be obtained? I'll test it once I find xD card :)

Regards,
Vasily

#5 lore raw
Quoted 6 lines · Vasily Khoruzhick

В сообщении от 14 февраля 2010 18:39:08 Maxim Levitsky написал:

Quoted 1 line

I am very interested in this patch.

Is your reader integrated in some Lenovo's laptop? If it is, what is exact model of laptop? What about Acked-by/Tested-by if patch works for you?

Acer Aspire 5720.

Quoted 6 lines
Quoted 4 lines

I do have a ricoh reader, and SDHCI portion indeed works in PIO only. If you need to read xD cards with this reader I have written a driver for xD portion.

Where patch for xD can be obtained? I'll test it once I find xD card :)

I post the patch series regularly to linux-mtd.
Hope that it will be merged upstream soon.

Best regards,
Maxim Levitsky

#6 lore raw

В сообщении от 15 февраля 2010 01:20:52 автор Maxim Levitsky написал:

Quoted 1 line

Acer Aspire 5720.

So my patch with quirk addition for Lenovo will not work for you. Maybe it'll be better to enable DMA by default on all Ricoh readers?

Regards,
Vasily

#7 lore raw
Quoted 9 lines · Vasily Khoruzhick

В сообщении от 15 февраля 2010 01:20:52 автор Maxim Levitsky написал:

Quoted 1 line

Acer Aspire 5720.

So my patch with quirk addition for Lenovo will not work for you. Maybe it'll be better to enable DMA by default on all Ricoh readers?

Regards,
Vasily

Yep, works for me.

I used this:

@@ -87,6 +87,8 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)

            chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
                chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
+       chip->quirks |= SDHCI_QUIRK_CLOCK_BEFORE_RESET;
+       chip->quirks |= SDHCI_QUIRK_FORCE_DMA;
        return 0;
}

Not sure if I need the SDHCI_QUIRK_CLOCK_BEFORE_RESET.

What I don't get is why DMA capability isn't advertised?

Since xD and memstick portions do support DMA, I can't belive that they don't use DMA in SD/SDHCI portion.

Ah, I forgot that SDHCI is handled by microsoft driver.... Maybe it doesn't test the DMA bits.

If we were to follow the way MS driver works, we wouldn't need the quirks, right?

Best regards,
Maxim Levitsky

#8 lore raw

В сообщении от 15 февраля 2010 17:58:24 автор Maxim Levitsky написал:

Quoted 1 line

Not sure if I need the SDHCI_QUIRK_CLOCK_BEFORE_RESET.

Driver sometimes doesn't detect card without this quirk for me.

Quoted 10 lines

What I don't get is why DMA capability isn't advertised?

Since xD and memstick portions do support DMA, I can't belive that they don't use DMA in SD/SDHCI portion.

Ah, I forgot that SDHCI is handled by microsoft driver.... Maybe it doesn't test the DMA bits.

If we were to follow the way MS driver works, we wouldn't need the quirks, right?

We need generic quirk for ricoh readers, see attached patch

Regards
Vasily

From 9cbd6c6667d8a2fce583e1e2e7c253b75ec1b675 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <[email protected]>
Date: Mon, 15 Feb 2010 18:10:41 +0200
Subject: [PATCH] Enable DMA on Ricoh sdhci reader by default

---
 drivers/mmc/host/sdhci-pci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-pci.c +3 -4
index 5c3a176..12f5b09 100644
@@ -80,9 +80,6 @@ struct sdhci_pci_chip {
 
 static int ricoh_probe(struct sdhci_pci_chip *chip)
 {
-	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM)
-		chip->quirks |= SDHCI_QUIRK_CLOCK_BEFORE_RESET;
-
 	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
 	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
 		chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
@@ -92,7 +89,9 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
 
 static const struct sdhci_pci_fixes sdhci_ricoh = {
 	.probe		= ricoh_probe,
-	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR,
+	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR |
+			  SDHCI_QUIRK_FORCE_DMA |
+			  SDHCI_QUIRK_CLOCK_BEFORE_RESET,
 };
 
 static const struct sdhci_pci_fixes sdhci_ene_712 = {
Signature · 1 line
1.6.6.1
Tested-by
#9 lore raw
Quoted 13 lines · Vasily Khoruzhick

В сообщении от 15 февраля 2010 17:58:24 автор Maxim Levitsky написал:

Quoted 1 line

Not sure if I need the SDHCI_QUIRK_CLOCK_BEFORE_RESET.

Driver sometimes doesn't detect card without this quirk for me.

Quoted 8 lines

What I don't get is why DMA capability isn't advertised?

Since xD and memstick portions do support DMA, I can't belive that they don't use DMA in SD/SDHCI portion.

Ah, I forgot that SDHCI is handled by microsoft driver.... Maybe it doesn't test the DMA bits.

Quoted 7 lines
Quoted 2 lines

If we were to follow the way MS driver works, we wouldn't need the quirks, right?

We need generic quirk for ricoh readers, see attached patch

Regards
Vasily

Best regards,
Maxim Levitsky

#11 lore raw
Quoted 6 lines · Vasily Khoruzhick
Quoted 1 line · On 15 February 2010 18:20:39 Vasily Khoruzhick wrote:

We need generic quirk for ricoh readers, see attached patch

Ping :)
Any chance to merge this patch? Should I resend it?

Since mmc system has no maintainer, maybe put that through -mm ?

Best regards,
Maxim Levitsky

#12 lore raw
Quoted 10 lines · On Sun, 21 Feb 2010 00:21:45 +0200 Maxim Levitsky <[email protected]>…
Quoted 6 lines · Vasily Khoruzhick
Quoted 1 line · On 15 February 2010 18:20:39 Vasily Khoruzhick wrote:

We need generic quirk for ricoh readers, see attached patch

Ping :)
Any chance to merge this patch? Should I resend it?

Since mmc system has no maintainer, maybe put that through -mm ?

Yup.

But I'm seeing two patches in this thread, neither of which have useful changelogs. Please redo, add a changelog which explains what the problem was and how the patch fixes it. Retain cc's, acked-by's, tested-by's and resend, please.

#13 lore raw

PATCH 1/1 Subject: MMC: Enable DMA on Ricoh sdhci reader by default

From: Vasily Khoruzhick <[email protected]>

This card reader doesn't advertise, however DMA works well. Probably windows SDHCI driver assumes that all readers support DMA and thus we see that bug.

---
 drivers/mmc/host/sdhci-pci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-pci.c +3 -4
index 5c3a176..12f5b09 100644
@@ -80,9 +80,6 @@ struct sdhci_pci_chip {
 
 static int ricoh_probe(struct sdhci_pci_chip *chip)
 {
-	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM)
-		chip->quirks |= SDHCI_QUIRK_CLOCK_BEFORE_RESET;
-
 	if (chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG ||
 	    chip->pdev->subsystem_vendor == PCI_VENDOR_ID_SONY)
 		chip->quirks |= SDHCI_QUIRK_NO_CARD_NO_RESET;
@@ -92,7 +89,9 @@ static int ricoh_probe(struct sdhci_pci_chip *chip)
 
 static const struct sdhci_pci_fixes sdhci_ricoh = {
 	.probe		= ricoh_probe,
-	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR,
+	.quirks		= SDHCI_QUIRK_32BIT_DMA_ADDR |
+			  SDHCI_QUIRK_FORCE_DMA |
+			  SDHCI_QUIRK_CLOCK_BEFORE_RESET,
 };
 
 static const struct sdhci_pci_fixes sdhci_ene_712 = {
Signature · 1 line
1.6.3.3