diff options
author | Quinn Jensen <quinn.jensen@freescale.com> | 2007-05-24 18:23:28 -0600 |
---|---|---|
committer | Quinn Jensen <quinn.jensen@freescale.com> | 2007-05-24 18:23:28 -0600 |
commit | bf5b43c760ebf7f2a5be171bddf55ace120e05e9 (patch) | |
tree | 4d492bcaac032076d0d73c95cd036274e5609f88 /include | |
parent | 2da6d55c901a6d662bef977e9933d40018313001 (diff) |
This patch adds SDHC functionality to the MX31 Rel3 (2.6.19.2) kernel.
It is a direct port of a patch posted to lkml by Philip Langdale. Note
that Philip's original patch expects that the mmc high-speed patch has
already been applied, which is not the case for the MX31 kernel.
Upstream patch information:
URL: http://lkml.org/lkml/2007/1/4/90
Date: Thu, 04 Jan 2007 06:57:32 -0800
From: Philip Langdale <>
Subject: [PATCH 2.6.19] mmc: Add support for SDHC cards (Take 5)
------------------------------------------------------------------------
Thanks to the generous donation of an SDHC card by John Gilmore, and the
surprisingly enlightened decision by the SD Card Association to publish
useful specs, I've been able to bash out support for SDHC. The changes
are not too profound:
i) Add a card flag indicating the card uses block level addressing and
check it in the block driver. As we never took advantage of byte-level
addressing, this simply involves skipping the block -> byte translation
when sending commands.
ii) The layout of the CSD is changed - a set of fields are discarded to
make space for a larger C_SIZE. We did not reference any of the
discarded fields except those related to the C_SIZE.
iii) Read and write timeouts are fixed values and not calculated from
CSD values.
iv) Before invoking SEND_APP_OP_COND, we must invoke the new
SEND_IF_COND to inform the card we support SDHC.
I've done some basic read and write tests and everything seems to work
fine but one should obviously use caution in case it eats your data.
Signed-off-by: Philipl Langdale <philipl@overt.org>
http://www.bitshrine.org/gpp/linux-2.6.19.2-mx-mmc_sdhc.patch
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mmc/card.h | 3 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 1 | ||||
-rw-r--r-- | include/linux/mmc/protocol.h | 14 |
3 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index cfb8963864cb..de40a9ab4332 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -63,6 +63,7 @@ struct mmc_card { #define MMC_STATE_SDCARD (1<<3) /* is an SD card */ #define MMC_STATE_READONLY (1<<4) /* card is read-only */ #define MMC_STATE_SDIOCARD (1<<5) /* is an SDIO card */ +#define MMC_STATE_BLOCKADDR (1<<6) /* card uses block-addressing */ u32 raw_cid[4]; /* raw card CID */ u32 raw_csd[4]; /* raw card CSD */ u32 raw_scr[2]; /* raw card SCR */ @@ -77,6 +78,7 @@ struct mmc_card { #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) #define mmc_card_sdio(c) ((c)->state & MMC_STATE_SDIOCARD) #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) +#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) @@ -84,6 +86,7 @@ struct mmc_card { #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) #define mmc_card_set_sdio(c) ((c)->state |= MMC_STATE_SDIOCARD) #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) +#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) ((c)->dev.bus_id) diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5bceeacff12f..aa77f3a74109 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -46,6 +46,7 @@ struct mmc_command { #define MMC_RSP_R4 (MMC_RSP_PRESENT) #define MMC_RSP_R5 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) #define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC) +#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) #define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE)) diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h index 18e09f5c6023..7e78d625f488 100644 --- a/include/linux/mmc/protocol.h +++ b/include/linux/mmc/protocol.h @@ -81,9 +81,13 @@ #define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */ /* SD commands type argument response */ - /* class 8 */ + /* class 0 */ /* This is basically the same command as for MMC with some quirks. */ #define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */ +#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */ + + /* class 10 */ +/* #define SD_SWITCH should go here */ /* Application commands */ #define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ @@ -105,6 +109,14 @@ #define SDIO_RW_INC 1 /* + * SD_SEND_IF_COND argument format: + * + * [31:12] Reserved (0) + * [11:8] Host Voltage Supply Flags + * [7:0] Check Pattern (0xAA) + */ + +/* MMC status in R1 Type e : error bit |