[Xperia Play Android Development] ozzuneoj:
EDIT: There may still be a way to fix this, but the driver I thought we needed to fix is not actually used by this phone, so this post is largely speculative at this point. I did contact Qualcomm to see if they could be of any assistance, but they refused to help. It'll take someone with far more knowledge of memory controller drivers than I to decipher a possible fix for this problem. In the mean time, I've gone to a Samsung class 10 microSD and the problem has gone away. For now I would just recommend avoiding Sandisk Mobile Ultra Class 10 UHS-1 cards on the Xperia Play.

First off, I need to point out that I will need help from someone with the means to compile code in order to test out this patch. Its an extremely quick fix\edit so if you have the means to help, please read on!

I started a thread here four days ago asking if anyone had any ideas about the crippling errors I was getting with my 32Gb Sandisk UHS-1 microSD. It seems to be the general consensus that this phone does not work properly with many high speed (class 10) cards, presumably because of their inferior read speeds. Well, if you read on in that thread you'll see that when compared to a Class 4 card my class 10 UHS-1 card is only slightly slower in random 4k read speeds, nearly identical in sequential reads and several times faster in random writes (which should be very important for running apps and for swap). So, crippling errors should not occur simply due to differences in speed. I've also tested the card extensively on my computer and it works flawlessly and passes every test\scan with no errors. Yet, this is what I see at random during heavy reading\writing operations in dmesg when I use it on my r800x:

10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180500, nr 2, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180500
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180501, nr 1, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180501
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [WARNING] mmcblk0: retrying using single block read
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180494, nr 8, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180494
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180495, nr 7, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180495
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180496, nr 6, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180496
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180497, nr 5, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180497
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180498, nr 4, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180498
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180499, nr 3, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180499
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180500, nr 2, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180500
10/18/2012 13:58:50 [ERROR] mmc1: DMA channel flushed (0x80000004)
10/18/2012 13:58:50 [INFORMATION] mmc1: Controller has been reset
10/18/2012 13:58:50 [INFORMATION] mmc1: Worked around bug 1535304
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending status comand
10/18/2012 13:58:50 [ERROR] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
10/18/2012 13:58:50 [ERROR] mmcblk0: error -5 transferring data, sector 180501, nr 1, card status 0x0
10/18/2012 13:58:50 [ERROR] end_request: I/O error, dev mmcblk0, sector 180501
10/18/2012 13:58:50 [WARNING] mmc1: Starting deferred resume
10/18/2012 13:58:50 [WARNING] mmc1: Deferred resume completed

Long story short... after much digging around online, I've found that this error is common in most devices that use a certain TI OMAP memory controller and the driver "omap_hsmmc.c". It is related to a timing error with high speed cards that occurs when the driver performs a check to determine the best "DTO" (data timeout) for the card and for some reason settles on a DTO that is not optimal for the card. A recommendation straight from Texas Instruments was to simply have the driver skip this process by telling it to use a DTO of 14 (or 0xe), which is what nearly all other memory card controllers do.

This is where I need some help though. I don't have a programming environment on my computer, and I'm running Windows. Oh, and I have NO experience compiling linux kernel driver code and would rather have it done properly. If someone with experience in this area could implement the fix into a patch or driver update of some sort, I would be willing to test it since I've been able to reproduce this problem time and time again over the last couple of weeks. All it involves is adding a single line into an existing driver, or removing a bit of of the buggy code if you want to be more efficient.

First option to fix it, see first post:

http://talk.maemo.org/showthread.php?t=72789

Second option to fix it more efficiently, without having the driver run the calculation at all, see last post:

http://maemo.org/community/maemo-users/n900_microsd_card_i-o_errors_and_corruption/

I would lean toward the second one, because it removes the offending checks completely, rather than making the system run them anyway and then just override the result. If you check the default DTO value in the opam_hsmmc.c driver in the Xperia Play kernel, it is already 0xe, which is the recommended value of 14. So, simply removing the buggy DTO calculation (as shown in the second link) should work fine, as it apparently has for others.

I'm having great difficulty finding the source code to many of the kernels I've used (broken links, or none provided) but the driver is in doomkernel's source and the fix looks like it should work the same for us without anything else getting broken. I've looked around several of the kernel sources posted on DooMLord's github, and all of them seem to use the same exact version of this file including the original kernel sources from Sony, so unless some newer kernels include a modified driver of their own, a fixed driver should theoretically work on any Xperia Play kernel.

With the recent introduction of the UHS (Ultra High Speed) SD card standard, we're starting to see lots of high speed class 10 cards that are actually meant for use in tablets and phones, so this problem is likely to be more prevalent as more people get their hands on them. My 32Gb card was only $24 and is one of the fastest cards you can buy aside from the most recent ones that are in the $60-$100 range (which would likely not be fully utilized in any current mobile device). If we can get these working properly on the Xperia Play, we'll be saving people a lot of headaches.

If you aren't convinced that this is a viable solution, here are some more discussions and alternative solutions:

http://openpandora.org/pipermail/firmware-dev/2011-May/000138.html

http://www.sakoman.com/cgi-bin/gitw...ff;h=34bbeca50fcc618b43428ad65a1f62fc39fbb1dd