sdio.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * include/linux/mmc/sdio.h
  3. *
  4. * Copyright 2006-2007 Pierre Ossman
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at
  9. * your option) any later version.
  10. */
  11. #ifndef LINUX_MMC_SDIO_H
  12. #define LINUX_MMC_SDIO_H
  13. /* SDIO commands type argument response */
  14. #define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
  15. #define SD_IO_RW_DIRECT 52 /* ac [31:0] See below R5 */
  16. #define SD_IO_RW_EXTENDED 53 /* adtc [31:0] See below R5 */
  17. /*
  18. * SD_IO_RW_DIRECT argument format:
  19. *
  20. * [31] R/W flag
  21. * [30:28] Function number
  22. * [27] RAW flag
  23. * [25:9] Register address
  24. * [7:0] Data
  25. */
  26. /*
  27. * SD_IO_RW_EXTENDED argument format:
  28. *
  29. * [31] R/W flag
  30. * [30:28] Function number
  31. * [27] Block mode
  32. * [26] Increment address
  33. * [25:9] Register address
  34. * [8:0] Byte/block count
  35. */
  36. #define R4_MEMORY_PRESENT (1 << 27)
  37. /*
  38. SDIO status in R5
  39. Type
  40. e : error bit
  41. s : status bit
  42. r : detected and set for the actual command response
  43. x : detected and set during command execution. the host must poll
  44. the card by sending status command in order to read these bits.
  45. Clear condition
  46. a : according to the card state
  47. b : always related to the previous command. Reception of
  48. a valid command will clear it (with a delay of one command)
  49. c : clear by read
  50. */
  51. #define R5_COM_CRC_ERROR (1 << 15) /* er, b */
  52. #define R5_ILLEGAL_COMMAND (1 << 14) /* er, b */
  53. #define R5_ERROR (1 << 11) /* erx, c */
  54. #define R5_FUNCTION_NUMBER (1 << 9) /* er, c */
  55. #define R5_OUT_OF_RANGE (1 << 8) /* er, c */
  56. #define R5_STATUS(x) (x & 0xCB00)
  57. #define R5_IO_CURRENT_STATE(x) ((x & 0x3000) >> 12) /* s, b */
  58. /*
  59. * Card Common Control Registers (CCCR)
  60. */
  61. #define SDIO_CCCR_CCCR 0x00
  62. #define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
  63. #define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
  64. #define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
  65. #define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
  66. #define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
  67. #define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
  68. #define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
  69. #define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
  70. #define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
  71. #define SDIO_CCCR_SD 0x01
  72. #define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
  73. #define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
  74. #define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
  75. #define SDIO_CCCR_IOEx 0x02
  76. #define SDIO_CCCR_IORx 0x03
  77. #define SDIO_CCCR_IENx 0x04 /* Function/Master Interrupt Enable */
  78. #define SDIO_CCCR_INTx 0x05 /* Function Interrupt Pending */
  79. #define SDIO_CCCR_ABORT 0x06 /* function abort/card reset */
  80. #define SDIO_CCCR_IF 0x07 /* bus interface controls */
  81. #define SDIO_BUS_WIDTH_1BIT 0x00
  82. #define SDIO_BUS_WIDTH_4BIT 0x02
  83. #define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
  84. #define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
  85. #define SDIO_BUS_ASYNC_INT 0x20
  86. #define SDIO_BUS_CD_DISABLE 0x80 /* disable pull-up on DAT3 (pin 1) */
  87. #define SDIO_CCCR_CAPS 0x08
  88. #define SDIO_CCCR_CAP_SDC 0x01 /* can do CMD52 while data transfer */
  89. #define SDIO_CCCR_CAP_SMB 0x02 /* can do multi-block xfers (CMD53) */
  90. #define SDIO_CCCR_CAP_SRW 0x04 /* supports read-wait protocol */
  91. #define SDIO_CCCR_CAP_SBS 0x08 /* supports suspend/resume */
  92. #define SDIO_CCCR_CAP_S4MI 0x10 /* interrupt during 4-bit CMD53 */
  93. #define SDIO_CCCR_CAP_E4MI 0x20 /* enable ints during 4-bit CMD53 */
  94. #define SDIO_CCCR_CAP_LSC 0x40 /* low speed card */
  95. #define SDIO_CCCR_CAP_4BLS 0x80 /* 4 bit low speed card */
  96. #define SDIO_CCCR_CIS 0x09 /* common CIS pointer (3 bytes) */
  97. /* Following 4 regs are valid only if SBS is set */
  98. #define SDIO_CCCR_SUSPEND 0x0c
  99. #define SDIO_CCCR_SELx 0x0d
  100. #define SDIO_CCCR_EXECx 0x0e
  101. #define SDIO_CCCR_READYx 0x0f
  102. #define SDIO_CCCR_BLKSIZE 0x10
  103. #define SDIO_CCCR_POWER 0x12
  104. #define SDIO_POWER_SMPC 0x01 /* Supports Master Power Control */
  105. #define SDIO_POWER_EMPC 0x02 /* Enable Master Power Control */
  106. #define SDIO_CCCR_SPEED 0x13
  107. #define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
  108. #define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */
  109. /*
  110. * Function Basic Registers (FBR)
  111. */
  112. #define SDIO_FBR_BASE(f) ((f) * 0x100) /* base of function f's FBRs */
  113. #define SDIO_FBR_STD_IF 0x00
  114. #define SDIO_FBR_SUPPORTS_CSA 0x40 /* supports Code Storage Area */
  115. #define SDIO_FBR_ENABLE_CSA 0x80 /* enable Code Storage Area */
  116. #define SDIO_FBR_STD_IF_EXT 0x01
  117. #define SDIO_FBR_POWER 0x02
  118. #define SDIO_FBR_POWER_SPS 0x01 /* Supports Power Selection */
  119. #define SDIO_FBR_POWER_EPS 0x02 /* Enable (low) Power Selection */
  120. #define SDIO_FBR_CIS 0x09 /* CIS pointer (3 bytes) */
  121. #define SDIO_FBR_CSA 0x0C /* CSA pointer (3 bytes) */
  122. #define SDIO_FBR_CSA_DATA 0x0F
  123. #define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
  124. #endif /* LINUX_MMC_SDIO_H */