1433d6423SLionel Sambuc struct omap_mmchs_registers; 2433d6423SLionel Sambuc 3433d6423SLionel Sambuc struct omap_mmchs { 4433d6423SLionel Sambuc vir_bytes io_base; 5433d6423SLionel Sambuc vir_bytes io_size; 6433d6423SLionel Sambuc phys_bytes hw_base;/* HW address */ 7433d6423SLionel Sambuc int irq_nr; 8433d6423SLionel Sambuc struct omap_mmchs_registers * regs; 9433d6423SLionel Sambuc }; 10433d6423SLionel Sambuc 11433d6423SLionel Sambuc struct omap_mmchs_registers { 12433d6423SLionel Sambuc /* SD system configuration */ 13433d6423SLionel Sambuc vir_bytes SYSCONFIG; 14433d6423SLionel Sambuc /* SD system status */ 15433d6423SLionel Sambuc vir_bytes SYSSTATUS; 16433d6423SLionel Sambuc /* Configuration (functional mode,card initialization etc) */ 17433d6423SLionel Sambuc vir_bytes CON; 18433d6423SLionel Sambuc /* Transfer length configuration */ 19433d6423SLionel Sambuc vir_bytes BLK; 20433d6423SLionel Sambuc /* Command argument bit 38-8 of command format*/ 21433d6423SLionel Sambuc vir_bytes ARG; 22433d6423SLionel Sambuc /* Command and transfer mode */ 23433d6423SLionel Sambuc vir_bytes CMD; 24433d6423SLionel Sambuc /* SDMA System address */ 25433d6423SLionel Sambuc vir_bytes SDMASA; 26433d6423SLionel Sambuc /* Command response 0 and 1 */ 27433d6423SLionel Sambuc vir_bytes RSP10; 28433d6423SLionel Sambuc /* Command response 2 and 3 */ 29433d6423SLionel Sambuc vir_bytes RSP32; 30433d6423SLionel Sambuc /* Command response 4 and 5 */ 31433d6423SLionel Sambuc vir_bytes RSP54; 32433d6423SLionel Sambuc /* Command response 6 and 7 */ 33433d6423SLionel Sambuc vir_bytes RSP76; 34433d6423SLionel Sambuc /* Data register */ 35433d6423SLionel Sambuc vir_bytes DATA; 36433d6423SLionel Sambuc /* Present state */ 37433d6423SLionel Sambuc vir_bytes PSTATE; 38433d6423SLionel Sambuc /* Host control(power ,wake-up and transfer) */ 39433d6423SLionel Sambuc vir_bytes HCTL; 40433d6423SLionel Sambuc /* SD System control (reset,clocks and timeout) */ 41433d6423SLionel Sambuc vir_bytes SYSCTL; 42433d6423SLionel Sambuc /* SD Interrupt status */ 43433d6423SLionel Sambuc vir_bytes SD_STAT; 44433d6423SLionel Sambuc /* SD Interrupt Enable register */ 45433d6423SLionel Sambuc vir_bytes IE; 46433d6423SLionel Sambuc /* SD Interrupt Signal Enable register */ 47433d6423SLionel Sambuc vir_bytes ISE; 48433d6423SLionel Sambuc /* Capabilities of the host controller */ 49433d6423SLionel Sambuc vir_bytes CAPA; 50433d6423SLionel Sambuc /* Current capabilities of the host controller */ 51433d6423SLionel Sambuc vir_bytes CUR_CAPA; 52433d6423SLionel Sambuc }; 53433d6423SLionel Sambuc 54433d6423SLionel Sambuc /* version used on the AM335x */ 55433d6423SLionel Sambuc static struct omap_mmchs_registers regs_v1 = { 56433d6423SLionel Sambuc .SYSCONFIG = 0x110, 57433d6423SLionel Sambuc .SYSSTATUS = 0x114, 58433d6423SLionel Sambuc .CON = 0x12c, 59433d6423SLionel Sambuc .BLK = 0x204, 60433d6423SLionel Sambuc .ARG = 0x208, 61433d6423SLionel Sambuc .CMD = 0x20c, 62433d6423SLionel Sambuc .SDMASA = 0x200, 63433d6423SLionel Sambuc .RSP10 = 0x210, 64433d6423SLionel Sambuc .RSP32 = 0x214, 65433d6423SLionel Sambuc .RSP54 = 0x218, 66433d6423SLionel Sambuc .RSP76 = 0x21c, 67433d6423SLionel Sambuc .DATA = 0x220, 68433d6423SLionel Sambuc .PSTATE = 0x224, 69433d6423SLionel Sambuc .HCTL = 0x228, 70433d6423SLionel Sambuc .SYSCTL = 0x22c, 71433d6423SLionel Sambuc .SD_STAT = 0x230, 72433d6423SLionel Sambuc .IE = 0x234, 73433d6423SLionel Sambuc .ISE = 0x238, 74433d6423SLionel Sambuc .CAPA = 0x240, 75433d6423SLionel Sambuc .CUR_CAPA = 0x248, 76433d6423SLionel Sambuc }; 77433d6423SLionel Sambuc 78433d6423SLionel Sambuc /* version used on the DM37xx */ 79433d6423SLionel Sambuc /* DM and AM have the same register but shifted by 0x100. */ 80433d6423SLionel Sambuc static struct omap_mmchs_registers regs_v0 = { 81433d6423SLionel Sambuc .SYSCONFIG = 0x010, 82433d6423SLionel Sambuc .SYSSTATUS = 0x014, 83433d6423SLionel Sambuc .CON = 0x02c, 84433d6423SLionel Sambuc .BLK = 0x104, 85433d6423SLionel Sambuc .ARG = 0x108, 86433d6423SLionel Sambuc .CMD = 0x10c, 87433d6423SLionel Sambuc .SDMASA = 0x100, 88433d6423SLionel Sambuc .RSP10 = 0x110, 89433d6423SLionel Sambuc .RSP32 = 0x114, 90433d6423SLionel Sambuc .RSP54 = 0x118, 91433d6423SLionel Sambuc .RSP76 = 0x11c, 92433d6423SLionel Sambuc .DATA = 0x120, 93433d6423SLionel Sambuc .PSTATE = 0x124, 94433d6423SLionel Sambuc .HCTL = 0x128, 95433d6423SLionel Sambuc .SYSCTL = 0x12c, 96433d6423SLionel Sambuc .SD_STAT = 0x130, 97433d6423SLionel Sambuc .IE = 0x134, 98433d6423SLionel Sambuc .ISE = 0x138, 99433d6423SLionel Sambuc .CAPA = 0x140, 100433d6423SLionel Sambuc .CUR_CAPA = 0x148, 101433d6423SLionel Sambuc }; 102433d6423SLionel Sambuc 103433d6423SLionel Sambuc 104433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_AUTOIDLE (0x1 << 0) /* Internal clock gating strategy */ 105433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_AUTOIDLE_DIS (0x0 << 0) /* Clocks are free running */ 106433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_AUTOIDLE_EN (0x1 << 0) /* Automatic clock gating strategy */ 107433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SOFTRESET (0x1 << 1) /* Software reset bit writing */ 108433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_ENAWAKEUP (0x1 << 2) /* Wake-up feature control */ 109433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_ENAWAKEUP_DIS (0x0 << 2) /* Disable wake-up capability */ 110433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_ENAWAKEUP_EN (0x1 << 2) /* Enable wake-up capability */ 111433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SIDLEMODE (0x3 << 3) /* Power management */ 112433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SIDLEMODE_UNCONDITIONAL (0x0 << 3) /* Go into idle mode unconditionally upon request */ 113433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SIDLEMODE_IGNORE (0x1 << 3) /* Ignore ILDE requests */ 114433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SIDLEMODE_IDLE (0x2 << 3) /* Acknowledge IDLE request switch to wake-up mode */ 115433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_SIDLEMODE_SMART_IDLE (0x3 << 3) /* Smart-idle */ 116433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_CLOCKACTIVITY (0x3 << 8) /* Clock activity during wake-up */ 117433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_CLOCKACTIVITY_OFF (0x0 << 8) /* Interface and functional clock can be switched off */ 118433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_CLOCKACTIVITY_IF (0x1 << 8) /* Only Interface clock (functional can be switched off*/ 119433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_CLOCKACTIVITY_FUNC (0x2 << 8) /* Only Functional clock (interface clock can be switched off) */ 120433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_CLOCKACTIVITY_BOOTH (0x3 << 8) /* Booth the interface and functional clock are maintained */ 121433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_STANDBYMODE (0x3 << 12) /* Configuration for standby */ 122433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_STANDBYMODE_FORCE_STANDBY (0x0 << 12) /* Force standby mode upon idle request*/ 123433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_STANDBYMODE_NO_STANDBY (0x1 << 12) /* Never go into standby mode */ 124433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_STANDBYMODE_WAKEUP_INTERNAL (0x2 << 12) /* Go into wake-up mode based on internal knowledge */ 125433d6423SLionel Sambuc #define MMCHS_SD_SYSCONFIG_STANDBYMODE_WAKEUP_SMART (0x3 << 12) /* Go info wake-up mode when possible */ 126433d6423SLionel Sambuc 127433d6423SLionel Sambuc #define MMCHS_SD_SYSSTATUS_RESETDONE 0x01 128433d6423SLionel Sambuc 129433d6423SLionel Sambuc #define MMCHS_SD_CON_DW8 (0x1 << 5) /* 8-bit mode MMC select , For SD clear this bit */ 130433d6423SLionel Sambuc #define MMCHS_SD_CON_DW8_1BIT (0x0 << 5) /* 1 or 4 bits data width configuration(also set SD_HCTL) */ 131433d6423SLionel Sambuc #define MMCHS_SD_CON_DW8_8BITS (0x1 << 5) /* 8 bits data width configuration */ 132433d6423SLionel Sambuc #define MMCHS_SD_CON_INIT (0x1 << 1) /* Send initialization stream (all cards) */ 133433d6423SLionel Sambuc #define MMCHS_SD_CON_INIT_NOINIT (0x0 << 1) /* Do nothing */ 134433d6423SLionel Sambuc #define MMCHS_SD_CON_INIT_INIT (0x1 << 1) /* Send initialization stream */ 135*07cbc27cSLeonardo Fogel #define MMCHS_SD_CON_OD (0x1 << 0) /* Card open drain mode (MMC cards only) */ 136*07cbc27cSLeonardo Fogel #define MMCHS_SD_CON_OD_PP (0x0 << 0) /* No open drain (push-pull). */ 137*07cbc27cSLeonardo Fogel #define MMCHS_SD_CON_OD_OD (0x1 << 0) /* Open drain */ 138433d6423SLionel Sambuc 139433d6423SLionel Sambuc #define MMCHS_SD_BLK_NBLK (0xffffu << 16) /* Block count for the current transfer */ 140433d6423SLionel Sambuc #define MMCHS_SD_BLK_BLEN (0xfff << 0) /* Transfer block size */ 141433d6423SLionel Sambuc #define MMCHS_SD_BLK_BLEN_NOTRANSFER (0x0 << 0) /* No transfer */ 142433d6423SLionel Sambuc 143433d6423SLionel Sambuc #define MMCHS_SD_CMD_INDX (0x3f << 24) /* Command index */ 144433d6423SLionel Sambuc #define MMCHS_SD_CMD_INDX_CMD(x) (x << 24) /* MMC command index binary encoded values from 0 to 63 */ 145433d6423SLionel Sambuc 146433d6423SLionel Sambuc #define MMCHS_SD_ARG_MASK (0xffffffffu) /* Mask everything */ 147433d6423SLionel Sambuc #define MMCHS_SD_ARG_CMD8_VHS (0x1 << (16 - 8)) /* Voltage between 2.7 and 3.6 v*/ 148433d6423SLionel Sambuc #define MMCHS_SD_ARG_CMD8_CHECK_PATTERN (0xaa <<(8 - 8)) /* 10101010b pattern */ 149433d6423SLionel Sambuc 150433d6423SLionel Sambuc #define MMCHS_SD_CMD_TYPE (0x3 << 22) /* Command type. */ 151433d6423SLionel Sambuc #define MMCHS_SD_CMD_TYPE_OTHER (0x0 << 22) /* Other type of commands (like go idle) */ 152433d6423SLionel Sambuc #define MMCHS_SD_CMD_TYPE_BUS_SUSPEND (0x1 << 22) /* Upon CMD52 "Bus Suspend" operation */ 153433d6423SLionel Sambuc #define MMCHS_SD_CMD_TYPE_FUNCTION_SELECT (0x2 << 22) /* Upon CMD52 "Function Select" operation */ 154433d6423SLionel Sambuc #define MMCHS_SD_CMD_TYPE_IOABORT (0x3 << 22) /* Upon CMD12 and CMD21 "I/O Abort */ 155433d6423SLionel Sambuc #define MMCHS_SD_CMD_DP (0x1 << 21) /* Data present select */ 156433d6423SLionel Sambuc #define MMCHS_SD_CMD_DP_DATA (0x1 << 21) /* Additional data is present on the data lines */ 157433d6423SLionel Sambuc #define MMCHS_SD_CMD_DP_NODATA (0x0 << 21) /* No additional data is present on the data lines */ 158433d6423SLionel Sambuc #define MMCHS_SD_CMD_CICE (0x1 << 20) /* Command index response check enable */ 159433d6423SLionel Sambuc #define MMCHS_SD_CMD_CICE_ENABLE (0x1 << 20) /* Enable index check response */ 160433d6423SLionel Sambuc #define MMCHS_SD_CMD_CICE_DISABLE (0x0 << 20) /* Disable index check response */ 161433d6423SLionel Sambuc #define MMCHS_SD_CMD_CCCE (0x1 << 19) /* Command CRC7 Check enable on responses*/ 162433d6423SLionel Sambuc #define MMCHS_SD_CMD_CCCE_ENABLE (0x1 << 19) /* Enable CRC7 Check on response */ 163433d6423SLionel Sambuc #define MMCHS_SD_CMD_CCCE_DISABLE (0x0 << 19) /* Disable CRC7 Check on response */ 164433d6423SLionel Sambuc #define MMCHS_SD_CMD_RSP_TYPE (0x3 << 16) /* Response type */ 165433d6423SLionel Sambuc #define MMCHS_SD_CMD_RSP_TYPE_NO_RESP (0x0 << 16) /* No response */ 166433d6423SLionel Sambuc #define MMCHS_SD_CMD_RSP_TYPE_136B (0x1 << 16) /* Response length 136 bits */ 167433d6423SLionel Sambuc #define MMCHS_SD_CMD_RSP_TYPE_48B (0x2 << 16) /* Response length 48 bits */ 168433d6423SLionel Sambuc #define MMCHS_SD_CMD_RSP_TYPE_48B_BUSY (0x3 << 16) /* Response length 48 bits with busy after response */ 169433d6423SLionel Sambuc #define MMCHS_SD_CMD_MSBS (0x1 << 5) /* Multi/Single block select */ 170433d6423SLionel Sambuc #define MMCHS_SD_CMD_MSBS_SINGLE (0x0 << 5) /* Single block mode */ 171433d6423SLionel Sambuc #define MMCHS_SD_CMD_MSBS_MULTI (0x0 << 5) /* Multi block mode */ 172433d6423SLionel Sambuc #define MMCHS_SD_CMD_DDIR (0x1 << 4) /* Data transfer direction */ 173433d6423SLionel Sambuc #define MMCHS_SD_CMD_DDIR_READ (0x1 << 4) /* Data read (card to host) */ 174433d6423SLionel Sambuc #define MMCHS_SD_CMD_DDIR_WRITE (0x0 << 4) /* Data write (host to card) */ 175433d6423SLionel Sambuc #define MMCHS_SD_CMD_ACEN (0x1 << 2) /* Auto CMD12 Enable */ 176433d6423SLionel Sambuc #define MMCHS_SD_CMD_ACEN_DIS (0x0 << 2) /* Auto CMD12 Disable */ 177433d6423SLionel Sambuc #define MMCHS_SD_CMD_ACEN_EN (0x1 << 2) /* Auto CMD12 Enable */ 178433d6423SLionel Sambuc #define MMCHS_SD_CMD_BCE (0x1 << 1) /* Block Count Enable(for multi block transfer) */ 179433d6423SLionel Sambuc #define MMCHS_SD_CMD_BCE_DIS (0x0 << 1) /* Disabled block count for infinite transfer*/ 180433d6423SLionel Sambuc #define MMCHS_SD_CMD_BCE_EN (0x1 << 1) /* Enabled for multi block transfer with know amount of blocks */ 181433d6423SLionel Sambuc #define MMCHS_SD_CMD_DE (0x1 << 0) /* DMA enable */ 182433d6423SLionel Sambuc #define MMCHS_SD_CMD_DE_DIS (0x0 << 0) /* Disable DMA */ 183433d6423SLionel Sambuc #define MMCHS_SD_CMD_DE_EN (0x1 << 0) /* Enable DMA */ 184433d6423SLionel Sambuc #define MMCHS_SD_CMD_MASK ~(0x1 << 30 | 0x1 << 31 | 0x1 << 18 | 0x1 <<3) /* bits 30 , 31 and 18 are reserved */ 185433d6423SLionel Sambuc 186433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_CI (0x1 << 16) /* Card Inserted */ 187433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_CI_INSERTED (0x1 << 16) /* Card Inserted is inserted*/ 188*07cbc27cSLeonardo Fogel #define MMCHS_SD_PSTATE_BRE (0x1 << 11) /* Buffer read enable */ 189433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_BRE_DIS (0x0 << 11) /* Read BLEN bytes disabled*/ 190433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_BRE_EN (0x1 << 11) /* Read BLEN bytes enabled*/ 191*07cbc27cSLeonardo Fogel #define MMCHS_SD_PSTATE_BWE (0x1 << 10) /* Buffer Write enable */ 192433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_BWE_DIS (0x0 << 10) /* There is no room left in the buffer to write BLEN bytes of data */ 193433d6423SLionel Sambuc #define MMCHS_SD_PSTATE_BWE_EN (0x1 << 10) /* There is enough space in the buffer to write BLEN bytes of data*/ 194*07cbc27cSLeonardo Fogel #define MMCHS_SD_PSTATE_DATI (0x1 << 1) /* Command inhibit (mmc_dat) */ 195*07cbc27cSLeonardo Fogel #define MMCHS_SD_PSTATE_CMDI (0x1 << 0) /* Command inhibit (mmc_cmd) */ 196433d6423SLionel Sambuc 197433d6423SLionel Sambuc #define MMCHS_SD_HCTL_DTW (0x1 << 1) /*Data transfer width.(must be set after a successful ACMD6) */ 198433d6423SLionel Sambuc #define MMCHS_SD_HCTL_DTW_1BIT (0x0 << 1) /*1 bit transfer with */ 199433d6423SLionel Sambuc #define MMCHS_SD_HCTL_DTW_4BIT (0x1 << 1) /*4 bit transfer with */ 200433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDBP (0x1 << 8) /*SD bus power */ 201433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDBP_OFF (0x0 << 8) /*SD Power off (start card detect?) */ 202433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDBP_ON (0x1 << 8) /*SD Power on (start card detect?) */ 203433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDVS (0x7 << 9) /*SD bus voltage select */ 204433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDVS_VS18 (0x5 << 9) /*1.8 V */ 205433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDVS_VS30 (0x6 << 9) /*3.0 V */ 206433d6423SLionel Sambuc #define MMCHS_SD_HCTL_SDVS_VS33 (0x7 << 9) /*3.3 V */ 207433d6423SLionel Sambuc #define MMCHS_SD_HCTL_IWE (0x1 << 24)/* wake-up event on SD interrupt */ 208433d6423SLionel Sambuc #define MMCHS_SD_HCTL_IWE_DIS (0x0 << 24)/* Disable wake-up on SD interrupt */ 209433d6423SLionel Sambuc #define MMCHS_SD_HCTL_IWE_EN (0x1 << 24)/* Enable wake-up on SD interrupt */ 210433d6423SLionel Sambuc 211433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_CLKD (0x3ff << 6) /* 10 bits clock frequency select */ 212433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_SRD (0x1 << 26) /* Soft reset for mmc_dat line */ 213433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_SRC (0x1 << 25) /* Soft reset for mmc_cmd line */ 214433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_SRA (0x1 << 24) /* Soft reset all (host controller) */ 215433d6423SLionel Sambuc 216433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICE (0x1 << 0) /* Internal clock enable register */ 217433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICE_DIS (0x0 << 0) /* Disable internal clock */ 218433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICE_EN (0x1 << 0) /* Enable internal clock */ 219433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICS (0x1 << 1) /* Internal clock stable register */ 220433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICS_UNSTABLE (0x0 << 1) /* Internal clock is unstable */ 221433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_ICS_STABLE (0x1 << 1) /* Internal clock is stable */ 222433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_CEN (0x1 << 2) /* Card lock enable provide clock to the card */ 223433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_CEN_DIS (0x0 << 2) /* Internal clock is unstable */ 224433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_CEN_EN (0x1 << 2) /* Internal clock is stable */ 225433d6423SLionel Sambuc 226433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_DTO (0xf << 16) /* Data timeout counter */ 227433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_DTO_2POW13 (0x0 << 16) /* TCF x 2^13 */ 228433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_DTO_2POW14 (0x1 << 16) /* TCF x 2^14 */ 229*07cbc27cSLeonardo Fogel #define MMCHS_SD_SYSCTL_DTO_2POW20 (0x7 << 16) /* TCF x 2^20 */ 230433d6423SLionel Sambuc #define MMCHS_SD_SYSCTL_DTO_2POW27 (0xe << 16) /* TCF x 2^27 */ 231433d6423SLionel Sambuc 232*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_CERR (0x1 << 28) /* card error */ 233*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_DEB (0x1 << 22) /* data end bit error */ 234*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_DCRC (0x1 << 21) /* data CRC error */ 235*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_DTO (0x1 << 20) /* data timeout error */ 236*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_CIE (0x1 << 19) /* command index error */ 237*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_CEB (0x1 << 18) /* command end bit error */ 238*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_CCRC (0x1 << 17) /* command CRC error */ 239*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_CTO (0x1 << 16) /* command timeout error */ 240433d6423SLionel Sambuc #define MMCHS_SD_STAT_ERRI (0x01 << 15) /* Error interrupt */ 241433d6423SLionel Sambuc #define MMCHS_SD_STAT_ERROR_MASK (0xff << 15 | 0x3 << 24 | 0x03 << 28) 242*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_BRR (0x1 << 5) /* Buffer Read ready */ 243*07cbc27cSLeonardo Fogel #define MMCHS_SD_STAT_BWR (0x1 << 4) /* Buffer Write ready */ 244433d6423SLionel Sambuc #define MMCHS_SD_STAT_CC (0x1 << 0) /* Command complete status */ 245433d6423SLionel Sambuc #define MMCHS_SD_STAT_CC_UNRAISED (0x0 << 0) /* Command not completed */ 246433d6423SLionel Sambuc #define MMCHS_SD_STAT_CC_RAISED (0x1 << 0) /* Command completed */ 247433d6423SLionel Sambuc #define MMCHS_SD_STAT_TC (0x1 << 1) /* Transfer complete status */ 248433d6423SLionel Sambuc #define MMCHS_SD_STAT_TC_UNRAISED (0x0 << 1) /* Transfer not completed */ 249433d6423SLionel Sambuc #define MMCHS_SD_STAT_TC_RAISED (0x1 << 1) /* Transfer completed */ 250433d6423SLionel Sambuc 251433d6423SLionel Sambuc #define MMCHS_SD_IE_ERROR_MASK (0xff << 15 | 0x3 << 24 | 0x03 << 28) 252433d6423SLionel Sambuc 253433d6423SLionel Sambuc #define MMCHS_SD_IE_CC_ENABLE (0x1 << 0) /* Command complete interrupt enable */ 254433d6423SLionel Sambuc #define MMCHS_SD_IE_CC_ENABLE_ENABLE (0x1 << 0) /* Command complete Interrupts are enabled */ 255433d6423SLionel Sambuc #define MMCHS_SD_IE_CC_ENABLE_CLEAR (0x1 << 0) /* Clearing is done by writing a 0x1 */ 256433d6423SLionel Sambuc 257433d6423SLionel Sambuc #define MMCHS_SD_IE_TC_ENABLE (0x1 << 1) /* Transfer complete interrupt enable */ 258433d6423SLionel Sambuc #define MMCHS_SD_IE_TC_ENABLE_ENABLE (0x1 << 1) /* Transfer complete Interrupts are enabled */ 259433d6423SLionel Sambuc #define MMCHS_SD_IE_TC_ENABLE_CLEAR (0x1 << 1) /* Clearing TC is done by writing a 0x1 */ 260433d6423SLionel Sambuc 261433d6423SLionel Sambuc #define MMCHS_SD_IE_BRR_ENABLE (0x1 << 5) /* Buffer read ready interrupt */ 262433d6423SLionel Sambuc #define MMCHS_SD_IE_BRR_ENABLE_DISABLE (0x0 << 5) /* Buffer read ready interrupt disable */ 263433d6423SLionel Sambuc #define MMCHS_SD_IE_BRR_ENABLE_ENABLE (0x1 << 5) /* Buffer read ready interrupt enable */ 264433d6423SLionel Sambuc #define MMCHS_SD_IE_BRR_ENABLE_CLEAR (0x1 << 5) /* Buffer read ready interrupt clear */ 265433d6423SLionel Sambuc 266433d6423SLionel Sambuc #define MMCHS_SD_IE_BWR_ENABLE (0x1 << 4) /* Buffer write ready interrupt */ 267433d6423SLionel Sambuc #define MMCHS_SD_IE_BWR_ENABLE_DISABLE (0x0 << 4) /* Buffer write ready interrupt disable */ 268433d6423SLionel Sambuc #define MMCHS_SD_IE_BWR_ENABLE_ENABLE (0x1 << 4) /* Buffer write ready interrupt enable */ 269433d6423SLionel Sambuc #define MMCHS_SD_IE_BWR_ENABLE_CLEAR (0x1 << 4) /* Buffer write ready interrupt clear */ 270433d6423SLionel Sambuc 271433d6423SLionel Sambuc #define MMCHS_SD_CAPA_VS_MASK (0x7 << 24 ) /* voltage mask */ 272433d6423SLionel Sambuc #define MMCHS_SD_CAPA_VS18 (0x01 << 26 ) /* 1.8 volt */ 273433d6423SLionel Sambuc #define MMCHS_SD_CAPA_VS30 (0x01 << 25 ) /* 3.0 volt */ 274433d6423SLionel Sambuc #define MMCHS_SD_CAPA_VS33 (0x01 << 24 ) /* 3.3 volt */ 275433d6423SLionel Sambuc 276