maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Fix for Class 10 microSD cards (https://talk.maemo.org/showthread.php?t=72789)

AndrewX192 2011-05-05 05:43

Fix for Class 10 microSD cards
 
Hello everyone,

Stlpaul
and I have got certain class 10 microSD cards that were formerly not working properly with Maemo to work properly.
In particular, this thread's issues are addressed: http://talk.maemo.org/showthread.php?t=70974

I have been using this patch for over a week now, without any stability issues (I have swap on microSD).

Installation Instructions:

You can replace your current kernel module (backup up the old one first), and try the fix at your OWN RISK. The kernel module goes in your appropriate /lib/modules/ folder.

Here is the patched kernel for the power-kernel (v46)

http://forge.localcoast.net/clients/.../omap_hsmmc.ko

Or, if you want to change the kernel and recompile it yourself..

Look in drivers/mmc/host/omap_hsmmc.c and find the set_data_timeout function() function, and add
Code:

dto = 14;
before the line that reads:
Code:

reg &= ~DTO_MASK;
Notice: I hereby disclaim and damage(s), or issue(s) caused by the use of these/this modfied file(s). Only make these changes if you already have an issue, and are looking to fix it. Be sure to backup all user data before making changes.

Notice: This fix does not apply to NITDroid and any other kernel(s) or operating system(s) you may be using outside of Maemo. Additional software platforms may require a similar change(s) to be made to achieve the desired result.

Please let me know how it works for you!

Good luck.

Mentalist Traceur 2011-05-05 06:07

Re: Fix for Class 10 microSD cards
 
You can, once this is tested long enough to be sure it doesn't screw up other stuff, submit this to pali, as he has become the power-kernel maintainer and can make this patch a normal part of the power-kernel.

JohnLF 2011-05-05 06:10

Re: Fix for Class 10 microSD cards
 
Would be interesting to know if it affects other MicroSD cards at all - speedwise that is.

stlpaul 2011-05-05 16:47

Re: Fix for Class 10 microSD cards
 
Thanks for posting, I've been meaning to create a thread about it but have been extremely busy lately.

14 (0xA) is the standard DTO setting for SD cards. The omap_hsmmc driver tries to use some logic to dynamically change DTO based on the card timings but apparently this logic is buggy, or perhaps certain cards return bad timing information when the driver requests it. It affects all devices which use this driver, not just the N900, and other devices with other drivers too. The suggestion to use DTO=14 came from Texas Instruments, so it should be safe for all. Forcing DTO to 14 is the fix/workaround for all kinds of SD drivers. Apparently it is quite a common problem.

The set_data_timeout function can actually be reduced quite a bit, inserting the dto=14 line ultimately has the same effect, but really all of the stuff related to the DTO calculation in that function can be removed. I don't have access to my computer right now but I can post the one I've been using when I get home.

This fixes the cards that suffer corruption and constant -110 errors in dmesg (this is a timeout error, because the DTO was set incorrectly by the driver). The same cards that work perfectly fine in other devices, USB card readers, etc.

I've been using this fix with both affected and unaffected cards for a couple weeks and have seen no problems either way. Since it worked for AndrewX192 also I think it should be safe for human consumption. :)

I tried to apply the same fix to the latest Nitdroid kernel but haven't been able to get it working so far. I very likely could just be doing it wrong. It could also be getting confused by my existing nitdroid installation which runs on my other SD card. I haven't had time to really try much more with it yet.

vi_ 2011-05-05 17:30

Re: Fix for Class 10 microSD cards
 
As this is compatible with power46, does that mean it is safe to use with power47?

I assume that because the wifi injection driver works (compiled for 46, works with 47) this will also work with 47.

I would just try however I don't want to risk ANOTHER £30 class 10 SD card by doing something obviously dumb.

stlpaul 2011-05-05 19:35

Re: Fix for Class 10 microSD cards
 
Quote:

Originally Posted by vi_ (Post 1000732)
As this is compatible with power46, does that mean it is safe to use with power47?

I assume that because the wifi injection driver works (compiled for 46, works with 47) this will also work with 47.

I would just try however I don't want to risk ANOTHER £30 class 10 SD card by doing something obviously dumb.

It should, I doubt this module changed at all between power46 and power47. The risk of damaging your SD card would with the unmodified kernel, not the modified one! :)

If you want to be careful, when I get home I'll pull Pali's kernel and build it with this patch and upload the compiled module for you after I've made sure it works on my N900.

Tigerite 2011-05-05 20:05

Re: Fix for Class 10 microSD cards
 
1 Attachment(s)
It's odd, because my N900 with HW 2101 was absolutely fine with my class 10 SD card. However, once Nokia Care had replaced it with HW 2204, I started getting these errors. It's been sent back again now due to other problems, but I'll definitely be applying this patch to kernel-bfs ready for when it's returned to me :)

PS I've tidied up the code and made a diff which can be applied in the build process - had to make it a .txt to attach it though.

Mentalist Traceur 2011-05-05 23:49

Re: Fix for Class 10 microSD cards
 
I'm still of the opinion that the ideal thing to do would be to shove this into the default power kernel, when it's ready. Well, the most ideal is making the DTO logic try to get the right number, then use a heuristic to default to 14 if it starts to experience symptoms of errors. Perhaps, if possible, see if there's some way to check the device for errors without damaging any data. But that's a long term hope.

stlpaul 2011-05-06 04:27

Re: Fix for Class 10 microSD cards
 
Quote:

Originally Posted by Tigerite (Post 1000827)
It's odd, because my N900 with HW 2101 was absolutely fine with my class 10 SD card. However, once Nokia Care had replaced it with HW 2204, I started getting these errors. It's been sent back again now due to other problems, but I'll definitely be applying this patch to kernel-bfs ready for when it's returned to me :)

PS I've tidied up the code and made a diff which can be applied in the build process - had to make it a .txt to attach it though.

Thanks, that's basically what mine looks like, but I even removed the dto variable entirely and just used the DTO macro instead (it is already defined as 0xa early in the file)

BTW my N900 is rev 2101...

stlpaul 2011-05-06 05:04

Re: Fix for Class 10 microSD cards
 
1 Attachment(s)
Here is the module compiled as part of power47, it works for me.


All times are GMT. The time now is 08:22.

vBulletin® Version 3.8.8