All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manoj Iyer <manoj.iyer@canonical.com>
To: Chris Ball <cjb@laptop.org>
Cc: Manoj Iyer <manoj.iyer@canonical.com>,
	linux-kernel@vger.kernel.org, jbarnes@virtuousgeek.org,
	matsumur@nts.ricoh.co.jp, linux-pci@vger.kernel.org,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: Added quirks for Ricoh 1180:e823 lower base clock frequency
Date: Tue, 12 Jul 2011 11:01:15 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1107121050480.1767@lazy> (raw)
In-Reply-To: <m2wrfofpro.fsf@bob.laptop.org>


Chris,

Test System: ThinkPad X220 Tablet, using Sandisk 2GB Class 2 SD, I did not 
see any considerable change in read/write times. Also, tested a Transcend 
MMCPlus 2GB card, before the patch was applied it would not mount the 
card, and would cause IO errors on read/write, but after the patch it 
mounts and works correctly.

Linux u 3.0.0-4-generic-pae #5 SMP Mon Jul 11 20:26:49 UTC 2011 i686 
GNU/Linux

Dmesg outputs:
=== SD ===
[   44.510107] mmc0: new SD card at address 0002
[   44.510292] mmcblk0: mmc0:0002 00000 1.86 GiB
[   44.512408]  mmcblk0: p1
u@u:~/Documents$

=== MMC ===

[  726.510850] mmc0: card 0001 removed
[  731.688463] mmc0: error -110 whilst initialising MMC card
[  731.776506] mmc0: error -110 whilst initialising MMC card
[  731.864157] mmc0: new MMC card at address 0001
[  731.864611] mmcblk0: mmc0:0001 MMC    1.87 GiB
[  731.866047]  mmcblk0: p1
u@u:~/Documents$


============ BEFORE THE PATCH ===============
Sandisk 2GB Class2 SD
=============================================
=== WRITE ===
u@u:~$ ls -lh test.file
-rw-r--r-- 1 u u 10M 2011-07-12 10:19 test.file
u@u:~$ time cp test.file /media/E0FD-1813/copyto

real    0m0.480s
user    0m0.000s
sys     0m0.024s
u@u:~$ time cp test.file /media/E0FD-1813/copyto1

real    0m0.476s
user    0m0.000s
sys     0m0.028s
u@u:~$ time cp test.file /media/E0FD-1813/copyto2

real    0m0.484s
user    0m0.000s
sys     0m0.024s
u@u:~$ time cp test.file /media/E0FD-1813/copyto3

real    0m0.480s
user    0m0.000s
sys     0m0.020s
u@u:~$
u@u:~$ ls -lh /media/E0FD-1813/copyto*
-rw-r--r-- 1 u u 10M 2011-07-12 10:20 /media/E0FD-1813/copyto
-rw-r--r-- 1 u u 10M 2011-07-12 10:20 /media/E0FD-1813/copyto1
-rw-r--r-- 1 u u 10M 2011-07-12 10:20 /media/E0FD-1813/copyto2
-rw-r--r-- 1 u u 10M 2011-07-12 10:20 /media/E0FD-1813/copyto3
u@u:~$

=== READ ===
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom1

real    0m0.017s
user    0m0.000s
sys     0m0.016s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom2

real    0m0.021s
user    0m0.004s
sys     0m0.020s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom3

real    0m0.020s
user    0m0.000s
sys     0m0.016s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom4

real    0m0.022s
user    0m0.000s
sys     0m0.020s
u@u:~$
u@u:~$ ls -lh /tmp/copyfrom*
-rw-r--r-- 1 u u 10M 2011-07-12 10:22 /tmp/copyfrom1
-rw-r--r-- 1 u u 10M 2011-07-12 10:22 /tmp/copyfrom2
-rw-r--r-- 1 u u 10M 2011-07-12 10:22 /tmp/copyfrom3
-rw-r--r-- 1 u u 10M 2011-07-12 10:22 /tmp/copyfrom4
u@u:~$

============ AFTER THE PATCH =============
Sandisk 2GB Class2 SD
==========================================

=== WRITE ===
u@u:~$ time cp ./test.file /media/E0FD-1813/copyto1

real    0m0.757s
user    0m0.000s
sys     0m0.044s
u@u:~$ time cp ./test.file /media/E0FD-1813/copyto2

real    0m0.488s
user    0m0.004s
sys     0m0.020s
u@u:~$ time cp ./test.file /media/E0FD-1813/copyto3

real    0m0.484s
user    0m0.004s
sys     0m0.024s
u@u:~$ time cp ./test.file /media/E0FD-1813/copyto4

real    0m0.486s
user    0m0.000s
sys     0m0.024s
u@u:~$ ls -lh /media/E0FD-1813/
copyto1      copyto2      copyto3      copyto4      .Trash-1001/
u@u:~$ ls -lh /media/E0FD-1813/copyto*
-rw-r--r-- 1 u u 10M 2011-07-12 10:30 /media/E0FD-1813/copyto1
-rw-r--r-- 1 u u 10M 2011-07-12 10:30 /media/E0FD-1813/copyto2
-rw-r--r-- 1 u u 10M 2011-07-12 10:30 /media/E0FD-1813/copyto3
-rw-r--r-- 1 u u 10M 2011-07-12 10:30 /media/E0FD-1813/copyto4
u@u:~$

=== READ ===
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom1

real    0m0.020s
user    0m0.000s
sys     0m0.016s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom2

real    0m0.020s
user    0m0.000s
sys     0m0.016s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom3

real    0m0.020s
user    0m0.000s
sys     0m0.016s
u@u:~$ time cp /media/E0FD-1813/copyto1 /tmp/copyfrom4

real    0m0.015s
user    0m0.000s
sys     0m0.012s
u@u:~$ ls -lh /tmp/copyfrom*
-rw-r--r-- 1 u u 10M 2011-07-12 10:31 /tmp/copyfrom1
-rw-r--r-- 1 u u 10M 2011-07-12 10:31 /tmp/copyfrom2
-rw-r--r-- 1 u u 10M 2011-07-12 10:31 /tmp/copyfrom3
-rw-r--r-- 1 u u 10M 2011-07-12 10:31 /tmp/copyfrom4
u@u:~$


====== AFTER THE PATCH - MMC CARD ===========
Transcend MMC 2GB
=============================================

=== WRITE ===
u@u:~$ time cp test.file /media/New\ Volume/copyto1

real    0m0.557s
user    0m0.000s
sys     0m0.024s
u@u:~$ time cp test.file /media/New\ Volume/copyto2

real    0m0.581s
user    0m0.000s
sys     0m0.028s
u@u:~$ time cp test.file /media/New\ Volume/copyto3

real    0m0.581s
user    0m0.000s
sys     0m0.032s
u@u:~$ time cp test.file /media/New\ Volume/copyto4

real    0m0.585s
user    0m0.000s
sys     0m0.028s
u@u:~$ ls -lh /media/New\ Volume/copyto*
-rw-r--r-- 1 u u 10M 2011-07-12 10:42 /media/New Volume/copyto1
-rw-r--r-- 1 u u 10M 2011-07-12 10:42 /media/New Volume/copyto2
-rw-r--r-- 1 u u 10M 2011-07-12 10:42 /media/New Volume/copyto3
-rw-r--r-- 1 u u 10M 2011-07-12 10:42 /media/New Volume/copyto4
u@u:~$

=== READ ===
u@u:~$ time cp /media/New\ Volume/copyto1 /tmp/copyfrom1

real    0m0.154s
user    0m0.000s
sys     0m0.024s
u@u:~$ time cp /media/New\ Volume/copyto1 /tmp/copyfrom2

real    0m0.024s
user    0m0.000s
sys     0m0.020s
u@u:~$ time cp /media/New\ Volume/copyto1 /tmp/copyfrom3

real    0m0.024s
user    0m0.000s
sys     0m0.020s
u@u:~$ time cp /media/New\ Volume/copyto1 /tmp/copyfrom4

real    0m0.022s
user    0m0.000s
sys     0m0.020s
u@u:~$ time cp /media/New\ Volume/copyto2 /tmp/copyfrom5

real    0m0.020s
user    0m0.000s
sys     0m0.016s
u@u:~$ ls -lh /tmp/copyfrom*
-rw-r--r-- 1 u u 10M 2011-07-12 10:44 /tmp/copyfrom1
-rw-r--r-- 1 u u 10M 2011-07-12 10:44 /tmp/copyfrom2
-rw-r--r-- 1 u u 10M 2011-07-12 10:44 /tmp/copyfrom3
-rw-r--r-- 1 u u 10M 2011-07-12 10:44 /tmp/copyfrom4
-rw-r--r-- 1 u u 10M 2011-07-12 10:44 /tmp/copyfrom5
u@u:~$



On Mon, 11 Jul 2011, Chris Ball wrote:

> Hi Manoj, adding linux-mmc@,
>
> On Mon, Jul 11 2011, Manoj Iyer wrote:
>> Ricoh 1180:e823 does not recognize certain types of SD/MMC cards.
>> Lowering the SD base clock frequency from 200Mhz to 50Mhz fixes
>> this issue. This solution was suggest by Koji Matsumuro, Ricoh
>> Company,Ltd.
>>
>> BugLink: http://launchpad.net/bugs/773524
>> Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
>> Tested-by: Daniel Manrique <daniel.manrique@canonical.com>
>> Cc: Koji Matsumuro <matsumur@nts.ricoh.co.jp>
>> ---
>>  drivers/pci/quirks.c |   24 ++++++++++++++++++++++++
>>  1 files changed, 24 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 02145e9..fe5bffa 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -2758,6 +2758,30 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
>>
>>  	dev_notice(&dev->dev, "proprietary Ricoh MMC controller disabled (via firewire function)\n");
>>  	dev_notice(&dev->dev, "MMC cards are now supported by standard SDHCI controller\n");
>> +
>> +	/*
>> +	 * RICOH 0xe823 SD/MMC card reader fails to recognize
>> +	 * certain types of SD/MMC cards. Lowering the SD base
>> +	 * clock frequency from 200Mhz to 50Mhz fixes this issue.
>> +	 *
>> +	 * 0x150 - SD2.0 mode enable for changing base clock
>> +	 *	   frequency to 50Mhz
>> +	 * 0xe1  - Base clock frequency
>> +	 * 0x32  - 50Mhz new clock frequency
>> +	 * 0xf9  - Key register for 0x150
>> +	 * 0xfc  - key register for 0xe1
>> +	 */
>> +	if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
>> +		pci_write_config_byte(dev, 0xf9, 0xfc);
>> +		pci_write_config_byte(dev, 0x150, 0x10);
>> +		pci_write_config_byte(dev, 0xf9, 0x00);
>> +		pci_write_config_byte(dev, 0xfc, 0x01);
>> +		pci_write_config_byte(dev, 0xe1, 0x32);
>> +		pci_write_config_byte(dev, 0xfc, 0x00);
>> +
>> +		dev_notice(&dev->dev, "Controller base frequency changed to 50Mhz)\n");
>
> There's an erroneous ")" in this string; I'll replace it with a "." if
> this patch goes in via my tree.  Also, let's make it "MMC controller"
> instead of just "Controller".
>
>> +	}
>> +
>>  }
>>  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
>>  DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
>
> Have you checked to see how SD I/O performance differs after this change?
>
> (If this is significant, perhaps we want to try lowering the frequency
> only after a card starts returning errors, since some cards work fine
> at the higher frequency.)
>
> Thanks,
>
> - Chris.
> -- 
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child
>
>

--
====================
Manoj Iyer
Ubuntu/Canonical
Hardware Enablement
====================

  parent reply	other threads:[~2011-07-12 16:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 21:28 [Patch 0/1] mmc: Added quirks for Ricoh 1180:e823 lower base clock frequency Manoj Iyer
2011-07-11 21:28 ` [PATCH] " Manoj Iyer
2011-07-11 21:53   ` Chris Ball
2011-07-11 22:55     ` Manoj Iyer
2011-07-12 16:01     ` Manoj Iyer [this message]
2011-07-12 16:20       ` Chris Ball
2011-07-12 17:09         ` Manoj Iyer
2011-07-12 17:30           ` Chris Ball
2011-07-12 18:00             ` Arnd Bergmann
2011-07-13 14:45               ` Chris Ball
2011-07-13 15:42                 ` Manoj Iyer
2011-07-13 16:35                   ` Arnd Bergmann
2011-07-13 16:46                     ` Manoj Iyer
2011-07-13 16:55                       ` Chris Ball
2011-07-13 17:02                         ` Manoj Iyer
2011-07-13 17:08                           ` Chris Ball
2011-07-18 20:36                             ` Manoj Iyer
2011-07-18 20:40                               ` Chris Ball
2011-07-18 20:47                                 ` Manoj Iyer
2011-07-18 21:05                                   ` Chris Ball
2011-07-18 21:12                                     ` Manoj Iyer
2011-07-19 19:43                                     ` Manoj Iyer
2012-11-22  0:29                                   ` Chris Ball
2012-11-26 16:42                                     ` Manoj Iyer
2012-11-26 16:57                                       ` Chris Ball
2011-07-13 16:50                     ` Chris Ball
2011-07-13 16:54                       ` Manoj Iyer
2011-07-18 23:27                         ` Jesse Barnes

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=alpine.DEB.2.02.1107121050480.1767@lazy \
    --to=manoj.iyer@canonical.com \
    --cc=cjb@laptop.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matsumur@nts.ricoh.co.jp \
    /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.