32 #ifndef __SDMMC_18XX_43XX_H_
33 #define __SDMMC_18XX_43XX_H_
46 #define CMD_MASK_RESP (0x3UL << 28)
47 #define CMD_RESP(r) (((r) & 0x3) << 28)
48 #define CMD_RESP_R0 (0 << 28)
49 #define CMD_RESP_R1 (1 << 28)
50 #define CMD_RESP_R2 (2 << 28)
51 #define CMD_RESP_R3 (3 << 28)
52 #define CMD_BIT_AUTO_STOP (1 << 24)
53 #define CMD_BIT_APP (1 << 23)
54 #define CMD_BIT_INIT (1 << 22)
55 #define CMD_BIT_BUSY (1 << 21)
56 #define CMD_BIT_LS (1 << 20)
57 #define CMD_BIT_DATA (1 << 19)
58 #define CMD_BIT_WRITE (1 << 18)
59 #define CMD_BIT_STREAM (1 << 17)
60 #define CMD_MASK_CMD (0xff)
61 #define CMD_SHIFT_CMD (0)
63 #define CMD(c, r) ( ((c) & CMD_MASK_CMD) | CMD_RESP((r)) )
65 #define CMD_IDLE CMD(MMC_GO_IDLE_STATE, 0) | CMD_BIT_LS | CMD_BIT_INIT
66 #define CMD_SD_OP_COND CMD(SD_APP_OP_COND, 1) | CMD_BIT_LS | CMD_BIT_APP
67 #define CMD_SD_SEND_IF_COND CMD(SD_CMD8, 1) | CMD_BIT_LS
68 #define CMD_MMC_OP_COND CMD(MMC_SEND_OP_COND, 3) | CMD_BIT_LS | CMD_BIT_INIT
69 #define CMD_ALL_SEND_CID CMD(MMC_ALL_SEND_CID, 2) | CMD_BIT_LS
70 #define CMD_MMC_SET_RCA CMD(MMC_SET_RELATIVE_ADDR, 1) | CMD_BIT_LS
71 #define CMD_SD_SEND_RCA CMD(SD_SEND_RELATIVE_ADDR, 1) | CMD_BIT_LS
72 #define CMD_SEND_CSD CMD(MMC_SEND_CSD, 2) | CMD_BIT_LS
73 #define CMD_SEND_EXT_CSD CMD(MMC_SEND_EXT_CSD, 1) | CMD_BIT_LS | CMD_BIT_DATA
74 #define CMD_DESELECT_CARD CMD(MMC_SELECT_CARD, 0)
75 #define CMD_SELECT_CARD CMD(MMC_SELECT_CARD, 1)
76 #define CMD_SET_BLOCKLEN CMD(MMC_SET_BLOCKLEN, 1)
77 #define CMD_SEND_STATUS CMD(MMC_SEND_STATUS, 1)
78 #define CMD_READ_SINGLE CMD(MMC_READ_SINGLE_BLOCK, 1) | CMD_BIT_DATA
79 #define CMD_READ_MULTIPLE CMD(MMC_READ_MULTIPLE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_AUTO_STOP
80 #define CMD_SD_SET_WIDTH CMD(SD_APP_SET_BUS_WIDTH, 1) | CMD_BIT_APP
81 #define CMD_STOP CMD(MMC_STOP_TRANSMISSION, 1) | CMD_BIT_BUSY
82 #define CMD_WRITE_SINGLE CMD(MMC_WRITE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_WRITE
83 #define CMD_WRITE_MULTIPLE CMD(MMC_WRITE_MULTIPLE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_WRITE | CMD_BIT_AUTO_STOP
86 typedef struct _mci_card_struct {