* [PATCH 0/2] Proper MMC command classes support
@ 2005-05-17 22:12 Pierre Ossman
2005-05-17 22:14 ` [PATCH 1/2] " Pierre Ossman
2005-05-17 22:19 ` [PATCH 2/2] " Pierre Ossman
0 siblings, 2 replies; 3+ messages in thread
From: Pierre Ossman @ 2005-05-17 22:12 UTC (permalink / raw)
To: LKML; +Cc: Russell King
The MMC block layer currently contains an if-clause which only seems to
serve the purpose of killing forward compatibility:
if (card->csd.cmdclass & ~0x1ff)
return -ENODEV;
This checks for (what I presume) command classes that were undefined
when this code was written. Since these are now starting to be used,
this code is causing a lot of problems. The following two patches tries
to make a more sane check of the command classes.
(Note. The new command class is for high speed cards to allow higher
transfer rates than normal)
Rgds
Pierre
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] Proper MMC command classes support
2005-05-17 22:12 [PATCH 0/2] Proper MMC command classes support Pierre Ossman
@ 2005-05-17 22:14 ` Pierre Ossman
2005-05-17 22:19 ` [PATCH 2/2] " Pierre Ossman
1 sibling, 0 replies; 3+ messages in thread
From: Pierre Ossman @ 2005-05-17 22:14 UTC (permalink / raw)
To: LKML; +Cc: Russell King
[-- Attachment #1: Type: text/plain, Size: 137 bytes --]
Defines for the different command classes as defined in the MMC and SD
specifications.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
[-- Attachment #2: mmc-ccc.patch --]
[-- Type: text/x-patch, Size: 1548 bytes --]
Index: linux-wbsd/include/linux/mmc/protocol.h
===================================================================
--- linux-wbsd/include/linux/mmc/protocol.h (revision 134)
+++ linux-wbsd/include/linux/mmc/protocol.h (working copy)
@@ -209,6 +209,33 @@
#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */
+/*
+ * Card Command Classes (CCC)
+ */
+#define CCC_BASIC (1<<0) /* (0) Basic protocol functions */
+ /* (CMD0,1,2,3,4,7,9,10,12,13,15) */
+#define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */
+ /* (CMD11) */
+#define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */
+ /* (CMD16,17,18) */
+#define CCC_STREAM_WRITE (1<<3) /* (3) Stream write commands */
+ /* (CMD20) */
+#define CCC_BLOCK_WRITE (1<<4) /* (4) Block write commands */
+ /* (CMD16,24,25,26,27) */
+#define CCC_ERASE (1<<5) /* (5) Ability to erase blocks */
+ /* (CMD32,33,34,35,36,37,38,39) */
+#define CCC_WRITE_PROT (1<<6) /* (6) Able to write protect blocks */
+ /* (CMD28,29,30) */
+#define CCC_LOCK_CARD (1<<7) /* (7) Able to lock down card */
+ /* (CMD16,CMD42) */
+#define CCC_APP_SPEC (1<<8) /* (8) Application specific */
+ /* (CMD55,56,57,ACMD*) */
+#define CCC_IO_MODE (1<<9) /* (9) I/O mode */
+ /* (CMD5,39,40,52,53) */
+#define CCC_SWITCH (1<<10) /* (10) High speed switch */
+ /* (CMD6,34,35,36,37,50) */
+ /* (11) Reserved */
+ /* (CMD?) */
/*
* SD bus widths
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] Proper MMC command classes support
2005-05-17 22:12 [PATCH 0/2] Proper MMC command classes support Pierre Ossman
2005-05-17 22:14 ` [PATCH 1/2] " Pierre Ossman
@ 2005-05-17 22:19 ` Pierre Ossman
1 sibling, 0 replies; 3+ messages in thread
From: Pierre Ossman @ 2005-05-17 22:19 UTC (permalink / raw)
To: LKML; +Cc: Russell King
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
Removes the check for high command classes and instead checks that the
command classes needed are present.
Previous solution killed forward compatibility at no apparent gain.
Signed-of-by: Pierre Ossman <drzeus@drzeus.cx>
This patch only checks for CCC_BLOCK_READ even though CCC_BLOCK_WRITE is
also needed. My intention is to make the card read-only if the write
command class is unavailable. But such a patch will conflict with the SD
patches previously submitted. So I need to know which version should be
used as a base.
[-- Attachment #2: mmc-block-ccc.patch --]
[-- Type: text/x-patch, Size: 493 bytes --]
Index: linux-wbsd/drivers/mmc/mmc_block.c
===================================================================
--- linux-wbsd/drivers/mmc/mmc_block.c (revision 134)
+++ linux-wbsd/drivers/mmc/mmc_block.c (working copy)
@@ -443,7 +443,10 @@
struct mmc_blk_data *md;
int err;
- if (card->csd.cmdclass & ~0x1ff)
+ /*
+ * Check that the card supports the command class(es) we need.
+ */
+ if (!(card->csd.cmdclass & CCC_BLOCK_READ))
return -ENODEV;
if (card->csd.read_blkbits < 9) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-05-17 22:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-17 22:12 [PATCH 0/2] Proper MMC command classes support Pierre Ossman
2005-05-17 22:14 ` [PATCH 1/2] " Pierre Ossman
2005-05-17 22:19 ` [PATCH 2/2] " Pierre Ossman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox