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

From: Tom Talpey <tmtalpey_at_rcn.com>
Date: Sun, 28 Jan 2007 21:46:43 -0500

At 11:27 AM 1/27/2007, Tom Talpey wrote:
>I'll keep poking around, but I suspect we need to talk to the mmc
>maintainers. As a workaround, I guess we could hack the s3cmci driver
>to suppress the switch request.

Here's a patch to do just that. It's inelegant and simplistic, but it works
well and does not require touching non-s3c parts of the kernel. Perhaps
it will help. This patch applies to the s3cmci.c driver in rtp's directory
<http://www.rtp-net.org/ipaq/patches/new_mmc/>

The test for arg==80fffff1 is important because there are several other
SD_SWITCH commands which should not be suppressed, such as setting
4-bit width. When the highspeed set is requested, the code simply returns
all 0's without commanding the card. This results in the mmc driver printing
a message and leaving the card in lowspeed mode.

I'd love to see if there is a way to allow the cards to survive the switch
to highspeed mode and work at the full 34Mhz. But 16.875MHz at 4-bits
wide is still good at ~8MB/sec. I do not have access to other s3c-based
machines to test other strategies, so this hack is constrained to only the
h1940 for now.

Tom.

Index: kernel/drivers/mmc/s3cmci.c

Patch the s3cmci driver to suppress the attempted switch to highspeed mode
from the mmc layer during probe. This causes card CRC errors on the iPAQ h1940
and possibly other s3c2410-based hardware.

Signed-off-by: Tom Talpey <tmtalpey_at_rcn.com>

===================================================================
--- kernel.orig/drivers/mmc/s3cmci.c
+++ kernel/drivers/mmc/s3cmci.c
@@ -933,6 +933,18 @@ static void s3cmci_send_request(struct m
        struct mmc_command *cmd = host->cmd_is_stop?mrq->stop:mrq->cmd;
 
        host->ccnt++;
+
+ /* Suppress switching card to highspeed mode */
+ if (machine_is_h1940() && cmd->opcode == SD_SWITCH && cmd->arg == 0x80fffff1) {
+ struct scatterlist *sg = cmd->data->sg;
+ memset(page_address(sg->page) + sg->offset, 0, sg->length);
+ cmd->error = MMC_ERR_NONE;
+ cmd->data->error = MMC_ERR_NONE;
+ dbg(host, dbg_conf, "suppress SD_SWITCH @%ukHz\n", mmc->f_max/1000);
+ mmc_request_done(mmc, mrq);
+ return;
+ }
+
 #ifdef CONFIG_MMC_DEBUG
        prepare_dbgmsg(host, cmd, host->cmd_is_stop);
 #endif
Received on Sun Jan 28 2007 - 21:47:22 EST

This archive was generated by hypermail 2.2.0 : Sun Jan 28 2007 - 21:47:40 EST