![]() |
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; Code:
reg &= ~DTO_MASK; 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. |
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.
|
Re: Fix for Class 10 microSD cards
Would be interesting to know if it affects other MicroSD cards at all - speedwise that is.
|
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. |
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. |
Re: Fix for Class 10 microSD cards
Quote:
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. |
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. |
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.
|
Re: Fix for Class 10 microSD cards
Quote:
BTW my N900 is rev 2101... |
Re: Fix for Class 10 microSD cards
1 Attachment(s)
Here is the module compiled as part of power47, it works for me.
|
Re: Fix for Class 10 microSD cards
This is great, thanks.
This isnt a request just an idea...If the sd driver could be modified to unmount the mmc gracefully when the back cover was removed as opposed to just outright cutting the power. That be...sweet. Just think, if I remove the back cover while my swap was mounted on the SD card it would nicely unmount swap as opposed to rudely cutting it of, the machine spazzing out then dieing. Or EVEN better, the driver would emit a dbus signal so I could run a script when the back cover was removed and nicely swap the swap elsewhere, beep/vibrate when it is done. Bleep nastily if I opened the back with the sd card mounted. You get what I mean? |
Re: Fix for Class 10 microSD cards
Quote:
How exactly did you test this thing? |
Re: Fix for Class 10 microSD cards
Quote:
It reminds me Toshiba ac100 and nvidia terga driver +) ---- Anyway, i'm going to test this module later, these errors is annoying when downloading torrents on my n900. |
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
Yes, I am keen to see if this driver (once debugged/tested) increases MMC performance.
I have a 16GB class 4, and when copying from the EMMC to the MicroSD, I would get very low average transfer speeds once the kernel's buffers were full. On the order of 200-400 kBps. Using the card for swap made my phone into a dog. |
Re: Fix for Class 10 microSD cards
Quote:
I renamed old module (as a backup), copied in the new one, rebooted, used a class 10 SD card that previously had problems, experienced no errors. |
Re: Fix for Class 10 microSD cards
Quote:
Obviously if you're using it for swap, it is always in use, and that's always going to result in catastrophic failure. I think one solution is to create your own "unmount SD card" script, make a Queen Beecon widget on your desktop or something to call it when you want to remove your cover. It would need to alert you if any partitions cannot be unmounted for any reason, that way you know it is not safe to remove the back cover. Even better yet, glue a magnet onto the sensor so your N900 thinks the cover is always on. :) |
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
I think when you replace the default kernel you will get the reboot loop problem. So, just replace for power kernel.
I´ve tested here, all good so far. Thank you!!!:D |
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
Quote:
Anyway, can someone explain me rationale of unmounting/cutting microSD card on removing cover? There is one at all, or designers just thought that users are idiots and will remove card hard-way when in use? |
Re: Fix for Class 10 microSD cards
Quote:
Why would you open the back cover and not want the microSD to unmount? What is there besides the microSD that could be changed during runtime? You can't change the battery without powering down. |
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
Quote:
No, I will not be installing multiboot. I wish to write to the NAND as little as possible and multiboot writes the kernel every change of boot. Uboot all the way (probably, if I ever get round to it!) QBW for mount/unmount? What did we lose a war? I am not chimping well manually running an unmount script for something that should be automatable. I just want to be able to take the back off without the card spazzing out. If only joerg still hung out here, id bet he could 'fix' the sd card driver. Anyway. I will be monitoring this thread with great interest, what with having a ropey LX Patriot 16GB card 'n all. |
Re: Fix for Class 10 microSD cards
Quote:
Quote:
|
Re: Fix for Class 10 microSD cards
Couple of things: There is no good argument for completely-unchangeable forced-unmount. Just... isn't. Unmounting card at back open is like unmounting a USB stick when your hand nears the front of your desktop computer (or pick whatever orientation relative to your computer your hand will be to get to your desktop's USB ports. Sure, you may only be trying to pull out the USB device(s) and/or press the power switch. Or maybe you wanted to brush of some dust or your hand was there for computer-unrelated reasons.
Oh, and yes, you can change battery without shutting down - it's a major hack and requires tricking your N900 into thinking it's charging even when it isn't, but I think (memory's hazy) I've pulled that off with a combination of a tiny inch-sized micro-to-mini and micro-to-normal USB adapter (one or the other, not both at once) and USB host mode. Or just having access to an outlet and charger at which point you don't need to 'trick' it, it just does. But you do get about 30 seconds to hotswap the battery, which is more than enough time. Especially if you can open the battery cover BEFORE you switch batteries. (And no it doesn't matter if 5 users out there do this, or 50, or thousands. Some do, and giving people options shouldn't be limited to the very popular ones.) More to the point though - ever drop the N900? Ever drop it without a case? If your back cover has NEVER managed to come off in the process, you have been very lucky, or very skilled at breaking the N900's fall by controlling its fall with your legs or other body parts. I have dropped my N900 a rather large amount of times, and I have had the back cover fly off. Especially for users who use SD cards for swap (which is a lot more than hot-swap batteries, if you're going to ignore that demographic), a drop or other event (any event, like letting your kids fiddle with your device or something) that results in the back cover opening can be much less pleasant for usability than data corruption. Which, whether it's opening the back cover or just yanking your card out unmounted, is about equally likely if you're in the middle of writing data to your card, and similarly unlikely if nothing is writing to your microSD card. If you aren't using your card for swap, force unmount is equally possibly annoying, but not a major deal. If you are using your card for swap, force unmount can be disastrous (more often just really annoying, disastrous is possible but less likely), while the vi_ proposed option allows for much more pleasant outcomes. |
Re: Fix for Class 10 microSD cards
Quote:
In the past (not with this particular change) I've gotten the boot loop when I flashed a kernel but forgot to install the modules first. So encoiuntering that after messing with a module does seem to point to something gone awry. I'm using the power47 from extras-devel, I'm also using multiboot and the modified backupmenu in multiboot, I don't know if those things change how the boot process works as far as kernel module loading goes... I don't think it should make a difference, but obviously something is not working the same for you guys. I downloaded the module I attached here and it is indeed the one I am using: Code:
user@N900 ~/MyDocs/Downloads $ unzip sdfix-power47.zip Hope someone else can perhaps detect what might be going on. |
Re: Fix for Class 10 microSD cards
Quote:
It would be far easier to test this using rmmod and modprobe but unfortunately Maemo doesn't let you do this as the watchdog resets the device when you run "rmmod omap_hsmmc.ko". Anyone know a way around this? |
Re: Fix for Class 10 microSD cards
Disable the lifeguard timer.
|
Re: Fix for Class 10 microSD cards
I finally got my N900 back on Wednesday - and the compiled module didn't work for me either on stock PR 1.3, to such an extent that BackupMenu couldn't even read mmcblk0 or 1. I was almost stuffed as I'd overwritten the module in /lib/modules on my rootfs backup, but thankfully I still had an old bfs-kernel uImage with the modules matching so was able to boot BackupMenu successfully. I then patched kernel-power46 myself with the diff posted earlier in the thread and booted from that - all was fine, although installing the kernel-modules flagged up the copied module in 2.6.28-omap1 as missing symtab and strtab. The one I've compiled for kernel-power is fine, though, so there's definitely something amiss with the hosted files?
|
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
@retsaw
Yea, i remember that discussion. But, we consider that users of modified driver want it on purpose, and are not idiots pulling out microSD card without unmounting it, especially when we have swap there ;) I hope someone skilled enough (unfortunately, I'm definitely not) to "fix" driver will come to that conclusion also... |
Re: Fix for Class 10 microSD cards
IMHO, anybody inclined enough to be running swap on the external microsd, has the ability to swapoff before yanking the back cover.
Can anybody confirm this is actually controlled by the driver? It makes no sense that it would be. |
Re: Fix for Class 10 microSD cards
I don't think it has anything to do with the driver in question at all. It is N900-specific behavior.
|
Re: Fix for Class 10 microSD cards
Quote:
Code:
~ $ sha1sum /lib/modules/2.6.28-omap1/omap_hsmmc.ko |
Re: Fix for Class 10 microSD cards
1 Attachment(s)
That doesn't match the sha1sum of the file linked in the first post. Also, that file contains the magic "2.6.28.10power-omap1" which is not right.
I've attached my module that I am running on my N900 for stock kernel PR1.3. |
Re: Fix for Class 10 microSD cards
Quote:
Code:
~ $ sha1sum /lib/modules/2.6.28.10power46/omap_hsmmc.ko |
Re: Fix for Class 10 microSD cards
Quote:
|
Re: Fix for Class 10 microSD cards
Quote:
Anyway, sorry then for mentioning the driver - my fault, i followed statement in few post earlier, that "maybe joerg would be able to "fix" the driver". Anyway, if it is specific behavior, it is controlled (sensor) purely by hardware, without any software, propertiary or not, support? I don't think so, but I may be wrong. If that's the case, hardware mod with magnet would be best thing to do. |
All times are GMT. The time now is 13:00. |
vBulletin® Version 3.8.8