[PATCH] MMC: Proper MMC command classes support

Defines for the different command classes as defined in the MMC and SD
specifications.

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

authored by Pierre Ossman and committed by Russell King 912490db 9636273d

+31 -1
+4 -1
drivers/mmc/mmc_block.c
··· 383 383 struct mmc_blk_data *md; 384 384 int err; 385 385 386 - if (card->csd.cmdclass & ~0x1ff) 386 + /* 387 + * Check that the card supports the command class(es) we need. 388 + */ 389 + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) 387 390 return -ENODEV; 388 391 389 392 if (card->csd.read_blkbits < 9) {
+27
include/linux/mmc/protocol.h
··· 195 195 #define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */ 196 196 #define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */ 197 197 198 + /* 199 + * Card Command Classes (CCC) 200 + */ 201 + #define CCC_BASIC (1<<0) /* (0) Basic protocol functions */ 202 + /* (CMD0,1,2,3,4,7,9,10,12,13,15) */ 203 + #define CCC_STREAM_READ (1<<1) /* (1) Stream read commands */ 204 + /* (CMD11) */ 205 + #define CCC_BLOCK_READ (1<<2) /* (2) Block read commands */ 206 + /* (CMD16,17,18) */ 207 + #define CCC_STREAM_WRITE (1<<3) /* (3) Stream write commands */ 208 + /* (CMD20) */ 209 + #define CCC_BLOCK_WRITE (1<<4) /* (4) Block write commands */ 210 + /* (CMD16,24,25,26,27) */ 211 + #define CCC_ERASE (1<<5) /* (5) Ability to erase blocks */ 212 + /* (CMD32,33,34,35,36,37,38,39) */ 213 + #define CCC_WRITE_PROT (1<<6) /* (6) Able to write protect blocks */ 214 + /* (CMD28,29,30) */ 215 + #define CCC_LOCK_CARD (1<<7) /* (7) Able to lock down card */ 216 + /* (CMD16,CMD42) */ 217 + #define CCC_APP_SPEC (1<<8) /* (8) Application specific */ 218 + /* (CMD55,56,57,ACMD*) */ 219 + #define CCC_IO_MODE (1<<9) /* (9) I/O mode */ 220 + /* (CMD5,39,40,52,53) */ 221 + #define CCC_SWITCH (1<<10) /* (10) High speed switch */ 222 + /* (CMD6,34,35,36,37,50) */ 223 + /* (11) Reserved */ 224 + /* (CMD?) */ 198 225 199 226 /* 200 227 * CSD field definitions