Re: h1940 - kernel 2.6.20-rc1 can't read my SD card

From: Carlo Palma <carlopalma_at_salug.it>
Date: Fri, 26 Jan 2007 14:57:17 +0100

On Friday 26 January 2007 03:56, you wrote:
> At 10:07 AM 1/25/2007, Carlo Palma wrote:
> >On Tuesday 23 January 2007 23:17, Tom Talpey wrote:
> >> I am having the same problem, but I have managed to fix at least one
> >> of my cards by adding a clock limit to the h1940_mmc_cfg structure
> >> in mach-h1940.c. I have another card which it does not fix though
> >> (133x). These cards all worked fine in the previous kernels.
> >
> >I think I should understand some fundamentals of the mmc layer, before
> > to apply your patch. I'll report any result as soon as possible.
>
> I figured out the reason for the failure in my high-speed cards. In the
> new mmc layer, there are two commands issued to probe a high-speed
> SD card's "switch". The second one fails with a CRC error. At that
> point the mmc layer labels the card as dead and stops using it.
>
> I suspect that this may be due to the SD slot on the h1940, but it
> could also be a core mmc issue. In any case, limiting the maximum clock
> to 3MHZ, and avoiding the problematic SD command, allows all three of
> my cards to work fine again. I'd consider this a temporary workaround,
> until we get to the root cause. This patch is against 2.6.20-rc5 +
> various of rtp's patches but it should be pretty close for other rc's.
>
> The patch also unconditionally enables the clock message, so you can
> see things as they are probed. If a card is marked dead, its clock goes
> to 0MHz - a handy quick indicator. If the clock is over 3MHz, sometimes
> it just hangs though, usually when starting init, or later.
>
> Tom.

It works for my SD card!
ok maybe it's not _the_ solution.. but it let me to use the h1940 with the
suspend support!
many many thanks Tom!
I'll post soon the logs, other verbose output and some tests !

Still thanks,
Carlo Palma

> Index: kernel/arch/arm/mach-s3c2410/mach-h1940.c
> ===================================================================
> --- kernel.orig/arch/arm/mach-s3c2410/mach-h1940.c
> +++ kernel/arch/arm/mach-s3c2410/mach-h1940.c
> @@ -153,6 +153,7 @@ static struct s3c24xx_mmc_platdata h1940
> .gpio_detect = S3C2410_GPF5,
> .set_power = NULL,
> .ocr_avail = MMC_VDD_32_33,
> + .f_max = 3000000, // TEMP - limit clock to 3MHz
> };
>
>
> Index: kernel/drivers/mmc/mmc.c
> ===================================================================
> --- kernel.orig/drivers/mmc/mmc.c
> +++ kernel/drivers/mmc/mmc.c
> @@ -368,7 +368,7 @@ static inline void mmc_set_ios(struct mm
> {
> struct mmc_ios *ios = &host->ios;
>
> - pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u
> width %u\n", + /*pr_debug(*/printk(KERN_INFO "%s: clock %uHz
> busmode %u powermode %u cs %u Vdd %u width %u\n", mmc_hostname(host),
> ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, ios->vdd,
> ios->bus_width);
> @@ -1222,6 +1222,10 @@ static void mmc_read_switch_caps(struct
> if (status[13] & 0x02)
> card->sw_caps.hs_max_dtr = 50000000;
>
> +// TEMP
> +// skip the following command, it fails with a CRC error on many
> cards... + continue;
> +
> memset(&cmd, 0, sizeof(struct mmc_command));
>
> cmd.opcode = SD_SWITCH;

Received on Fri Jan 26 2007 - 08:58:54 EST

This archive was generated by hypermail 2.2.0 : Fri Jan 26 2007 - 08:59:12 EST