PERFORCE change 106794 for review
Warner Losh
imp at FreeBSD.org
Wed Sep 27 13:00:36 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106794
Change 106794 by imp at imp_lighthouse on 2006/09/27 20:00:21
Lots of new defines from SD 2.0 standard (lite)
Affected files ...
.. //depot/projects/arm/src/sys/dev/mmc/mmcreg.h#8 edit
Differences ...
==== //depot/projects/arm/src/sys/dev/mmc/mmcreg.h#8 (text+ko) ====
@@ -45,22 +45,22 @@
#define MMC_RSP_CRC (1ul << 2) /* Expect valid crc */
#define MMC_RSP_BUSY (1ul << 3) /* Card may send busy */
#define MMC_RSP_OPCODE (1ul << 4) /* Response include opcode */
-#define MMC_CMD_AC (0ul << 5) /* AC? */
-#define MMC_CMD_ADTC (1ul << 5) /* ADTC? */
-#define MMC_CMD_BC (2ul << 5) /* BC? */
-#define MMC_CMD_BCR (3ul << 5) /* BCR? */
-#define MMC_RSP_MASK 0x1ful
-#define MMC_CMD_MASK (3ul << 5)
+#define MMC_CMD_AC (0ul << 5) /* AC? */
+#define MMC_CMD_ADTC (1ul << 5) /* ADTC? */
+#define MMC_CMD_BC (2ul << 5) /* BC? */
+#define MMC_CMD_BCR (3ul << 5) /* BCR? */
+#define MMC_RSP_MASK 0x1ful
+#define MMC_CMD_MASK (3ul << 5)
/* Possible response types defined in the standard: */
-#define MMC_RSP_NONE (0)
-#define MMC_RSP_R1 (MMC_RPS_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
+#define MMC_RSP_NONE (0)
+#define MMC_RSP_R1 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
#define MMC_RSP_R1B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY)
#define MMC_RSP_R2 (MMC_RSP_PRESENT | MMC_RSP_136 | MMC_RSP_CRC)
#define MMC_RSP_R3 (MMC_RSP_PRESENT)
#define MMC_RSP_R6 (MMC_RSP_PRESENT | MMC_RSP_CRC)
/* R7 -- new in sd 2.0 */
-#define MMC_RSP(x) ((x) & MMC_RSP_MASK)
+#define MMC_RSP(x) ((x) & MMC_RSP_MASK)
uint32_t retries;
uint32_t error;
#define MMC_ERR_NONE 0
@@ -73,6 +73,55 @@
struct mmc_request *mrq; /* backpointer to request */
};
+/*
+ * R1 responses
+ *
+ * Types (per SD 2.0 standard)
+ * e : error bit
+ * s : status bit
+ * r : detected and set for the actual command response
+ * x : Detected and set during command execution. The host can get
+ * the status by issuing a command with R1 response.
+ *
+ * Clear Condition (per SD 2.0 standard)
+ * a : according to the card current state.
+ * b : always related to the previous command. reception of a valid
+ * command will clear it (with a delay of one command).
+ * c : clear by read
+ */
+#define R1_OUT_OF_RANGE (1u << 31) /* erx, c */
+#define R1_ADDRESS_ERROR (1u << 30) /* erx, c */
+#define R1_BLOCK_LEN_ERROR (1u << 29) /* erx, c */
+#define R1_ERASE_SEQ_ERROR (1u << 28) /* er, c */
+#define R1_ERASE_PARAM (1u << 27) /* erx, c */
+#define R1_WP_VIOLATION (1u << 26) /* erx, c */
+#define R1_CARD_IS_LOCKED (1u << 25) /* sx, a */
+#define R1_LOCK_UNLOCK_FAILED (1u << 24) /* erx, c */
+#define R1_COM_CRC_ERROR (1u << 23) /* er, b */
+#define R1_ILLEGAL_COMMAND (1u << 22) /* er, b */
+#define R1_CARD_ECC_FAILED (1u << 21) /* erx, c */
+#define R1_CC_ERROR (1u << 20) /* erx, c */
+#define R1_ERROR (1u << 19) /* erx, c */
+#define R1_CSD_OVERWRITE (1u << 16) /* erx, c */
+#define R1_WP_ERASE_SKIP (1u << 15) /* erx, c */
+#define R1_CARD_ECC_DISABLED (1u << 14) /* sx, a */
+#define R1_ERASE_RESET (1u << 13) /* sr, c */
+#define R1_CURRENT_STATE_MASK (0xfu << 9) /* sx, b */
+#define R1_READY_FOR_DATA (1u << 8) /* sx, a */
+#define R1_APP_CMD (1u << 5) /* sr, c */
+#define R1_AKE_SEQ_ERROR (1u << 3) /* er, c */
+#define R1_STATUS(x) (x & 0xFFFFE000
+#define R1_CURRENT_STATE(x) ((x) & R1_CURRENT_STATE_MASK) >> 9
+#define R1_STATE_IDLE 0
+#define R1_STATE_READY 1
+#define R1_STATE_IDENT 2
+#define R1_STATE_STBY 3
+#define R1_STATE_TRAN 4
+#define R1_STATE_DATA 5
+#define R1_STATE_RCV 6
+#define R1_STATE_PRG 7
+#define R1_STATE_DIS 8
+
struct mmc_data {
uint32_t flags;
#define MMC_DATA_WRITE (1UL << 8)
@@ -88,7 +137,7 @@
void (*done)(struct mmc_request *); /* Completion function */
void *done_data; /* requestor set data */
uint32_t flags;
-#define MMC_REQ_DONE 1
+#define MMC_REQ_DONE 1
};
/* Command definitions */
@@ -102,7 +151,7 @@
/* reserved: 5 */
#define MMC_SELECT_CARD 7
#define MMC_DESELECT_CARD 7
-#define MMC_SEND_IF_COND 8
+#define MMC_SEND_IF_COND 8
#define MMC_SEND_CSD 9
#define MMC_SEND_CID 10
#define MMC_READ_DAT_UNTIL_STOP 11
@@ -204,7 +253,7 @@
/* Linux has defines for lower bits down to 0, which were defined in prior */
/* specs to MMC 3.31. 3.31 redefined them to be reserved and also said that */
/* cards had to support the 2.7-3.6V. */
-#define MMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */
+#define MMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */
#define MMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */
#define MMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */
#define MMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */
@@ -221,7 +270,7 @@
#define MMC_OCR_330_340 (1U << 21) /* Vdd voltage 3.30 ~ 3.40 */
#define MMC_OCR_340_350 (1U << 22) /* Vdd voltage 3.40 ~ 3.50 */
#define MMC_OCR_350_360 (1U << 23) /* Vdd voltage 3.50 ~ 3.60 */
-#define MMC_OCR_CCS (1u << 30) /* Card Capacity status (SD vs SDHC) */
+#define MMC_OCR_CCS (1u << 30) /* Card Capacity status (SD vs SDHC) */
#define MMC_OCR_CARD_BUSY (1U << 31) /* Card Power up status */
#endif /* DEV_MMCREG_H */
More information about the p4-projects
mailing list