Re: [iPAQ] 2 GB SD-card

From: Nicolas George <nicolas.george_at_ens.fr>
Date: Tue, 20 Jun 2006 14:05:42 +0200

Le tridi 13 prairial, an CCXIV, Nicolas George a écrit :
> I just bought a 2 GB SD-card to use it on my iPaq, but it is not readable:
> when I plug it and try to read it (raw device read using dd), I get:
<snip>
> and dd dies with an I/O error. Furthermore, /proc/partitions reports 980224.
> On the other hand, I can read it with an USB card reader, and the true size
> is 1960448.

That is a known issue, which has been recently addressed in the lkmlı. A fix
was made in the 2.6 kernel. With some help from Todd Blumer, I was able to
backport it to the MMC/SD driver in iPaq 2.4 kernel (it is very simple).

I used the patched version for a few days, and reading from the card did not
cause any problem, so I believe it is correct. Here is the diff:

--- linux-2.4.19-rmk6-pxa1-hh37/drivers/mmc/mmc_core.c.orig 2003-09-18 16:32:37.000000000 +0200
+++ linux-2.4.19-rmk6-pxa1-hh37/drivers/mmc/mmc_core.c 2006-06-16 16:19:15.000000000 +0200
@@ -131,6 +131,10 @@
         csd->vdd_w_curr_min = (buf[10] & 0xe0) >> 5;
         csd->vdd_w_curr_max = (buf[10] & 0x1c) >> 2;
         csd->c_size_mult = ((buf[10] & 0x03) << 1) | ((buf[11] & 0x80) >> 7);
+ if(csd->read_bl_len > 9) {
+ csd->c_size_mult += csd->read_bl_len - 9;
+ csd->read_bl_len = 9;
+ }
         switch ( csd->csd_structure ) {
         case CSD_STRUCT_VER_1_0:
         case CSD_STRUCT_VER_1_1:

1: The problem is that the data structure used to report the card geometry
to the host can express up to exactly 2^21 (2M) sectors. Thus, cards bigger
than 1 giga-octet lie about their sector size to get a few extra bits.

-- 
  Nicolas George

Received on Tue Jun 20 2006 - 08:05:57 EDT

This archive was generated by hypermail 2.2.0 : Tue Jun 20 2006 - 08:10:52 EDT